Build an http provider that lists recordings

Below is a simple mechanism that will allow you to open up external scripts to seeing what recordings you have in progress. The core of this code is as follows:

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

for(String key : recorders){
	IStreamRecorder recorder = recordingMap.get(key);
	String thisAppInstanceName = recorder.getAppInstance().getName();
	String thisAppName = recorder.getAppInstance().getApplication().getName();
        String appStr = thisAppName+"/"+thisAppInstanceName+"/"+key;
	WMSLoggerFactory.getLogger(getClass()).info(">> Recording in progress: "+appStr);
}

This lists all known recordings at the current time. To run the example, simply add the HTTP Provider:

<HTTPProvider>
<BaseClass>guru.thewowza.RecordedStreamsHTTPProvider</BaseClass>
<RequestFilters>recordings*</RequestFilters>
<AuthenticationMethod>none</AuthenticationMethod>
</HTTPProvider>

The result of this will display a json array of appname/appinstancename/streamname1,appname/appinstancename/streamname2 etc.

You can download/modify the example module here.


Comments are closed.