Manduro
Manduro

Reputation: 843

Multiple iframe embeds using Youtube Player API

The situation:

All this is working like it should. But then, after the video is removed, it doesn't load up a second iframe anymore. Maybe something needs to be reset before it can load a new video (some javascript object, event listeners, etc)? What can I try?

Upvotes: 3

Views: 4529

Answers (1)

Manduro
Manduro

Reputation: 843

Solved it! Only with the first video the onYouTubeIframeAPIReady function is called by the youtube API, because after that the IframeAPI remains ready.

So, if you want the first video to run, you have to use new YT.Player() in the onYouTubeIframeAPIReady function. With the second and beyond you can immediately use new YT.Player().

Upvotes: 3

Related Questions