wowza-js-api v1.0.0
Table of Contents
WowzaAPI
Extends Object
This class is JavaScript wrapper for cURL REST API for Wowza Streaming Engine server tested with NodeJS version 6.10.2 LTS
Parameters
optionsObject? possible to set stream parametres which will use as default for methodsoptions.wowzaAdressstring? IP address or domein name of Wowza Streaming Engine (optional, default'localhost')options.streamFilestring? name of a streamfile (optional, default'myStream.stream')options.applicationstring? name of an application (optional, default'application')options.appInstancestring? name of an application instance (optional, default'_definst_')options.mediaCasterTypestring? caster type (optional, default'rtp')
Examples
let Wowza = require('./wowza.js');
wowza = new Wowza({
wowzaAdress: '192.168.1.15', // default value is 'localhost'
streamFile: 'ipCamera.stream', // default is 'myStream.stream'
application: 'webrtc', // default is 'live'
appIstance: '_definst_', // default is '_definst_'
mediaCasterType: 'rtp' // default is 'rtp'
});
wowza.someWowzaMethod(); // now you can use the JS wowza API.getStreamFilesList
Get a list of streamfiles
Parameters
optionsObject?options.applicationstring? name of an application (default value can be another if it was passed to the class constructor) (optional, default'live')
Examples
wowza.getStreamFilesList({application: 'webrtc', streamFile: 'ipCamera'})
.then( responseMsg => console.log(responseMsg))
.catch( errorMsg => console.log(errorMsg));
// Wowza answer example:
//{serverName: '_defaultServer_', streamFiles: [{id: 'ipCamera2', href: '/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/webrtc/streamfiles/ipCamera2'}]}Returns Promise promise which resolve by object which contains array of streamFiles and it's confifurations
getStreamConfiguration
Get specific stream configuration
Parameters
optionsObject?options.applicationstring? name of an application (default value can be another if it was passed to the class constructor) (optional, default'live')options.streamFilestring? name of a streamfile (default value can be another if it was passed to the class constructor) (optional, default'myStream.stream')
Examples
wowza.getStreamConfiguration()
.then(response => console.log(response))
.catch(errorMsg => console.log(errorMsg));
// Wowza answer example:
// {version: '1488715914000', serverName: '_defaultServer_', uri: 'rtsp://admin:admin@192.168.42.231', name: 'ipCamera'}Returns Promise promise which resolve by stream configurations object
createRecorder
Create Recorder
Parameters
recorderParametresObjectrecorderParametres.restURIstringrecorderParametres.recorderNamestringrecorderParametres.instanceNamestringrecorderParametres.recorderStatestringrecorderParametres.defaultRecorderbooleanrecorderParametres.segmentationTypestringrecorderParametres.outputPathstring default value is [] and wowza should save files in install-dir/content, not testedrecorderParametres.baseFilestring default is [], and wowza should name file as a streamfile name, not testedrecorderParametres.fileFormatstringrecorderParametres.fileVersionDelegateNamestringrecorderParametres.fileTemplatestringrecorderParametres.segmentDurationnumberrecorderParametres.segmentSizenumberrecorderParametres.segmentSchedulestringrecorderParametres.recordDatabooleanrecorderParametres.startOnKeyFramebooleanrecorderParametres.splitOnTcDiscontinuitybooleanrecorderParametres.backBufferTimenumberrecorderParametres.optionstring should to work with one of: version | append | overwrite, but not testedrecorderParametres.moveFirstVideoFrameToZerobooleanrecorderParametres.currentSizenumberrecorderParametres.currentDurationnumberrecorderParametres.recordingStartTimestring
optionsObject?options.applicationstring? name of an application (default value can be another if it was passed to the class constructor) (optional, default'live')options.streamFilestring? name of a streamfile (default value can be another if it was passed to the class constructor) (optional, default'myStream.stream')options.appInstancestring? name of an instance (default value can be another if it was passed to the class constructor) (optional, default'_definst_')
Examples
wowza.createRecorder({
"restURI": "http://192.168.1.15:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/webrtc/instances/_definst_/streamrecorders/ipCamera.stream",
"recorderName": "ipCameraRecorder",
"instanceName": "_definst_",
"recorderState": "Waiting for stream",
"defaultRecorder": true,
"segmentationType": "None",
"outputPath": "", // default value is [] and wowza save files in [install-dir]/content, not tested
"baseFile": "myrecord2.mp4", // default is [], and wowza will name file as a streamfile name, not tested
"fileFormat": "MP4",
"fileVersionDelegateName": "com.wowza.wms.livestreamrecord.manager.StreamRecorderFileVersionDelegate",
"fileTemplate": "${BaseFileName}_${RecordingStartTime}_${SegmentNumber}",
"segmentDuration": 900000,
"segmentSize": 10485760,
"segmentSchedule": "0 * * * * *",
"recordData": true,
"startOnKeyFrame": true,
"splitOnTcDiscontinuity": false,
"backBufferTime": 3000,
"option": "Version existing file", //should to work with one of: version | append | overwrite, but not tested
"moveFirstVideoFrameToZero": true,
"currentSize": 0,
"currentDuration": 0,
"recordingStartTime": ""
},{
streamFile: 'ipCamera',
application: 'webrtc',
appIstance: '_definst_'
})
.then(response => console.log(response))
.catch(errorMsg => console.log(errorMsg));
// Wowza answer example:
//{ success: true, message: 'Recorder Created', data: null }Returns Promise promise which resolve when rec will start
stopRecording
Stop recording
Parameters
optionsObject?options.applicationstring? name of an application (default value can be another if it was passed to the class constructor) (optional, default'live')options.streamFilestring? name of a streamfile (default value can be another if it was passed to the class constructor) (optional, default'myStream.stream')options.appInstancestring? name of an instance (default value can be another if it was passed to the class constructor) (optional, default'_definst_')
Examples
wowza.stopRecording({
streamFile: 'ipCamera',
application: 'webrtc',
appIstance: '_definst_'
}).then(response => console.log(response)).catch(errorMsg => console.log(errorMsg));
// Wowza answer example:
// { success: true, message: 'Recording (ipCamera) stopped', data: null }Returns Promise promise which resolve when rec will stop
getRecordersList
Get a list of recorders
Parameters
optionsObject?options.applicationstring? name of an application (default value can be another if it was passed to the class constructor) (optional, default'live')options.appInstancestring? name of an instance (default value can be another if it was passed to the class constructor) (optional, default'_definst_')
Examples
wowza.getRecordersList({
application: 'webrtc',
appIstance: '_definst_'
}).then( response => console.log(response)).catch( errorMsg => console.log(errorMsg));
// Wowza answer example:
//{ serverName: '_defaultServer_',
// instanceName: '_definst_',
// streamrecorder:
// [ { recorderName: 'ipCamera',
// instanceName: '_definst_',
// recorderState: 'Waiting for stream',
// defaultRecorder: false,
// segmentationType: 'None',
// outputPath: '/usr/local/WowzaStreamingEngine/content/records',
// baseFile: 'myrecord2.mp4',
// fileFormat: 'MP4',
// fileVersionDelegateName: 'com.wowza.wms.livestreamrecord.manager.StreamRecorderFileVersionDelegate',
// fileTemplate: '${BaseFileName}_${RecordingStartTime}_${SegmentNumber}',
// segmentDuration: 900000,
// segmentSize: 10485760,
// segmentSchedule: '0 * * * * *',
// recordData: true,
// startOnKeyFrame: true,
// splitOnTcDiscontinuity: false,
// backBufferTime: 3000,
// option: 'Version existing file',
// moveFirstVideoFrameToZero: true,
// currentSize: 0,
// currentDuration: 0,
// recordingStartTime: '' } ] }Returns Promise promise which resolve by object contains recorders params array
connectStreamFile
Connect a existing streamfile
Parameters
optionsObject?options.applicationstring? name of an application (default value can be another if it was passed to the class constructor) (optional, default'live')options.streamFilestring? name of a streamfile (default value can be another if it was passed to the class constructor) (optional, default'myStream.stream')options.appInstancestring? name of an instance (default value can be another if it was passed to the class constructor) (optional, default'_definst_')options.mediaCasterTypestring? caster type (default value can be another if it was passed to the class constructor) (optional, default'rtp')
Examples
wowza.connectStreamFile({
streamFile: 'ipCamera',
application: 'webrtc',
appIstance: '_definst_'
}).then( response => console.log(response)).catch( errorMsg => console.log(errorMsg));
//Wowza answer example:
//{ success: true, message: 'Publish stream successfully started [webrtc/_definst_]: mp4:ipCamera.stream', data: null }Returns Promise promise which resolve when stream will connect
disconnectStreamFile
Disconnect a existing stream file
Parameters
optionsObject?options.applicationstring? name of an application (default value can be another if it was passed to the class constructor) (optional, default'live')options.streamFilestring? name of a streamfile (default value can be another if it was passed to the class constructor) (optional, default'myStream.stream')options.appInstancestring? name of an instance (default value can be another if it was passed to the class constructor) (optional, default'_definst_')options.mediaCasterTypestring? caster type (default value can be another if it was passed to the class constructor) (optional, default'rtp')
Examples
wowza.disconnectStreamFile({
streamFile: 'ipCamera.stream',
application: 'webrtc',
appIstance: '_definst_'
}).then( response => console.log(response)).catch( errorMsg => console.log(errorMsg));
//Wowza answer example:
//{ success: true, message: ''Publish stream successfully stopped [webrtc/_definst_]: mp4:ipCamera.stream'',data: null }Returns Promise promise which resolve when stream will connect
9 years ago