HTML5视频 - 未设置当前时间

时间:2013-02-07 08:05:38

标签: html5-video

这让我疯了!

video.addEventListener 'ended', (e) =>
    e.target.currentTime = 0
    console.log e.target.currentTime
    # 5.33 seconds NOT 0

播放视频,并调用已结束的事件,但不更改当前时间。

1 个答案:

答案 0 :(得分:0)

这可以帮到你:

video = document.getElementById('video');
begin_play  = 50;
play_video_frist = true; //if you want to run only frist time    
video.addEventListener("play", capture, false);

function capture(event) 
{
     if (event.type == "play") {
         if (play_video_frist) {
             play_video_frist = false;
             video.currentTime = begin_play;
          }
     }
}