[英]JWPlayer callback function is not getting executed
In code shown below overlay function is not called. 在下面显示的代码中,未调用overlay函数。
(function(jwplayer) {
var overlay = function( player, config, div ) {
console.log('hi');
}
jwplayer().registerPlugin( 'overlay','2.0', overlay );
})(jwplayer);
Please help me with it. 请帮我。 Also I am not recieving any errors on console. 另外,我在控制台上没有收到任何错误。
Thanks @jherrieven for guiding me. 感谢@jherrieven指导我。
In order to add plugin to JW player. 为了添加插件到JW播放器。 Below are the steps: 步骤如下:
Sign up to jw player and include JS file from there in HTML file. 注册jw player,然后将JS文件包含在HTML文件中。 Publish > Tools. 发布>工具。
Setup video and embed it in HTML page. 设置视频并将其嵌入HTML页面。 Note here in jwplayer().setup() function we have added our plugin that we need to associate with our player. 请注意,在jwplayer()。setup()函数中,我们添加了需要与播放器关联的插件。
<script> jwplayer("myDiv").setup({ "file": "file.mp4", "image": "myImage.png", "height": 360, "width": 640, plugins: { 'customPlugin.js': { "key": "helloworld" } } }); </script>
Now in customPlugin.js file register your plugin. 现在在customPlugin.js文件中注册您的插件。
(function (jwplayer) { var pluginCallback = function(player, config, div) { console.log(config.key); }; jwplayer().registerPlugin('customPlugin', '7.0', pluginCallback); })(jwplayer);
Output on console is helloworld. 控制台上的输出是helloworld。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.