Loading a YouTube video using the API
This is killing me. I have a fiddle here with my code. Nothing fancy, just trying to load a YouTube video.
Am I doing something stupid?
I think you need to subscribe the eventlistener first.
You could try
Be sure the onPLayerReady is the correct event name, i'm just guessing here.
ytplayer = loadVideoById('Ahg6qcgoay4', 0,'medium');
Should be this:
loadVideoById is a method of the player. You should have seen a "loadVideoById is not defined" error when you tried to run this.
A simpler way to get it working is to include the video id in the url you are loading:
var videoID = 'Ahg6qcgoay4'; swfobject.embedSWF("http://www.youtube.com/v/" + videoID + "?version=3&enablejsapi=1&playerapiid=player1", ...