Flash RTMP streaming with no filename - How to connect?
Hello good people of SO. I am building a flash media player for an live audio stream. The server is set up to stream from a url that looks lik开发者_开发百科e so:
rtmp://ourwowzaserver.net:80/ourfiledirectory
the instructions i have found say to first set the directory:
nc.connect("rtmp://ourwowzaserver.net:80/ourfiledirectory");
and then later play it:
nc.play(mp3:thefilename)
this works when we have discrete filenames on the server (thefilename), but the live stream is not a file - rtmp://ourwowzaserver.net:80/shoutcast
. How in the heck do I get .play to play it?
Thanks in advance!
You will need to create a live stream on your server first.
When you have created the stream, you can play it by calling:
(nc is your NetConnection object)
NetStream liveStream = new NetStream(nc);
liveStream.play("streamName");
Hope this helped.
Use the root directory ie just the bare url and use shoutcast for the stream identifier
Then there's a bit of a trick to this.
You need to first create a net connection...
var myNC:NetConnection = new NetConnection();
myNC.connect("rtmp://ourwowzaserver.net:80");
...then WAIT You can't setup a NetStream until the NetConnection connect succeeds
on success you can then create a netstream
var myNS:NetStream = new NetStream(myNC);
myNS.play("shoutcast");
精彩评论