Thursday, April 19, 2012

[YouTube-API] Re: Play next video... like a playlist

Hello,

It's not clear to me whether you're pasting your code verbatim or
you're just using placeholders. If you're posting your code verbatim,
then

'playlist':'"l8MjTAXW7Fw",id2,id2'

is definitely not what you should be specifying. If that's not your
actual code, then it would be easiest if you could just link to a page
with your real code.

Cheers,
-Jeff Posnick, YouTube API Team
groups.google.com/group/youtube-api-gdata | apiblog.youtube.com |
@YouTubeDev


On Apr 19, 5:10 am, cheeeze <marcelisod...@gmail.com> wrote:
> The player doesn't recognised the nextId : like this:
>
> 'playlist':'"l8MjTAXW7Fw",id2,id2'
>
> OR
>
> 'playlist':'id2,id2,id2'
>
> He plays the first (id) :
>
> player = new YT.Player('player', {
>     height: '390',
>     width: '640',
>     videoId: id, // HERE OK !
>     playerVars: {
>        'playlist':'"l8MjTAXW7Fw",id2,id2'
>
>     },
>     events: {
>       'onReady': onPlayerReady,
>       'onStateChange': onPlayerStateChange
>     }
>   });
>
> So, I try to do: Load the first video and at the end ( event ENDED ) , load
> the next video (I got the id) .
>
> 1 . load player
>
> var player;
> function onYouTubePlayerAPIReady(id) {
>      console.log("onYoutubePlayerApiREady");
>      console.log(id);
>
>      id2= 'l8MjTAXW7Fw';
>
>  player = new YT.Player('player', {
>     height: '390',
>     width: '640',
>     videoId: id,
>     playerVars: {
>      'autoplay': 0,
>      'rel': 0,
>                                  'showinfo': 0,
>                                  'showsearch': 0,
>                                  'disablekb': 1
>
>     },
>     events: {
>       'onReady': onPlayerReady,
>       'onStateChange': onPlayerStateChange
>     }
>   });
>
> }
>
> 2. WHEN THE VIDEO STOPPED , Go the next()
>
> function onPlayerStateChange(event) {
>   if (event.data == YT.PlayerState.ENDED )
>   {
>        onYouTubePlayerAPIReady('l8MjTAXW7Fw'); // So , he go to the
> function onYouTubePlayerAPIReady : OK But don't relaod the player, why??
>
>   }
>
> }
>
> *In console, I've : *
> *
> *
> onYoutubePlayerApiREady
>
> l8MjTAXW7Fw
>
> onYoutubePlayerApiREady
>
> fTa3fj8O_M4 // It's the nextVideo, why the player doesn't load??!!!
>
> *Thank you so much for helping me :-) :-) :-) . *
> *Cheers, Cheeeze. *
>
> Le mercredi 18 avril 2012 11:03:05 UTC+2, cheeeze a écrit :
>
>
>
>
>
>
>
>
>
> > Hi !
>
> > I'm lost ! I hope you can help me.
>
> > I create a player with my first video (id1) and after playing I want to
> > launch the next video (idnext).
>
> > For the first, I do :
>
> > function onYouTubePlayerAPIReady(id) {
> >      var tag = document.createElement('script');
> >      tag.src = "http://www.youtube.com/player_api";
> >      var firstScriptTag = document.getElementsByTagName('script')[0];
> >      firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
>
> >      var player;
> >              player = new YT.Player('ytvideo2', {
> >     height: '390',
> >     width: '640',
> >     videoId: id,
> >     playerVars: { 'autoplay': 0, 'controls': 1 },
> >     events: {
> >       'onReady': onPlayerReady,
> >       'onStateChange': onPlayerStateChange
> >     }
> >   });
> > }
> >   function onPlayerStateChange(event) {
> >   if (event.data == YT.PlayerState.ENDED ) {
>
> > // When the first video is finish
> >   onYouTubePlayerAPIReady('l8MjTAXW7Fw'); // ===> This doesn't working
> >   }
> > }
>
> > How can I do that. I see on the web, "about playlist" , but How can I
> > create a playlist?? I'm really lost.
>
> > Thank you for your attention, I'm waiting for your response.
>
> > Cheeeze :-)

--
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