Wowza Community

How to get the recording status of a stream when using liveStreamRecord

I’ve been trying to get the status of a stream if it’s being recorded but can’t with the isRecord() method on the stream object on the server side. Is there another way to get the status of a stream if it’s being recorded? For example, if you use the admin 8086 ported “livestreamrecord” page then you can see the streams that are in there and if they are being recorded or not. How would I retrieve that value?

Hello there.

You can grab a reference to your IStreamRecorder objects and check them as follows:

Map<String, IStreamRecorder> recordingMap = vhost.getLiveStreamRecordManager().getRecordersMap(appInstance);

Then you could iterate through the recorders and check the recorder.getRecorderState() as follows:

int recordState = recorder.getRecorderState();
if(recordState == IStreamRecorderConstants.RECORDER_STATE_RECORDING){
  // do something
}
//etc..

I hope this answers your question.

Kind regards,

Salvadore

Thanks Salvadore. How would I check on particular streams? It looks like I have to iterate over every single application instance on the server, collect all the recorders, then look inside that map? Does the map hold information on the stream name? If so, how would I retrieve that?

You can add this code to an Application module, and then iterate through only the streams published to that application.

You might do something like this:

if (recorder.getStreamName().equals("mySpeciaStream")) {
// doSomthing
}

Kind regards,

Salvadore