Actionscript 3 在Flash AS3中嵌入YouTube视频时缺少操作栏
我使用AS3在Flash中嵌入了一段YouTube视频,但它没有显示YouTube栏(播放/暂停、全屏等)按钮 视频在点击时播放,它的右下角只有YouTube徽标,点击后会带你进入YouTube。代码如下:Actionscript 3 在Flash AS3中嵌入YouTube视频时缺少操作栏,actionscript-3,flash,youtube,Actionscript 3,Flash,Youtube,我使用AS3在Flash中嵌入了一段YouTube视频,但它没有显示YouTube栏(播放/暂停、全屏等)按钮 视频在点击时播放,它的右下角只有YouTube徽标,点击后会带你进入YouTube。代码如下: Security.allowDomain("www.youtube.com"); var videoPlayer:Object; var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListen
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);
}
在我把问题贴出来后,我找到了答案。很抱歉浪费了阅读者的时间: 我让它加载的是无铬播放器,而不是嵌入式播放器。以下是解决方案:
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