我真的不知道我的代码出了什么问题!我尝试将end事件附加到我的播放器上,因为我在firefox控制台中收到以下错误:
"TypeError: this.addEvent不是函数“
我试了很多方法,但都不能解决这个问题!
<!DOCTYPE html>
<html>
<head>
<link href="video-js.css" rel="stylesheet" type="text/css">
<script src="video.js"></script>
<script>_V_.options.flash.swf = "video-js.swf";</script>
</head>
<body>
<video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="400" height="500" data-setup='{}'
poster="http://video-js.zencoder.com/oceans-clip.png">
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4' />
<source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm' />
<source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg' />
<track kind="captions" src="demo.captions.vtt" srclang="en" label="English" />
</video>
<script>
var myPlayer = videojs("example_video_1");
videojs("example_video_1").ready(function(){
var myPlayer = this;
var videoEnd = function(){
console.log('ended')
};
myPlayer.addEvent("ended", videoEnd);
});
</script>
</body>
</html>你能帮帮我吗?非常感谢
发布于 2013-05-20 19:53:47
video.js最近更新到了版本4,其中的一些内容也发生了变化。您需要使用myPlayer.on("ended", videoEnd);
接口文档:https://github.com/videojs/video.js/blob/master/docs/api/vjs.Player.md
https://stackoverflow.com/questions/16647942
复制相似问题