Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

loadVideoById() in YouTube's regular player (not chromeless)

I have a YouTube's player in the webpage. I need to change the video played by this player dynamicaly.

This is (relatively) easy using YouTube's chromeless player. It has method loadVideoById() which works perfectly. The problem is, that the chromeless player doesn't have any controls (play/pause, etc.). The regular YouTube player has all this, but it doesn't have the loadVideoById() method.

Is there any way to include the controls of regular player into chromeless player, or to implement loadVideoById() method in the regular player?

Thanks.

like image 787
Fczbkk Avatar asked Dec 16 '08 13:12

Fczbkk


People also ask

How do I allow play embedded Youtube videos on one page?

enablejsapi=1' to the end of the embed URL. Essentially this manager keeps track of the registered videos. If it detects that a registered video begins to play it will pause any other registered video that is currently playing.

What is YT player?

Youtube Player. YTPlayer helps you control all of your opened Youtube videos either using keyboard shortcuts or directly using its popup window. The player has audio controls + focus button which focus on a tab, skip button which skip the ad if any, and a button to show suggested youtube videos (exclamation mark icon).


2 Answers

You can not do that, cause the calls in the "regular youtube player" have the VideoID in the URL instead as a parameter:

  • Regular Video: http://www.youtube.com/v/VIDEO_ID&enablejsapi=1&playerapiid=ytplayer
  • Chromeless: http://www.youtube.com/apiplayer?enablejsapi=1

Instead of that you can easily create your own function that changes the Embbebed SWF, i mean, say that you are using swfobject for the "Regular Player", then using createSWF function you will be able to replace the previous video for the actual one dynamically.

Hope this help you.

like image 77
David Santamaria Avatar answered Oct 15 '22 07:10

David Santamaria


You can do this...

http://code.google.com/apis/ajax/playground/#change_the_playing_video

like image 3
austimus Avatar answered Oct 15 '22 05:10

austimus