gpt4 book ai didi

ios - 如何在 Safari for iOS 的 video.js 中设置 currentTime

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:26:28 36 4
gpt4 key购买 nike

其他都可以,但是currentTime的设置:

我尝试了一些方法,例如:

videojs("example_video_1", {}, function() {
this.currentTime(200);
this.play();
});

这是行不通的。

videojs("example_video_1").ready(function(){
this.currentTime(200);
});

这也行不通。

var dom = document.getElementById('example_video_1');
dom.addEventListener("loadedmetadata", function() {
dom.currentTime = 100;
}, false); // ok for no video.js
videojs(dom);

不工作。甚至反转addEventListener 和init videojs 的行。

我尝试了 videojs 事件。

var player = videojs("example_video_1");
alert(player.addEvent);
alert(player.addEventListener);

这些API都不存在,如何在videojs中绑定(bind)Event?

最佳答案

这就是我如何在启动时在定义的位置播放视频(它消除了视频首先开始然后才跳转到视频位置的问题):

$(document).ready(function()
{
var timecode = 120;
var initdone = false;

// wait for video metadata to load, then set time
video.on("loadedmetadata", function(){
video.currentTime(timecode);
});

// iPhone/iPad need to play first, then set the time
// events: https://www.w3.org/TR/html5/embedded-content-0.html#mediaevents
video.on("canplaythrough", function(){
if(!initdone)
{
video.currentTime(timecode);
initdone = true;
}
});

}); // END ready

关于ios - 如何在 Safari for iOS 的 video.js 中设置 currentTime,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28823567/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com