2013-02-20 77 views
0

我有這個功能在流媒體視頻播放結束後循環播放其中的所有內容是否有一種方法可以僅循環播放流式視頻和shaker(null)沒有音頻?因爲音頻是l to的,但它的長度是比較大的。所以基本上我需要視頻和音頻獨立循環播放。分別循環播放音頻和視頻AS3

function NCListener(e:NetStatusEvent){ 

    if (e.info.code == "NetStream.Play.Stop") { 

     ns.play("http://media.easyads.bg/ads/display_ads_richmedia/video/avon/maria_ilieva/video_2.flv"); 
     soundChannel = sound.play(0, 9999); 
     shaker(null); 
     } 
    }; 


var sound:Sound = new Sound(); 
var soundChannel:SoundChannel= new SoundChannel(); 
sound.load(new URLRequest("sound.mp3")); 
sound.addEventListener(Event.COMPLETE, onSoundLoadComplete ); 

function onSoundLoadComplete(e:Event):void{ 
    sound.removeEventListener(Event.COMPLETE, onSoundLoadComplete); 

    soundChannel.addEventListener(Event.SOUND_COMPLETE, onSoundChannelSoundComplete); 
} 

function onSoundChannelSoundComplete(e:Event):void{ 
    e.currentTarget.removeEventListener(Event.SOUND_COMPLETE, onSoundChannelSoundComplete); 
    soundChannel = sound.play(0, 9999); 
} 

回答

1

對於獨立的循環,你需要聽上的事件都將NetStream(將onPlayStatus)和的SoundChannel(度SoundComplete)。在事件處理程序中,您只需重新啓動已完成的介質。

它看起來像你的示例代碼只是聽NetStream。

+0

我正在這樣做。但是我需要播放視頻並開始播放音頻。但是因爲音頻的長度更大,我需要它們都是獨立的。 – Kircho 2013-02-20 16:31:58

+0

我不知道你爲什麼在NCListener中調用'sound.play()',然後呢? – 2013-02-20 16:49:10

+0

如果您有其他想法,我會很樂意看到它。 – Kircho 2013-02-20 17:17:20