【发布时间】:2013-06-17 15:58:05
【问题描述】:
我已经为 4.0+ 版本创建了一个这样的插件
function examplePlugin(options) {
this.on('play', function(e) {
console.log('playback has started!');
});
vjs.NewPlayButton = vjs.Component.extend({
init: function(player, options){
vjs.Component.call(this, player, options);
console.log('init New play btn');
}
});
};
并像
一样注册了插件vjs.plugin('examplePlugin', examplePlugin);
我已经在 html 之上包含了库,比如
<script src="js/video.dev.js"></script>
<script src="js/exampleplugin.js"></script>
在我看到的很多例子中,我们可以通过当前视频实例初始化插件,我想在所有实例中添加这个插件,这将是动态的。
所以就像它必须添加的默认组件一样。现在我没有得到任何日志。
有没有办法初始化它?即使不是作为插件,我只是想再添加一个自定义组件。
【问题讨论】:
标签: javascript html html5-video video.js