groups and automatically iterated scene playlist

ayasha
Posts: 3
Joined: Mon May 22, 2017 1:02 pm

groups and automatically iterated scene playlist

Postby ayasha » Mon May 22, 2017 1:55 pm

hey guys, i have two questions and hope you can give me an answer.

1. I have understand, that i have the oppertunity to set multiple scenes, but now i want to play them automatically scene after scene. Is there a way to do that (with no extra scripts)?
2. I have found the group element on the json documentation, but i haven't understand for what groups are good for. Can someone explain it to me, please?

User avatar
rroux
ForgeJS Team
Posts: 120
Joined: Wed Oct 26, 2016 12:19 pm

Re: groups and automatically iterated scene playlist

Postby rroux » Mon May 22, 2017 3:08 pm

Hello ayasha,

Groups are just here to organise your story. For example if you make a project to show a building, you can group your scene by floors.
So if you sort your scene in groups floor by floor you can imagine a button to go from a group to another and it will go upstairs or downstairs ... (The building case is just an example of course).

We have no feature to change the scene automatically but it is on our long term roadmap. We call this "timeline" feature but we do not have started to develop it right now.

On what criteria you would automatically go to the next scene?
- An amount of time?
- At the end of a video scene it will go to the next video scene?
- A director's cut track that rotates the camera then change the scene after each rotation complete?

What do you have in mind?

Have a nice day!
- Raphaël

ayasha
Posts: 3
Joined: Mon May 22, 2017 1:02 pm

Re: groups and automatically iterated scene playlist

Postby ayasha » Mon May 22, 2017 4:26 pm

Ah for that are the groups good ^^.

No automatically change of video scenes, that's unlucky :( . Yes i need it at most in my project to change the scenes when the actual scene ends.

And thank you for the fast answer :)

User avatar
rroux
ForgeJS Team
Posts: 120
Joined: Wed Oct 26, 2016 12:19 pm

Re: groups and automatically iterated scene playlist

Postby rroux » Tue May 23, 2017 9:45 am

Hello ayasha,

I'm working on the 0.9.3 release today. Once released i'll work on a little code that will do the job for you.
Basically you have to listen the scene loadComplete, then listen the onEnded event of the video media that will trigger the next scene action!
In a next release you'll be able to do this trough the json configuration, it is on our roadmap.

Have a nice day.
- Raphaël

ayasha
Posts: 3
Joined: Mon May 22, 2017 1:02 pm

Re: groups and automatically iterated scene playlist

Postby ayasha » Tue May 23, 2017 6:55 pm

thanks a lot :)

User avatar
rroux
ForgeJS Team
Posts: 120
Joined: Wed Oct 26, 2016 12:19 pm

Re: groups and automatically iterated scene playlist

Postby rroux » Wed May 24, 2017 1:17 pm

Hello ayasha,

I worked on your case today and here I am with a solution for you. It is a bit "quick and dirty" but it does the job. In a future version we will try to add this feature in the json configuration.

First, the javascript code you need to use in your index.html. I just create a viewer then listen to the events I'm interested in:

  1. var viewer = new FORGE.Viewer("container", "config.json");
  2.  
  3.         function onReadyHandler()
  4.         {
  5.             viewer.story.onSceneLoadComplete.add(onSceneLoadCompleteHandler);
  6.         }
  7.  
  8.         function onSceneLoadCompleteHandler()
  9.         {
  10.             var media = viewer.story.scene.media;
  11.  
  12.             if(media.type === FORGE.MediaType.VIDEO)
  13.             {
  14.                 var video = media.displayObject;
  15.  
  16.                 video.onEnded.add(onEndedHandler);
  17.             }
  18.         }
  19.  
  20.         function onEndedHandler()
  21.         {
  22.             viewer.story.nextScene();
  23.         }
  24.  
  25.         viewer.onReady.addOnce(onReadyHandler);


And here is my json configuration with two video scene. Be sure to set the media loop option to false!

  1. {
  2.     "story":
  3.     {
  4.         "uid": "story-0",
  5.         "name": "Karting Race",
  6.         "slug": "kart-race",
  7.         "description": "This project have video scenes that goes to the next video automatically at the end of the current video.",
  8.         "default": "scene-0",
  9.  
  10.         "scenes":
  11.         [
  12.             {
  13.                 "uid": "scene-0",
  14.                 "name": "Samy Karting",
  15.                 "slug": "samy-karting",
  16.                 "description": "Samy Karting Session",
  17.  
  18.                 "media":
  19.                 {
  20.                     "uid": "media-0",
  21.                     "type": "video",
  22.  
  23.                     "source":
  24.                     {
  25.                         "format": "equi",
  26.                         "streaming": "dash",
  27.                         "url": "https://cdn.forgejs.org/samples/vrrroom/videos/460017/460017.mpd"
  28.                     },
  29.  
  30.                     "options":
  31.                     {
  32.                         "autoPlay": true,
  33.                         "loop": false,
  34.                         "volume": 0
  35.                     }
  36.                 }
  37.             },
  38.  
  39.             {
  40.                 "uid": "scene-1",
  41.                 "name": "Martin Karting",
  42.                 "slug": "martin-karting",
  43.                 "description": "Martin Karting Session",
  44.  
  45.                 "media":
  46.                 {
  47.                     "uid": "media-1",
  48.                     "type": "video",
  49.  
  50.                     "source":
  51.                     {
  52.                         "format": "equi",
  53.                         "streaming": "dash",
  54.                         "url": "https://cdn.forgejs.org/samples/vrrroom/videos/459989/459989.mpd"
  55.                     },
  56.  
  57.                     "options":
  58.                     {
  59.                         "autoPlay": true,
  60.                         "loop": false,
  61.                         "volume": 0
  62.                     }
  63.                 }
  64.             }
  65.         ]
  66.     }
  67. }


Each video represents a kart track lap. You can check the scene uid in the url bar or by typing in your console:

  1. viewer.story.sceneUid


That's it, hope this helps!

Have a nice day!
- Raphaël

Who is online

Users browsing this forum: No registered users and 2 guests