【问题标题】:Looping a html5 video set number of times循环播放 html5 视频集的次数
【发布时间】:2013-10-07 16:15:52
【问题描述】:

我们如何使用 video.js 做到这一点我最初的想法是我们可以在视频结束时触发播放。

伪代码

    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
        }
    }

【问题讨论】:

    标签: html5-video video.js


    【解决方案1】:

    您可以在结束事件上循环播放视频。然后只需跟踪您已经玩了多少次。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-12-26
      • 1970-01-01
      • 2011-04-08
      • 1970-01-01
      • 2015-07-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多