View Full Version : jumping to a scene after h.264 movie stops / user clicks "back"

9 Feb 2012, 10:34 AM
I have couple of questions:

1. is there a way to jump to a particular scene after a h.264 movie reaches the end?
2. i also noticed when I hit back while h.264 movie is playing, i can still hear the audio from the movie. Is this a bug?


9 Feb 2012, 3:57 PM
1. Yes I believe you can listen for an event on the video that will tell you when it is done. Google "HTML5 media events". Then you can call "controller.goToNextScene()" once the video is done.

2. Not sure what you are meaning by 'back'. For animator projects, the video will probably not stop if you switch scenes, you would have to stop it with JS by using a scene end/start handler.

9 Feb 2012, 4:52 PM
Do I put the js in the "custom JS section" or in an HTML editor?

10 Feb 2012, 6:31 AM
I'd recommend using the custom js feature in Animator.

14 Aug 2012, 6:22 PM
I have a single video playing in scene 2. When the video ends, I simply want Animator to jump to the scene 3. Can someone please explain and provide an example or the code to do so? Your time is very much appreciated.

20 Aug 2012, 7:28 AM
You could do something like this. Make sure to give your video element an id of "my-video-id" or change the id in the code to match your video id.

This, should jump to the next scene when the video is done. However, you'll have to watch out if you change the scene before the video is done, since the video can still be playing in the background and firing the ended event even though it is not visible.

if (!this.videoListener) {

//so we only call this once
this.videoListener = true;

var videoContainer = controller.getElementById('my-video-id');
var videoElement = videoContainer.querySelector('video');