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

Cloud Player Library issue "jwplayer is not defined"


I have created a new player in dashboard and got a link for library like http://content.jwplatform.com/libraries/[PLAYERID].js
After I added this link as a script source to my page I get an error "jwplayer is not defined" in this library on setting the defaults line.
What should I do to make it work?

8 Community Answers

Todd

JW Player Support Agent  
0 rated :

I just checked all three players in your dashboard and the players loaded for me without any errors. Can you send a link to a test page where you are getting this error?

p...

User  
0 rated :

Unfortunately I cant provide a link, but it doesnt work even for simple page with only player script added.
http://i.imgur.com/IBHL02Y.png

Todd

JW Player Support Agent  
0 rated :

It looks like the browser is loading your cloud-hosted .js file, but it looks like the error is “jwplayer is not defined”

Can you send a screen shot of the code where you call jwplayer().setup() ?
Does your <div> tag exist in the DOM before you call it?

p...

User  
0 rated :

Found a solution for simple page, but in my project I have to add jwplayer library script dynamically in way like this
http://i.imgur.com/kem6lvZ.png
http://i.imgur.com/qfrjR1n.png
And I got this jwplayer not defined error.

p...

User  
0 rated :

And it is ok with DOM. I can't even call jwplayer cause it fails on library initialisation like on screenshot previously.

Todd

JW Player Support Agent  
0 rated :

I do not use jquery to instantiate our player on the page. What happens when you load the player directly at the top of the page in a <script> tag as documented in the Custom Embed section at http://support.jwplayer.com/customer/portal/articles/1406723-mp4-video-embed ?

p...

User  
0 rated :

It works fine for regular way of using the library. But when I add script dynamically this error happens. I've tried to use requirejs to add library. And it partially works. Error are still shown, but I got the jwplayer function after all and after I manually added default configuration as in script file, it works!

http://i.imgur.com/tyqJVkr.png

Todd

JW Player Support Agent  
0 rated :

Our engineers have the following note on https://developer.jwplayer.com/jw-player/docs/developer-guide/api/javascript_api_introduction/ about using our player on the same page as require.js:

JW Player is not currently supported within require js due to JW Player needing to use jwplayer namespace. To avoid issues when require and jwplayer.js are on the same page, load jwplayer.js before the require.js script is loaded.

This question has received the maximum number of answers.