PDA

View Full Version : End of Movie Transition



I3D
16 Nov 2011, 9:08 PM
Hi Guys

How can i initiate a transition to another scene when ever a video ends playing? is there a way to catch that?

Best

arnebech
17 Nov 2011, 9:31 AM
I haven't tried this myself, but this might work:

You can set a start action for the scene with the video to custom js.
Give the video a css id (e.g. "funVideo")

then you can do something like this in for the start action js



//not tested code
var video = document.querySelector("#funVideo video");

//psudo code
if we haven't set up the listener before
attach event listener for "ended" to the video element
callback function:
controller.goToNextScene();

I3D
17 Nov 2011, 3:00 PM
Thanks arnebech

I do have a problem with the video Auto play, once i select the auto play on the video it start from the beginning of the site even though the video is the last scene. How can i target the video play through code? same approach as targeting the end? does it need a listener?

thanks

arnebech
17 Nov 2011, 3:17 PM
Again, this is untested, but here is my best guess.

Turn off auto play.
In the custom js start action I talked about in my previous post, you could do something like this:



var video = ... //same as previous code

video.play();

I3D
17 Nov 2011, 4:14 PM
Thanks arne :)

cheers

I3D
20 Nov 2011, 7:08 PM
Hi Arne

Adding the event listener is giving me an "'undefined' is not a function" error! any idea how to solve this.

actually the querySelector gives a NULL when adding the event listener, and getElement gives an UNDEFINED!

thanks

arnebech
21 Nov 2011, 10:10 AM
Are you giving the video element a css id?

29451




//this should work as a start action for the scene
var video = document.querySelector("#funVideo video");
video.play();

I3D
21 Nov 2011, 2:21 PM
Hi ArneThanks for the help, the video worked last night, i tested the same approach on the audio first and when it didn't work i thought the same holds true for the video, but the video part worked.question, do you offer and paid support options for Sencha Animate?

arnebech
21 Nov 2011, 2:24 PM
No, we don't offer regular paid support at this point. However, we try to respond to forum questions.

I3D
21 Nov 2011, 2:28 PM
I understand, problem for us is that we're at the other part of the earth (Australia) and the time differento get a responce is not on our favor. Thanks