npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wowza-js-api

v1.0.0

Published

JS wrapper for cURL REST API for Wowza Streaming Engine

Downloads

34

Readme

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:[email protected]', 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