Hi,
I’m trying to build a web application that could start and stop recording from a Wowza stream through the REST API that wowza provides. First, I can retrieve the list of instances that are currently recording
% curl http://192.168.1.126:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/streamrecorders
<?xml version="1.0" encoding="UTF-8" ?>
<StreamRecorders restURI="http://192.168.1.126:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/streamrecorders">
<InstanceName></InstanceName>
<streamRecorders restURI="/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances//streamrecorders/m.stream">
<RecorderName>m.stream</RecorderName>
<InstanceName></InstanceName>
<RecorderState>Recording in Progress</RecorderState>
<DefaultRecorder>false</DefaultRecorder>
<SegmentationType>None</SegmentationType>
<OutputPath>C:\Program Files (x86)\Wowza Media Systems\Wowza Streaming Engine 4.1.2\content</OutputPath>
<BaseFile>2m.stream.mp4</BaseFile>
<FileFormat>MP4</FileFormat>
<FileVersionDelegate>com.wowza.wms.livestreamrecord.manager.StreamRecorderFileVersionDelegate</FileVersionDelegate>
<FileTemplate>${SourceStreamName}_${RecordingStartTime}_${SegmentNumber}</FileTemplate>
<SegmentDuration>832632</SegmentDuration>
<SegmentSize>10485760</SegmentSize>
<SegmentSchedule>0 1 * * * *</SegmentSchedule>
<RecordData>false</RecordData>
<StartOnKeyFrame>true</StartOnKeyFrame>
<Option>Overwrite existing file</Option>
<MoveFirstVideoFrameToZero>true</MoveFirstVideoFrameToZero>
<CurrentSize>291399785</CurrentSize>
<CurrentDuration>832632</CurrentDuration>
<CurrentFile>C:\Program Files (x86)\Wowza Media Systems\Wowza Streaming Engine 4.1.2\content\2m.stream.mp4</CurrentFile>
<RecordingStartTime>2015-07-03-10.00.50.491-EDT</RecordingStartTime>
</streamRecorders>
</StreamRecorders>%
Now, I am trying to start and stop new recording with the API. Starting a recording does not work:
curl -X POST http://admin:admin@192.168.1.126:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/streamrecorders
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<error>
<wowzaServer>4.2.0</wowzaServer>
<code>500</code>
<message>The server encountered an unexpected condition which prevented it from fulfilling the request</message>
</error>
Neither does Stop recording:
curl -X PUT http://admin:admin@192.168.1.126:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/streamrecorders/m.stream/actions/stopRecording
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<error>
<wowzaServer>4.2.0</wowzaServer>
<code>500</code>
<message>The server encountered an unexpected condition which prevented it from fulfilling the request</message>
</error>
This seems to happen because of a Null exception:
class com.wowza.wms.rest.vhosts.applications.instances.streamrecorders.StreamRecorderConfig.post : java.lang.NullPointerException
|at com.wowza.wms.rest.ConfigBase.getObject(Unknown Source)
|at com.wowza.wms.rest.ConfigBase.post(Unknown Source)
|at com.wowza.wms.rest.ConfigBase.post(Unknown Source)
|at org.restlet.resource.ServerResource.doHandle(ServerResource.java:454)
|at org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:683)|
Even though the path says otherwise, the version of Wowza I’m trying this on is Engine Version 4.2.0 (build 15089)