Make HTML5 video stop at indicated time

后端 未结 4 1269
太阳男子
太阳男子 2021-02-07 07:45

I have a HTML5 video element in my page. The video I want to play is having a duration of 10 minutes.

I have to play the part of the video from minute

4条回答
  •  清歌不尽
    2021-02-07 08:28

    So as below

    
    

    using Above HTML attach an Event

    var vid = document.getElementById("myVid");
    vid.addEventListener("timeupdate", function(){
    // Check you time here and
    if(t >= 300000) //Where t = CurrentTime
    {
    vid.stop();// Stop the Video
    }
    });
    

    This is the right way of doing it.

提交回复
热议问题