0
我现在正在研究某个AS3应用程序。该代码是几乎从文档的AS3例如:YouTube AS3 API中的某些功能返回错误的值
// The player SWF file on www.youtube.com needs to communicate with your host
// SWF file. Your code must call Security.allowDomain() to allow this
// communication.
Security.allowDomain("www.youtube.com");
// This will hold the API player instance once it is initialized.;
var player: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
{
stage.addChild(loader);
loader.content.addEventListener("onReady", onPlayerReady);
}
function onPlayerReady(event:Event):void
{
// Event.data contains the event parameter, which is the Player API ID
trace("player ready:", Object(event).data);
// Once this event has been dispatched by the player, we can use
// cueVideoById, loadVideoById, cueVideoByUrl and loadVideoByUrl
// to load a particular YouTube video.
player = loader.content;
player.loadVideoById("nJ3MSCLBpaM");
// Set appropriate player dimensions for your application;
setPlayerSize();
stage.addEventListener(Event.RESIZE, updatePlayerSize);
}
function setPlayerSize():void
{
player.y = 0;
player.x = 0;
player.setSize(stage.stageWidth, stage.stageHeight);
}
function getVideoBytesTotal()
{
return player.getVideoBytesTotal();
}
function getVideoBytesLoaded()
{
return player.getVideoBytesLoaded();
}
function getVideoStartBytes()
{
return player.getVideoStartBytes();
}
出于某种原因,当我打电话的视频加载后的最后三个功能之一(虽然它是打)我得到的是0,来自所有人。这是为什么?
我正面临同样的问题! – gabitzish
我注意到它只发生在Firefox中。 Chrome运行良好。 – gabitzish
其实我在Chrome上运行,它不工作。 :O –