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?

Answers


I think you need to subscribe the eventlistener first.

You could try

ytplayer.addEventListener("**onPlayerReady**", "onYouTubePlayerReady");

Be sure the onPLayerReady is the correct event name, i'm just guessing here.


This line:

ytplayer = loadVideoById('Ahg6qcgoay4', 0,'medium');

Should be this:

ytplayer.loadVideoById('Ahg6qcgoay4', 0,'medium');

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", ...

Need Your Help

VB - Convert Web Site to Web Application

vb.net

This is my first time doing VB :-) I've inherited a web site, which I've converted into a web application in VS2008. The conversion has worked for everything except a Gallery control.

Get Activity name dynamically - android

android android-activity introspection

I'd like to get the name of the current Activity to be sent along in the URI of an HttpRequest. Is there a way to do this without referring specifically to the Activity?