Youtube HTML5视频播放器后备与播放器API(v2) [英] Youtube HTML5 Video Player Fallback with Player API (v2)
问题描述
我正在尝试使用youtube javascript播放器api将youtube视频嵌入到我的网站中,并通过可点击的缩略图/ javascript控制它们。我认为youtube播放器会回归到html5视频,但事实并非如此。有没有办法设置它?这是代码(只需使用swfobject按照youtube的说明嵌入视频):
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);
推荐答案
啊 - 这有点隐藏,但我使用了错误的API。显然,HTML5后备功能仅适用于此处记录的iframe API:
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.
这篇关于Youtube HTML5视频播放器后备与播放器API(v2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!