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 –