jquery - Loop HTML5 Videos on "ended" Event -


an html5 video plays. once has finished, script below called, incriments next video adds next line , begins playing it. how turn loop once second video finishes playing, append third video, , on?

<div>     <video id="video0" autoplay>         <source src="video0.mp4" />     </video> </div> 

.

var i=0 $('video'+i).on("ended", function() {     i++;     $(this).parent().append('<br /><video id="video'         +         + '" autoplay><source src="video'         +         + '.mp4" /></video>');     }; 

updated answer:

after re-reading question , seeing changes, here logic should you're asking...

var = 0; var numvideos = 5; var addvideo = function() {     i++;     var nextvideo=$('<video id="video'         +         + '" autoplay><source src="video'         +         + '.mp4" /></video>');     nextvideo.on('ended', addvideo);     $(this).after('<br />').after(nextvideo); }; $('video0').on('ended', addvideo); 

original answer:

how adding loop attribute video tag? w3 resource


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -