jquery - Javascript - how to tell the video element to stop playing the video at xyz duration? -
i have content in french, nederland, english (on same topic example: "global warming" )
but in 1 large file, how can tell video element please play duration 00:00:00 till 00:05:00 not play whole 02:00:00 ?
function video_play_onetime_withcut(input) {   $('#mediaplayer').prop('loop', false);        $('#mediaplayer').attr('src', filename).show();   mediaplay_video= document.getelementbyid('mediaplayer');   mediaplay_video.play();     mediaplay_video.onended = function(e) {     console.log('>>> playing finished: ', e);   }; } 
use timeupdate event.
mediaplay_video.ontimeupdate = function(event) {   if( mediaplay_video.currenttime === 5 * 60 ) {     mediaplay_video.pause();      // don't stop player multiple times if user     //   wants see whole thing...     mediaplay_video.ontimeupdate = false;      // whatever want.   } }; if plan hide player afterwards, can use this:
mediaplay_video.ontimeupdate = function(event) {   if( mediaplay_video.currenttime >= 5 * 60 ) {     mediaplay_video.pause();     // @todo: remove player element...   } }; more information can found here.
Comments
Post a Comment