简体   繁体   中英

JWPlayer callback function is not getting executed

In code shown below overlay function is not called.

 (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.
In order to add plugin to JW player. Below are the steps:

  1. Sign up to jw player and include JS file from there in HTML file. Publish > Tools.

    File to be included

  2. Setup video and embed it in HTML page. Note here in jwplayer().setup() function we have added our plugin that we need to associate with our player.
    <script> jwplayer("myDiv").setup({ "file": "file.mp4", "image": "myImage.png", "height": 360, "width": 640, plugins: { 'customPlugin.js': { "key": "helloworld" } } }); </script>

  3. Now in customPlugin.js file register your plugin.

     (function (jwplayer) { var pluginCallback = function(player, config, div) { console.log(config.key); }; jwplayer().registerPlugin('customPlugin', '7.0', pluginCallback); })(jwplayer); 
  4. Output on console is helloworld.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM