0
我有幾個流媒體視頻。我從video_1.flv
開始,在完成之後,video_2.flv
正在運行並循環播放,直到用戶採取某些操作播放其他電影,例如video_3.flv
。所以我需要當video_2.flv
在後臺播放音頻文件sound.mp3
女巫將打圈,女巫我設法做到。但我需要他們兩個獨立運行。因爲現在當視頻循環播放時,音頻正在循環播放。只有當播放video_2.flv
時,我才需要音頻爲playd。謝謝。流媒體音頻和視頻AS3
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
loader.vid.Video_1.attachNetStream(ns);
var listener:Object = new Object();
listener.onMetaData = function(evt:Object):void {};
ns.client = listener;
ns.play("http://media.easyads.bg/ads/display_ads_richmedia/video/avon/maria_ilieva/video_1.flv");
ns.addEventListener(NetStatusEvent.NET_STATUS, NCListener);
var clipTimer:Timer = new Timer(4000);
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");
sound.load(req);
shaker(null);
}
};
var sound:Sound = new Sound();
var soundChannel:SoundChannel;
var req:URLRequest = new URLRequest("sound.mp3");
sound.addEventListener(Event.COMPLETE, onSoundLoadComplete);
function onSoundLoadComplete(e:Event):void{
sound.removeEventListener(Event.COMPLETE, onSoundLoadComplete);
soundChannel = sound.play();
soundChannel.addEventListener(Event.SOUND_COMPLETE, onSoundChannelSoundComplete);
}
function onSoundChannelSoundComplete(e:Event):void{
e.currentTarget.removeEventListener(Event.SOUND_COMPLETE, onSoundChannelSoundComplete);
soundChannel = sound.play();
}
loader.button_01.addEventListener(MouseEvent.CLICK, play_video_01);
loader.button_01.addEventListener(MouseEvent.ROLL_OVER, play_effect_01);
function play_video_01 (event:MouseEvent){
clipTimer.stop();
ns.play("http://media.easyads.bg/ads/display_ads_richmedia/video/avon/maria_ilieva/video_3.flv");
loader.button_01_mc.gotoAndPlay (41);
}
雖然此鏈接可以回答這個問題,最好是在這裏有答案的主要部件,並提供鏈接,再ference。如果鏈接頁面更改,則僅鏈接答案可能會失效。 – Joel 2014-02-12 14:49:28
好點,但你知道的時間...: - /會試圖按照你的想法。 – 2014-02-12 15:11:52