我有以下代码,来自在线教程,但在 Flash 播放器中播放流时遇到问题。
代码:
import flash.net.URLRequest;
import flash.media.Sound;
import flash.ui.Mouse;
import flash.media.SoundChannel;
var loadSnd:URLRequest = new URLRequest("http://s7.voscast.com:7174/");
var thisSnd:Sound = new Sound();
//////////////////////////////////////////////// Stop Button
var sndTranse:SoundChannel = new SoundChannel();
thisSnd.load(loadSnd);
play_Btn.addEventListener(MouseEvent.CLICK,playF);
stop_Btn.addEventListener(MouseEvent.CLICK,stopF);
stop_Btn.visible = false;
function playF(event:MouseEvent):void{
SoundMixer.stopAll();
sndTrans = thisSnd.play();
play_Btn.visible = false;
stop_Btn.visible = true;
}
function stopF(event:MouseEvent):void{
//SoundMixer.stopAll();
sndTrans.stop();
play_Btn.visible = true;
stop_Btn.visible = false;
}
我尝试过: Flex/Flash Shoutcast 播放器 如何在 Flash 中流式传输广播电台广播(Shoutcast Flash Player)
我正在使用最新的带有 AS3 的 Flash Builder。
有人可以告诉我播放音频的正确方法吗?
谢谢