Stream Recording on Server with iOS and Android

QUESTION:

Is it possible to record the stream?

Is it possible to give a subscriber access to the unique stream?

Is it possible to give a subscriber access to the recorded stream after the live event VIA that same unique Stream?

 

ANSWER:

Yes - you can do this.

In the R5Stream.publish method you have the ability to record the stream, you can give access to the live stream by giving the subscriber access to the unique stream id, and you can give a subscriber access to the recorded stream after the live event via that same unique stream id.


Streaming Example:

1 - Start Publishing

The R5Stream.publish method will establish the server connection and begin publishing. You will need to set the type parameter to R5RecordTypeRecord on the R5Stream.publish method.

 

iOS (Objective C):
[self.publish publish:[self getStreamName:PUBLISH] type:R5RecordTypeRecord];
 
iOS (Swift):
self.publish.publish(self.getStreamName(PUBLISH), type: R5RecordTypeRecord)
 
Android:
stream.publish(Publish.config.name, R5Stream.RecordType.Record);

This will then save the video as an FLV in the applications “streams” directory. You can then manipulate it with FFMPEG to convert to different formats, and/or combine the streams post recording.

Note: The iOS code samples were modified from the example apps found on our [Gitub](https://github.com/red5pro) for clarity.  If you are using one of the Red5 Pro example apps you will need to change

self.stream

to

self.publish

2 - The type parameter tells the server the recording mode to use on the server.

  • R5RecordTypeLive - Stream but do not record
  • R5RecordTypeRecord - Stream and record the file name. Replace existing save.
  • R5RecordTypeAppend - Stream and append the recording to any existing save.

 

3 - Finding your Files

This is an example of how it could potentially look on your web browser and on your file system.

On the Web Browser:

You'll need to make sure you're using the correct IP address to locate your streams.

http://123.456.7.8:5080/live/streams/

On the File Systems:

your server directory/webapps/live/streams/

These might need a bit of modifying depending on the directory you're saving things in. But this should be generally where you'd find your recorded files.

If you need additional help with converting these saved files to MP4, please see this blog post.

For additional information on setting up VOD functionality, please see our blog
 
 
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.