2

I am trying to build a flash player for my company's Shoutcast server, and have seen a few articles about it on the 'net, including this SO question here.

However, I can't seem to get the audio stream to actually play. It seems to be connecting alright, but calling stream.play() doesn't seem to do anything.

I have tried the code in the SO question I have linked to, and have also tried something similar to this (sorry i don't remember the exact syntax):

public function stream() {  
    private var url:URLREQUEST = "my.domain.com";
    private var sStream:Sound = new Sound();
    sStream.load(url);
    sStream.play();
}

If anyone has any revelations for me I'd appreciate it.

Community
  • 1
  • 1
  • 1
    I figured it out. When it is a stream, you just tack ';stream.mp3' onto the end of your URL. so: url:UrlRequst = "my.domain.com/;stream.mp3"; –  Nov 21 '09 at 14:59

2 Answers2

1

I just posted a solution on this thread:

How to stream a shoutcast radio broadcast in Flash (Shoutcast Flash Player)

Community
  • 1
  • 1
spender
  • 117,338
  • 33
  • 229
  • 351
  • you use sound.loadSound(,), which is AS2. that function does not exist in AS3. –  Nov 21 '09 at 14:58
  • ok, but the real gold is the semicolon (stream.mp3 is not necessary). looks like you got there in the end. – spender Nov 22 '09 at 02:42
0

Did you try this - (corrected some typos in the code you posted)?

public function stream() 
{  
    private var url:URLRequest = new URLRequest("my.domain.com/song.mp3");
    private var sStream:Sound = new Sound();
    sStream.load(url);
    sStream.play();
}
Amarghosh
  • 58,710
  • 11
  • 92
  • 121
  • well that is the rub...it is a stream, so there is no '.mp3' file. –  Nov 10 '09 at 12:57
  • and yes, that is what I tried (just didn't have the code in front of me and don't really write actionscript to often –  Nov 10 '09 at 12:58