I have an IStreamRecorderActionNotify implementation:
class StreamRecorderListener implements IStreamRecorderActionNotify
{
IApplicationInstance appInstance;
StreamRecorderListener(IApplicationInstance appInstance) {
this.appInstance = appInstance;
}
@Override
public void onCreateRecorder(IStreamRecorder recorder)
{
WMSLoggerFactory.getLogger(StreamRecorderListener.class).info("MyStreamRecorderListener.onCreateRecorder[" + appInstance.getContextStr() + "]: new Recording created:" + recorder.getStreamName());
}
@Override
public void onStartRecorder(IStreamRecorder recorder)
{
// log where the recording is going to being written
WMSLoggerFactory.getLogger(StreamRecorderListener.class).info("MyStreamRecorderListener.onStartRecorder[" + appInstance.getContextStr() + "]: new Recording started:" + recorder.getStreamName() + " " + recorder.getFilePath());
}
After running this code:
public void triggerRecording(String channel){
try{
if(!isRecording){
getLogger().info("Starting record");
StreamRecorderParameters recordParams = setRecordParams();
vhost.getLiveStreamRecordManager().startRecording(appInstance, channel, recordParams);
isRecording = true;
}
}catch(Exception e){
getLogger().error(e);
}
}
I get this in the logs:
MyStreamRecorderListener.onCreateRecorder[live/_definst_]: new Recording created:cumin
triggered by StreamRecorderListener.java onCreateRecorder.
I would expect that onStartRecorder gets called as well, but this function is never hit. Am I missing something?
These are how I set my record params:
private StreamRecorderParameters setRecordParams(){
StreamRecorderParameters recordParams = new StreamRecorderParameters(appInstance);
recordParams.segmentationType = IStreamRecorderConstants.SEGMENT_NONE;
recordParams.versioningOption = IStreamRecorderConstants.OVERWRITE_FILE;
recordParams.fileFormat = IStreamRecorderConstants.FORMAT_MP4;
recordParams.startOnKeyFrame = true;
recordParams.recordData = true;
recordParams.fileVersionDelegate = new FileVersionDelegate();
recordParams.notifyListener = new StreamRecorderListener(appInstance);
return recordParams;
}