0

I have the following code, got from a totorial online, but have problems getting the stream to play in the flash player.

Code:

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;
}

I have tried: Flex/Flash Shoutcast player How to stream a shoutcast radio broadcast in Flash (Shoutcast Flash Player)

I am using the latest Flash Builder with AS3.

Can someone please show me the right way to get audio playing.

Thanks

Community
  • 1
  • 1

2 Answers2

1

this is about wrong variable; you declared as sndTranse but you used sndTrans in your function.

0

Put a semicolon at the end of your URL.

var loadSnd:URLRequest = new URLRequest("http://s7.voscast.com:7174/;");

SHOUTcast servers will return an admin panel if they detect "Mozilla" in your User-Agent. This gets around the problem.

Found this on another forum.

code
  • 1,041
  • 1
  • 12
  • 28