我試圖創建一個嵌入式視頻播放器,但由於某種原因,它沒有將視頻連接到播放,暫停,停止或靜音按鈕。該頁面正在加載並立即播放該視頻,但它不響應播放,暫停或停止或靜音。它現在正在調用視頻,但沒有迴應。請幫忙!!AS3嵌入式視頻播放器
var video:Video=new Video(480,204);
video.y=stage.stageHeight/2-204/2;
video.x=stage.stageWidth/2-480/2;
addChild(this.video123);
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS, onStatusEvent);
function onStatusEvent(stat:Object):void {
trace(stat.info.code);
}
var meta:Object = new Object();
meta.onMetaData = function(meta:Object){
trace(meta.duration);
};
ns.client=meta;
this.video123.attachNetStream(ns);
this.play1.addEventListener(MouseEvent.CLICK, playFunction);
function playFunction(evt:MouseEvent):void {
ns.play("this.video123");
}
this.stop1.addEventListener(MouseEvent.CLICK, stopFunction);
function stopFunction(evt:MouseEvent):void {
ns.pause();
}
this.pause1.addEventListener(MouseEvent.CLICK, pauseFunction);
function pauseFunction(evt:MouseEvent):void {
trace(ns.time);
ns.togglePause();
}
this.soundButtonUp.addEventListener(MouseEvent.CLICK, muteFunction);
function muteFunction(evt:MouseEvent):void {
trace(ns.time);
var transform:SoundTransform=ns.soundTransform;
trace("video volume="+ns.soundTransform.volume);
if (ns.soundTransform.volume!=0) {
transform.volume=0;
trace(transform.volume);
ns.soundTransform=transform;
trace("video volume="+ns.soundTransform.volume);
this.soundButtonUp.text="Audio Mute";
} else {
transform.volume=1;
trace(transform.volume);
ns.soundTransform=transform;
trace("video volume="+ns.soundTransform.volume);
this.soundButtonUp.text="";
}
}
removeChild(this.video123);