Stream recording PHP query examples for the Wowza Streaming Engine REST API

Wowza Streaming Engine media server software includes a REST Application Programming Interface (API) that you can use to configure, manage, and monitor the media server through HTTP requests. This article describes how to create and control stream recordings in a Wowza Streaming Engine media server by using PHP to query the Wowza Streaming Engine REST service.

Notes:

Contents


Get a list of recorders
Create a recorder
Split a recording
Stop a recording
For developers

Get a list of recorders


To get a list of all defined stream recordings in your Wowza Streaming Engine instance, using the following request:
$sf = new Com\Wowza\Recording();
$response = $sf->getAll();

Create a recorder


The following example defines a stream recorder and starts the recorder for a stream named myStream:
$sf = new Com\Wowza\Recording();

$recordName= "myStream";
$instanceName= "_definst_";
$recorderState= "Waiting for stream";
$defaultRecorder= true;
$segmentationType= "None";
$outputPath= "/usr/local/WowzaStreamingEngine/content";
$baseFile= "testme.mp4";
$fileFormat= "MP4"; // or FLV
$fileVersionDelegateName= "com.wowza.wms.livestreamrecord.manager.StreamRecorderFileVersionDelegate";
$fileTemplate= "${BaseFileName}_${RecordingStartTime}_${SegmentNumber}";
$segmentDuration= "900000";
$segmentSize= "10485760";
$segmentSchedule= "";
$recordData= true;
$startOnKeyFrame= true;
$splitOnTcDiscontinuity= false;
$option= "Version existing file";
$moveFirstVideoFrameToZero= true;
$currentSize= 0;
$currentDuration= 0;
$recordingStartTime = "";

$response = $sf->create($recordName, $instanceName, $recorderState, $defaultRecorder,
					$segmentationType, $outputPath, $baseFile, $fileFormat, $fileVersionDelegateName, $fileTemplate,
					$segmentDuration, $segmentSize, $segmentSchedule, $recordData, $startOnKeyFrame, $splitOnTcDiscontinuity,
					$option, $moveFirstVideoFrameToZero, $currentSize, $currentDuration, $recordingStartTime);

Split a recording


To split a current recording, use the following request:
$sf = new Com\Wowza\Recording();
$response = $sf->split("myStream");

Stop a recording


To stop a current recording, use the following request:
$sf = new Com\Wowza\Recording();
$response = $sf->stop("myStream");

For developers


Source code is available on GitHub.

Wowza Media Systems™ provides developers with a platform to create streaming applications and solutions. See Wowza Developer Tools to learn more about our APIs and SDK.