Hi,
I want to control the recorder of wowza server in the viewer using HTTP provider.
So implemented the ability to start recording, stop recording, and change file storage locations.
But couldn’t find a function in java api that modifies the set parameters for the recorder being recorded.
ex) setRecorderParams()…? setParams()…?
So I had to stop the recorder in the following way first and then set the parameter again and use the method to start it.
private void switchRecording(IVHost vhost, String streamName, long duration) {
// 1. Stop Existing Recorder
IStreamRecorder recorder = vhost.getLiveStreamRecordManager().getRecorder(this.appInstance, streamName);
recorder.stopRecorder();
// 2. Define new params
StreamRecorderParameters newRecordParams = new StreamRecorderParameters(this.appInstance);
newRecordParams.fileFormat = IStreamRecorderConstants.FORMAT_MP4;
newRecordParams.fileTemplate = "${SourceStreamName}_${SegmentTime}_${SegmentNumber}";
newRecordParams.outputPath = appInstance.getStreamStorageDir() + "/" + streamName;
File folder = new File(newRecordParams.outputPath);
if(!folder.exists()) {
WMSLoggerFactory.getLogger(CLASS).error(CLASSNAME + " Folder Not Found : " + newRecordParams.outputPath);
WMSLoggerFactory.getLogger(CLASS).error(CLASSNAME + " Make Dir : " + newRecordParams.outputPath);
folder.mkdir();
}
newRecordParams.segmentationType = IStreamRecorderConstants.SEGMENT_BY_DURATION;
newRecordParams.segmentDuration = duration;
// 3. New Recorder start
vhost.getLiveStreamRecordManager().startRecording(this.appInstance, streamName, newRecordParams);
}
But I believe there’s a better way. Is there an asynchronous way to change the parameters of the recorder that is being recorded continuously without interrupting the existing recorder?
Is there a function that implements the function I want? If so, which object or interface is defined?
I’d appreciate your help.