Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

JWPlayer and RequireJS


I'm trying to integrate JWPlayer with the rest of my site's Javascript using RequireJS, but I'm encountering some problems.

First, it appears that the scrub-bar styling is very different; when I launch JWPlayer using a snippet of in-page code -- the three <script> tag approach, one for the player, one to set the key and another to instantiate the JWPlayer object -- I get an all-dark-grey control-bar with light grey highlights. When I comment that out and switch to using JWPlayer as a required dependency within my RequireJS application module, I get an all-white control-bar with black highlights.

The functionality appears to be the same, but I'm trying very hard to preserve my site's existing styling, so I'd prefer to fix it.

Second, RequireJS is an extremely common and widely-used library for managing dependencies. It would be helpful if your documentation included a brief discussion of its use with JWPlayer, especially with regard to any gotchas that exist when trying to use JWPlayer, e.g. is there some particular approach to deploying the key or instantiating the player that is recommended, does its use interfere with other libraries, etc. I'm pretty savvy with RequireJS but have encountered some significant frustration getting JWPlayer to exhibit the same sterling operation within an AMD setup compared to the immediate-execution model described in your documentation.

Any insight would be greatly appreciated.

5 Community Answers

Ethan Feldman

JW Player Support Agent  
0 rated :

Do you have a link to where you tried this?

Justin_Goltermann

User  
0 rated :

Where I'm trying this out is behind a secure login; let me see if I can't set up a version of my page outside the secure zone. I'll post back as soon as I can.

Ethan Feldman

JW Player Support Agent  
0 rated :

Ok.

Justin_Goltermann

User  
0 rated :

Ach, I figured out the source of the problem; our site has a few versions of the JWPlayer kicking around in our filesystem; I was referencing one that doesn't use the "Six" skin by default. It was a cinch at that point to point RequireJS at the correct version and get the desired end-result.

Back to my query about the API key: in my application module I've set up a function (initJWPlayer) that fires off the jwplayer.setup call. Just before this I set up the following two lines:

window.jwplayer = window.jwplayer || {};
window.jwplayer.key = '<MY_JWPLAYER_KEY>';

As should be evident, I'm trying to make sure my key is set up correctly. I figured this is probably the safest way to approach this, but can you confirm this is correct and/or the best practice?

Thanks again for any insight you can offer. & I didn't mention before, but JWPlayer kicks butt.

Ethan Feldman

JW Player Support Agent  
0 rated :

That should work, for setting the key. Glad you got things figured out.

This question has received the maximum number of answers.