Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

Local javascript plugin development

4 replies [Last post]
Reply

Hi all,

I'm trying to get started with plugin development, against a local development server.

I've copied the javascript example plugin hello world code to a local file (same directory as the jwplayer file). So then I'm attempting to load the plugin with the player like so:

<script type="text/javascript" src="assets/js/specialist/jwplayer.packed.js"></script>
<script type="text/javascript">
$(document).ready(function() {
jwplayer('player').setup({
flashplayer: 'assets/swf/player.swf',
file: 'FILE_URL_HERE',
image: 'STILL_URL_HERE',
width: 400,
height: 250,
stretching: 'fill',
plugins: { 'assets/js/specialist/jwplayer.helloworld.js': { text: 'It works...' } }
});
});
</script>

And the plugin is:

(function(jwplayer){

    var template = function(player, config, div) {
        function setup(evt) {
//            div.style.color = 'white';
//            console.log(config.text);
            console.log('Setup of plugin');
        }
        player.onReady(setup);
        this.resize = function(width, height) {};
    };

    jwplayer().registerPlugin('hello', template);

})(jwplayer);

However, when the page is loaded I can see from chromes console that this message is output.

A plugin (helloworld) was registered with the player that was not loaded. Please check your configuration.

I've probably been over this so many times now that I can't see what would be wrong with my configuration for this not to work. For the record I'm using a licensed 5.7 version of the jwplayer.

Thanks,
Jim

Reply

The plugin registration line is actually:

jwplayer().registerPlugin('helloworld', template);

Not what was previously written, I've been trying many variations is all.

Reply

Same problem. Only in my case I am having problems with a hosted plugin so I downloaded the source so that I can host it and make fixes where necessary. According to the docs I should be able to add the plugin like this:

plugins: {
'/js/timeslidertooltipplugin.uncompressed.js': {}
}

but when the plugin script calls registerPlugin, jwplayer logs:

A plugin (timeslidertooltipplugin) was registered with the player that was not loaded. Please check your configuration.

Reply

OK jwplayer().registerPlugin(NAME, template) needs to match the file NAME. So in my case:

jwplayer().registerPlugin('timeslidertooltipplugin.uncompressed', template);
Reply

@Jim, @Rob -

As Rob discovered, the name of the plugin JS file must match the plugin name in the call to registerPlugin().

Post new comment

  • Allowed HTML tags: <code> <blockquote> <em> <strong> <strike> <ul> <li> <ol>
  • You may post code using <code>...</code> .
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options