Video end event?

rvanderleest
Posts: 1
Joined: Wed May 10, 2017 6:59 pm

Video end event?

Postby rvanderleest » Wed May 10, 2017 7:06 pm

Is there any event fired when reaching the end of a media's video (other than the regular video ended event)? I'd like to change scenes when a video ends and not necessarily to the next scene in the list. Is there any way to do this via the JSON configuration, or would it need to be handled in JS?

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

Re: Video end event?

Postby rroux » Wed May 10, 2017 9:07 pm

Hello rvanderleest,

You can't do this with the JSON configuration for now.
But we have media events in JSON configuration to our roadmap.

In the meantime, you can access the Video object like this:

  1. viewer.story.scene.media.displayObject


You can add an event listener like this:

  1. function callback()
  2. {
  3.     viewer.story.loadScene("scene-uid");
  4. }
  5.  
  6. viewer.story.scene.media.displayObject.onEnded.addOnce(callback, this);


Something like this will do the trick

Hope this helps
- Raphaël

civilmatador
Posts: 2
Joined: Mon Jun 12, 2017 10:07 pm

Re: Video end event?

Postby civilmatador » Wed Jun 14, 2017 6:40 am

I hope I'm not the only one unable to make this code snippet work.

What I'm trying to do is direct to a new page on video completion. I took the segment listed above and tried running it as is and then again with "videoPushURL ()" replacing the 'viewer.story.loadScene()' portion of the function.

Any suggestions on how I might try to get this to work?

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

Re: Video end event?

Postby rroux » Wed Jun 14, 2017 8:31 am

Hi, you should take a look at this answer : viewtopic.php?f=8&t=120#p352

In this case it is to go to the next scene after the video ends, but you can replace this behaviour by one of yours.
Tell me if it helps you!

Have a nice day!
- Raphaël

Who is online

Users browsing this forum: No registered users and 2 guests