Youtube HTML5 Video Player Fallback with Player API (v2)

蓝咒 提交于 2020-01-15 15:30:39

问题


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);

回答1:


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.



来源:https://stackoverflow.com/questions/9488201/youtube-html5-video-player-fallback-with-player-api-v2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!