Thursday, January 19, 2012

[YouTube-API] iframe API multiple instances of player breaking events

So we have a FB app that has been working perfectly for the last month
or so and just over the last few days has started to display some very
odd behavior. Currently we have a div named "videoFrame" which we
pass to a new instance of the player like so:

BS.vidPlayer = new YT.Player ('videoFrame',
{
height: '295',
width: '493',
videoId : '6NjDDFIV7Z8',
events:
{
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange,
'onError' : onPlayerError
}
});

What we are doing is each time you click on a video link it will run
the same bit of code (above) but pass in a different "videoId". Up
until recently this was working perfectly essentially swapping out the
previous iframe with the new one.. However, now the second (or next)
time you instantiate the player it breaks and none of the events will
fire.

If anyone could point me in the right direction to a solution I would
be very grateful.

Thank you!

--
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.

No comments:

Post a Comment