Reputation: 751
I am trying to get video to loop using video.js. On Android at least, the 'loop' tag doesn't work. I found some posts online that said to listen for the 'ended' event and then use that to set the currentTime and then play again.
But that doesn't work for me. It seems my 'ended' function is not ever called. Does that sound familiar to anyone?
Thanks
Upvotes: 0
Views: 5209
Reputation: 678
The API documentation that is more relevant is on github.
Your basic setup is working for me (depending on how you're initializing your player - can't tell from your question). See demo at http://jsbin.com/uqukot/5/edit
Upvotes: 0
Reputation: 751
oop just found this: ended event videojs not working
Those a holes should update their fancy-looking API documentation! http://www.videojs.com/docs/api/
Now my 'ended' function is being called -- but the stupid video still doesn't loop? Any ideas? Here is my function:
var myFunc = function() {
var myPlayer = this;
console.log('ended current time = '+myPlayer.currentTime());
console.log(' duration: '+myPlayer.duration());
myPlayer.currentTime(0);
myPlayer.play();
};
myPlayer.on('ended',myFunc);
It reports the current time as already being 0 when the ended function is called. That doesn't seem right. Anyone have any experience with this? These are very short looping clips I am trying to play, only a few seconds anyway. Maybe video.js can't handle that?
Upvotes: 1