How to set start and end time parameters using Vimeo player?

前端 未结 2 2042
没有蜡笔的小新
没有蜡笔的小新 2021-02-19 09:05

For Youtube player I can set start and end time parameters which will crop video in this range. How can I do the same thing using Vimeo player?

2条回答
  •  天涯浪人
    2021-02-19 09:11

    I was able to solve it using "setCurrentTime" for set the start of the video, and 'timeupdate' for set the end.

    For the start of the video at a specific time:

    Player.setCurrentTime(5);
    

    The video will start after 5 seconds.

    For the end of video:

    video01Player.on('timeupdate', function(data) {
      if (data.seconds > '10') {
    
        video01Player.pause();
     
      }
    });
    

    In this case the video will pause after 10 seconds.

    timeupdate This event fires when the playback position of the video changes, generally every 250 ms during playback, but the interval can vary depending on the browser.

提交回复
热议问题