If you’re just getting into Red5, and you are wondering what it’s capabilities are and how you could approach saving audio/video streams with Red5, then please read on.
Recently on the mailing list, a question on how to save streams to the server came up via a new Red5 user. The user was kind enough to explain that they hadn’t much knowledge on the subject and that they did their due diligence by searching the web for answers. Unfortunately, there is a lot of information on saving streams, but most of it is geared towards long winded examples and less on teaching the user what they need to do to get from A to B. Keeping this in mind, I gave the following answer which instead of providing an entire example, just gave him the tools and knowledge to get to their next step in the red5 evolutionary process. Soon, this user may be spreading the knowledge back by providing these same answers to other users or contributing to our wiki. My suggestion is as follows:
I would suggest that you take the following approach:
- download and install red5
- open up the home page screen (http://localhost:5080/)
- install some examples
- look for an example that does something you’re looking for.. probably oflaDemo in your case or the publisher application.
once you have this 50,000 foot view, you will can check out the example code and look at what API you will need.
In your case, you’re going to want to look into the following Clientside API:
- NetConnection
- NetStream
example:
// create the connection
var nc:NetConnection = new NetConnection();
nc.connect("rtmp://localhost/myApp");
// create the stream
var ns:NetStream = new NetStream(nc);
ns. publish("myStreamName", "record");
The result will be an FLV file named “myStreamName.flv” located in your webapp’s streams directory. This happens automagically on the server. Of course there are ways to monitor and prevent this automagical functionality, but it’s a good start.
Also, keep in mind that the code above just publishes… there are equivalent api calls to play a stream: e.g.:
ns.play(”myStreamName”);
Hope this helps…
Doesn’t get much easier than that
[...] Google, here’s a little example that should get your ass going (if you were too lazy to try this suggestion which you should do if you want to really learn [...]
Thanks! Hope this help as well
http://mariofalomir.com/blog/?p=101
Excellent thank you for saving me lots of time…