Hi,
I have an embedded youtube API player (example code) which is controlled via javascript. Everything works fine, but I have problems getting and setting the video quality.
Please have a look at the following piece of code:
ytplayer.loadVideoById("MXRa0DkBc2I", "0");
ytplayer.playVideo();
//alert("foo");
ytplayer.setPlaybackQuality("hd720");
alert("quality set to: "+ytplayer.getPlaybackQuality());
Loading and playing the video works fine, but the output is "quality set to: undefined". When I uncomment the third line, the output is "quality set to: hd720".
To show you the issue, I made a demo page. There you can see all the code (just view the source code) and get or set the quality via links. This works (while the video is playing), but if you click "next song" ( >| ), the function nextVideo() should not only load the next song and play it, but also set the quality to hd720. If you click "get quality", it shows up "medium", but after clicking "set quality to hd720", it shows up "hd720".
Does anybody know why the setPlaybackQuality() function does not work in this case? How can I make it change the quality without the alert()?
Thanks.