我已使用AS3在我的Flash中嵌入了YouTube视频,但它没有显示youtube栏(播放/暂停,全屏等)按钮。
点击后播放视频,右下角只有YouTube徽标 - 点击后会转到youtube。这是代码:
Security.allowDomain("www.youtube.com");
var videoPlayer:Object;
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);
loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3"));
function onLoaderInit(event:Event):void {
addChild(loader);
loader.content.addEventListener("onReady", onPlayerReady);
}
function onPlayerReady(event:Event):void {
trace("Ready");
videoPlayer = loader.content;
videoPlayer.setSize(214, 142);
videoPlayer.cueVideoByUrl("www.youtube.com/embed/VIDEO HERE", 0);
}
答案 0 :(得分:0)
我发布问题后,我找到了答案。很抱歉浪费时间阅读它的人:
我装载了无边框播放器而不是嵌入式播放器。这是解决方案:
Loading the chromeless player
If your application is using a chromeless player, use the following URL to load the player in your application:
http://www.youtube.com/apiplayer?version=3
Loading the embedded player
Use the following URL to load an embedded video player. In the URL, replace the string VIDEO_ID with the 11-character YouTube video ID that identifies the video that the player will show.
http://www.youtube.com/v/VIDEO_ID?version=3