Reputation: 71
<video onended="prtlog('play again?');">
When the video ends, "play again" will show under the video.
How can I change/add code to my program that then when user clicks "play again", the video will play again?
Upvotes: 7
Views: 17644
Reputation: 193
<video loop>
The html attribute "loop" will replay your video automatically.
Upvotes: -1
Reputation: 730
If you want to add a replay button to your video just check when curVid.currentTime == curVid.duration and have the button display. The code for the button is below. You can display your button whenever you'd like and it will always restart your video.
var curVid = getElementById('videoClip');
$(document).on('click','#replayBtn',function(){
curVid.pause();
curVid.currentTime = '0';
curVid.play();
});
Upvotes: 24