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

With JS API, how do I load videos uploaded on JWPlatform


Hi, how can i embed videos that are uploaded to JWPlatform with javascript API (playerInstance.setup)?
I know that there is a file property asking for a full URL, but I only have the video key. Putting the video key in file property didn't work. Can someone please help? Thanks.

12 Community Answers

Todd

JW Player Support Agent  
0 rated :

If you know the video’s media ID and the player ID, you can embed a video using the following Javascript:

<script type="text/javascript" src="http://content.jwplatform.com/players/[mediaID]-[playerID]"></script>

fernando.is.sanchez Company

User  
0 rated :

Hi thanks for the response. But I need to use the API because I need to manually trigger the pause/play/rewind features through the js api.

I don't think <script type="text/javascript" src="http://content.jwplatform.com/players/[mediaID]-[playerID]"></script> gives me the ability to manually trigger those events, or could I?

Todd

JW Player Support Agent  
0 rated :

Yes, you can add your Javascript API events in a <script> tag after that single-line embed code:

<script type="text/javascript" src="http://content.jwplatform.com/players/[mediaID]-[playerID]"></script><script> jwplayer().on('ready',function(){alert('Enjoy this video!');}) </script>

fernando.is.sanchez Company

User  
0 rated :

Okay thanks but what if there are multiple vids on same page? How would I reference which jwplayer?

Todd

JW Player Support Agent  
0 rated :

You would need to indicate the specific player instance:

jwplayer(‘both_[videoID][playerID]div’).on();

fernando.is.sanchez Company

User  
0 rated :

Ah nvm, I see you can specify by doing var player = jwplayer(0); thanks!

Todd

JW Player Support Agent  
0 rated :

You can do it that way, but those numbers might not always be the same. Pointing to the specific div ID is more exact.

fernando.is.sanchez Company

User  
0 rated :

Hm with this, do I lose ability to call .setup() ?

Todd

JW Player Support Agent  
0 rated :

No, but the .setup() call is already made for you in the initial http://content.jwplatform.com/players/[mediaID]-[playerID].js that loads

I just realized I forgot the .js in my first reply to you. The correct code for the single-line embeds should read:

<script type="text/javascript" src="http://content.jwplatform.com/players/[mediaID]-[playerID].js"></script>

fernando.is.sanchez Company

User  
0 rated :

Okay as long as I can perform configurations that setup() can do, I should be good. Is this the case?

fernando.is.sanchez Company

User  
0 rated :

Doh, I have run into a problem.

I need to load JWPlayer's hosted video files using playerInstance.setup({}). Is there any way to do so given that I have the necessary videoid and playerid?

If that's not possible, then using <script type="text/javascript" src="http://content.jwplatform.com/players/[mediaID]-[playerID]"></script>
, I'd need to get the DIV ID of the video player. Is this possible?

Please let me know, thanks!

fernando.is.sanchez Company

User  
0 rated :

okay never mind i got it!

This question has received the maximum number of answers.