Html – Youtube HTML5 Video Player Fallback with Player API (v2)

htmlhtml5-videovideoyoutubeyoutube-javascript-api

I'm trying to use the youtube javascript player api to embed youtube videos into my site and control them via clickable thumbnails / javascript. I thought that the youtube player would fall back to html5 videos, but it doesn't. Is there a way to set this up? Here's the code (just using swfobject to embed the video per youtube's instructions):

var vidString = "http://www.youtube.com/v/" + vidID + "?enablejsapi=1&playerapiid=video_player&version=3";
        swfobject.embedSWF(vidString,"video_player", "768", "432", "8", null, null, params, atts);

Best Answer

Ah - this was a bit hidden away, but I was using the wrong API. Apparently the HTML5 fallback feature only works with the iframe API, documented here:

http://code.google.com/apis/youtube/iframe_api_reference.html#Loading_a_Video_Player

Switched to this and it worked pretty well.