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

Multiple players with YouTube embeds on a single page do not initialize


Having multiple JW Players with YouTube embedded videos on a single webpage does not seem to initialize all videos well. The first player works, but all next players only initialize the JW Player skin and not the YouTube video.

While debugging the JW Player source I triggered this exception:

// There was an error calling back an event handler for "ready". Error: Cannot read property 'loaded' of undefined

I think what happens is:
- The first player triggers embedding the YouTube iframe_api and waits for it to load before initializing the video
- Next players don't wait for the iframe_api (window.YT and window.YT.loaded) to be loaded

I have tested this with JW Player 7.0.1 and the latest versions of Chrome, Canary, Firefox and IE11:
http://wim.latour.nl/jwplayer/jwplayer7-multiple-youtube.html

What solves this issue (for now) is loading the YouTube iframe_api myself and initialize the JW Players in the `onYouTubeIframeAPIReady()` callback:
http://wim.latour.nl/jwplayer/jwplayer7-multiple-youtube-with-iframe_api.html

2 Community Answers

alecosnet

User  
0 rated :

I have the same issue, with JWP 6 there wasn't problems but since I used JWP 7 I cannot play multiple video on the same web page. I use normally this setup:

<div class="otvideo" style="float: left; margin: 5px 5px 5px 5px"><div id="container_632014105225263">&nbsp;</div><script language="javascript" type="text/javascript">jwplayer("container_632014105225263").setup({file: "https://www.youtube-nocookie.com/v/DDxbgBYCc4k?rel=0", type: 'youtube', height: 315, width: 560, primary: 'flash'});</script><noscript><span class="no-plugin">&nbsp;</span></noscript></div>

On the same page I have other player instances... If I open a single player works but if the video are all on the same page works only the first video, all the rest video remain in waiting status... this issue happens only with JWP 7.0.0 on my download page there is no chance to download the version 7.0.1 of JWP. Please fix asap.

PS: JWP7 has also cosmetic issue using the skin built-in... I use always the built-in skin since every time important changes to JWP make unusable the skins. I decided to use the standard skin.

Alessandro

Thanks.

Jessenia

JW Player Support Agent  
0 rated :

This looks like a duplicate question. I’ve added an update at http://support.jwplayer.com/customer/portal/questions/13085924-multiple-players-with-youtube-embeds-on-a-single-page-do-not-initialize and will be closing this thread.

This question has received the maximum number of answers.