回退到 Flash 时,使用 VideoJS 库循环播放视频

play a video in a loop with VideoJS library when falling back to Flash

本文关键字:循环 播放 视频 VideoJS 使用 Flash 回退      更新时间:2023-09-26

我在旧版本的Firefox中使用VideoJS库显示视频时遇到了问题。VideoJS提供了在这种情况下使用Flash的回退,所以这就是我在下面的代码中所做的(techOrder首先使用flash,这仅适用于FF)

var golf_vid;
videojs("golf_video", { techOrder: ['flash','html5'] }).ready(function() {
   golf_vid = this;
   golf_vid.on("ended", replay_video);
   golf_vid.play();
});
function replay_video() {
   golf_vid.play();
}

当我不使用 Flash 时,循环播放视频的功能适用于 <video> 标签。但是使用 Flash 停止并且不会重新启动 - 有没有办法循环播放它?

找到了这个问题的答案,就在这里(希望将来对其他人有所帮助)。

// play the video in a loop and use the correct tech order based on the browser
videojs("golf_video", { loop: true, techOrder: ['flash','html5'] }).ready(function() {
   golf_vid = this;
   golf_vid.on("ended", replay_video);
   golf_vid.play();
});