Insert title here
id="my-player"
class="video-js"
controls
preload="auto"
poster="//vjs.zencdn.net/v/oceans.png"
data-setup=‘{}‘>
var player = videojs(‘my-player‘);
var options = {};
var player = videojs(‘my-player‘, options, function onPlayerReady() {
videojs.log(‘Your player is ready!‘);
// In this context, `this` is the player that was created by Video.js.
this.play();
// How about an event listener?
this.on(‘ended‘, function() {
videojs.log(‘Awww...over so soon?!‘);
});
});
本文介绍了如何使用Video.js库创建一个基础的视频播放器,并演示了如何设置预加载、添加事件监听来控制播放。通过`my-player`元素,作者展示了如何在准备就绪后播放视频并监听'ended'事件。
1443

被折叠的 条评论
为什么被折叠?



