I'm not sure if you're having the same problem as I did on cueyoutube.com
but I thought I'd post my solution here just in case:
Previously I had in my HTML:
<div id="result"></div>
Then the code to create the player:
player = new YT.Player('result', {
height: '390',
width: '480',
videoId: current_track.attr("id"),
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
where 'result' would get an iframe *appended*.
After the updates to iframe insert described here:
I found that I could play the *first* video, but then subsequently if I
clicked play the onReady handler would never fire again, likewise the
video would not change automatically at the end of playing.
In order to get it to work, I changed my HTML to this:
<div id="resultContainer">
<div id="result"></div>
</div>
and then I added two lines (shown here in jQuery) to remove the iframe and
replace it with an empty div again before creating the new player:
$('#resultContainer').empty();
$('#resultContainer').html('<div id="result"></div>');
Now I'm in cueyoutube.com bliss once more :)
HTH,
Iain
On Thu, 19 Jan 2012, Teddy Caddy wrote:
> Try this: function ytplayer_statechange( state )
> {
> if ( state.data == 0) // check state.data value
> {
> ytplayer_playitem += 1;
> ytplayer_playitem %= ytplayer_playlist.length;
> ytplayer_playlazy( 50 );
> }
> }
>
>
> --
> You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/youtube-api-gdata/-/QQpVW02vRLcJ.
> 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.
>
>
--
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