PDA

View Full Version : Looping video



handemmet
15 Aug 2012, 2:10 AM
Hi

Is it possible to loop a video in a scene??
I placed an action at the end of the scene to 'restart' but the video doesn't loop.
I tried adding '50' to the iterations on the video element but still nothing.

Can anybody help me??

E

arnebech
20 Aug 2012, 7:35 AM
If you want to a loop a video when it ends, you could do something like this for the custom JS start action of the scene. Make sure you video id is "my-video-id" or matches that in the code.



if (!this.videoListener) {

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

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

videoElement.addEventListener('ended',function(){
videoElement.play();
},false);

}

exs
5 Oct 2012, 2:34 PM
works great! thanks for the tip Arne :)