Other也可以,但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);
这些接口都不存在,如何在videojs
中绑定事件
发布于 2017-11-16 22:37:42
这就是我如何在启动时在定义的位置上播放视频(它消除了视频首先开始,然后才跳到视频位置的问题):
$(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
发布于 2015-03-03 11:35:11
哦,幸运的是,我在https://github.com/videojs/video.js中找到了一个例子
var dom = document.getElementById('example_video_1');
videojs(dom, {}, function(){
this.on('loadedmetadata', function(){
this.currentTime(500);
});
});
这就是工作,绑定事件的接口是player.on(' event ',fn);
videojs很酷~
https://stackoverflow.com/questions/28823567
复制相似问题