2013-10-07 65 views
0

我們如何使用video.js來做到這一點我最初的想法是我們可以在視頻結束時觸發播放。循環播放html5視頻集次數

僞代碼

for (int i = number_of_times_to_loop, i>=0, i--) { 
     see if the timer of the video reached the end { 
      trigger play from start 
     } 
    } 

回答

0

您可以播放視頻的端事件循環。然後,只需要跟蹤您已經播放了多少次。

var max = 3, 
    i = 1; 

videojs("home_video").on('ended', function(event) { 
    if (i < max) { 
    this.play(); 
    i++; 
    } 
});