Skip to content

NNLRussia/WowzaJsApi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  • options Object? possible to set stream parametres which will use as default for methods
    • options.wowzaAdress string? IP address or domein name of Wowza Streaming Engine (optional, default 'localhost')
    • options.streamFile string? name of a streamfile (optional, default 'myStream.stream')
    • options.application string? name of an application (optional, default 'application')
    • options.appInstance string? name of an application instance (optional, default '_definst_')
    • options.mediaCasterType string? 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

  • options Object?
    • options.application string? 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

  • options Object?
    • options.application string? name of an application (default value can be another if it was passed to the class constructor) (optional, default 'live')
    • options.streamFile string? 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

  • recorderParametres Object
    • recorderParametres.restURI string
    • recorderParametres.recorderName string
    • recorderParametres.instanceName string
    • recorderParametres.recorderState string
    • recorderParametres.defaultRecorder boolean
    • recorderParametres.segmentationType string
    • recorderParametres.outputPath string default value is [] and wowza should save files in [install-dir]/content, not tested
    • recorderParametres.baseFile string default is [], and wowza should name file as a streamfile name, not tested
    • recorderParametres.fileFormat string
    • recorderParametres.fileVersionDelegateName string
    • recorderParametres.fileTemplate string
    • recorderParametres.segmentDuration number
    • recorderParametres.segmentSize number
    • recorderParametres.segmentSchedule string
    • recorderParametres.recordData boolean
    • recorderParametres.startOnKeyFrame boolean
    • recorderParametres.splitOnTcDiscontinuity boolean
    • recorderParametres.backBufferTime number
    • recorderParametres.option string should to work with one of: version | append | overwrite, but not tested
    • recorderParametres.moveFirstVideoFrameToZero boolean
    • recorderParametres.currentSize number
    • recorderParametres.currentDuration number
    • recorderParametres.recordingStartTime string
  • options Object?
    • options.application string? name of an application (default value can be another if it was passed to the class constructor) (optional, default 'live')
    • options.streamFile string? name of a streamfile (default value can be another if it was passed to the class constructor) (optional, default 'myStream.stream')
    • options.appInstance string? 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

  • options Object?
    • options.application string? name of an application (default value can be another if it was passed to the class constructor) (optional, default 'live')
    • options.streamFile string? name of a streamfile (default value can be another if it was passed to the class constructor) (optional, default 'myStream.stream')
    • options.appInstance string? 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

  • options Object?
    • options.application string? name of an application (default value can be another if it was passed to the class constructor) (optional, default 'live')
    • options.appInstance string? 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

  • options Object?
    • options.application string? name of an application (default value can be another if it was passed to the class constructor) (optional, default 'live')
    • options.streamFile string? name of a streamfile (default value can be another if it was passed to the class constructor) (optional, default 'myStream.stream')
    • options.appInstance string? name of an instance (default value can be another if it was passed to the class constructor) (optional, default '_definst_')
    • options.mediaCasterType string? 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

  • options Object?
    • options.application string? name of an application (default value can be another if it was passed to the class constructor) (optional, default 'live')
    • options.streamFile string? name of a streamfile (default value can be another if it was passed to the class constructor) (optional, default 'myStream.stream')
    • options.appInstance string? name of an instance (default value can be another if it was passed to the class constructor) (optional, default '_definst_')
    • options.mediaCasterType string? 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

About

JS wrapper for cURL REST API for Wowza Streaming Engine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published