Reputation: 10119
am building a radio player in flash, and I need to get all the BBC Radio Stations working in the player.
I am trying to use their AAC Streams, I have a bit of ActionScript 3 code for reading AAC Streams, but this just doesnt seem to work with BBC Radio Streams. The error message I get is:
NetStream.Play.StreamNotFound
but the very same stream works fine in WinAmp.
This is a sample AAC Stream I am trying to play (BBC Radio 3):
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_lc1_radio3_q?s=1334749463&e=1334763863&h=3bc870c82d1e1f360d8cfc1d296d97c2
This is the AS3 Class I am using to play streams:
package play {
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.events.NetStatusEvent;
import flash.events.AsyncErrorEvent;
public class aacplay {
private var netConn:NetConnection=new NetConnection();
private var netStrm:NetStream;
private var urlStr:String;
public function aacplay(radiourl) {
urlStr=radiourl;
connect();
}
private function connect():void{
netConn.close();
netConn=new NetConnection();
netConn.addEventListener(NetStatusEvent.NET_STATUS,netStatusHdlr);
netConn.addEventListener(AsyncErrorEvent.ASYNC_ERROR,asyncErrorHdlr);
netConn.connect(null);
}
private function netStatusHdlr(e:NetStatusEvent):void{
trace('netStatusHdlr:'+e.info.code);
switch(e.info.code){
case 'NetConnection.Connect.Success':
requestAudio();
break;
}
}
private function requestAudio():void{
if(netStrm!==null){
netStrm.close();
}
netStrm=new NetStream(netConn);
netStrm.addEventListener(NetStatusEvent.NET_STATUS,netStatusHdlr);
netStrm.addEventListener(AsyncErrorEvent.ASYNC_ERROR,asyncErrorHdlr);
netStrm.checkPolicyFile=false;
netStrm.play(urlStr);
}
private function asyncErrorHdlr(e:AsyncErrorEvent):void{
trace('asyncErrorHdlr:'+e);
}
}
}
And I am invoking the class with:
var aac:aacplay=new aacplay('http://bbcmedia.ic.llnwd.net/stream/bbcmedia_lc1_radio3_q?s=1334749463&e=1334763863&h=3bc870c82d1e1f360d8cfc1d296d97c2');
Can anyone tell me why I am unable to play the BBC Stream - is it a security issue? And if so, how do I get around this security issue?
Upvotes: 2
Views: 1976
Reputation: 41
using netConn.connect(null)
means that you will play local mp4 or flv file, or push data to the buffer manually utilize NetStream.appendBytes()
in this situation you need:
URLSocket
to your urlFLVTag
with AAC
data in it, from previous stepNetStream.appendBytes()
Upvotes: 1