nanoStream Webcaster API
RtcUser
nanoStream Webcaster Public API Class
Kind: global class
Version: 5.16.0
Constructors
new RtcUser()
An RtcUser is the main class and entry point of the nanoStream Webcaster API.
Example
var rtcUser = new RtcUser();
Functions
rtcUser.checkSupport() ⇒ int
Checks if nanoStream Webcaster is supported by current browser.
Kind: instance method of RtcUser
Example
var supportLevel = RtcUser.checkSupport();
// 0: fully supported, no expected issues
// 1: not supported
// 2: partly supported - an outdated browser version
// 3: partly supported - a critically outdated browser version or a browser with issues, e.g. Edge
rtcUser.signIn(options)
Signs in to the server. After signIn succeeded you will have a session with the Webcaster server until reloading the browser or calling signOut. Parameters in braces "[ ]" are optional.
Kind: instance method of RtcUser
Emits: SignInSuccess
, SignInError
Param | Type | Description |
---|---|---|
options | object | The options object. |
options.server | string | The URL to the Webcaster server. |
[options.jwt] | string | The JWT access token for authentication. The JWT contains the ingest information, please also pass it in startBroadcast |
[options.bintuApiKey] | string | The bintu API key for authentication. |
[options.token] | string | The access token for authentication - Deprecated: Please migrate to use JWT for authentication. |
Example (sign in with JWT)
// rtcUser: instance of RtcUser
var options = {
server : 'https://bintu-webrtc.nanocosmos.de/p/webrtcws',
jwt : 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Im5hbm9jb3Ntb3MifQ...'
};
rtcUser.signIn(options);
Example (sign in with bintu API key)
// rtcUser: instance of RtcUser
var options = {
server : 'https://bintu-webrtc.nanocosmos.de/p/webrtcws',
bintuApiKey : 'awdegfq3490puerg2w54zj2p0w4h46zphm694i0796...'
};
rtcUser.signIn(options);
rtcUser.signOut()
Signs out from the server. The current session and a broadcast (if running) will be stopped.
Kind: instance method of RtcUser
Emits: SignOutSuccess
, SignOutError
Example
// rtcUser: instance of RtcUser
rtcUser.signOut();
rtcUser.isSignedIn() ⇒ boolean
Checks if the RtcUser is connected with the Webcaster server and signed in (see signIn).
Kind: instance method of RtcUser
Example
// rtcUser: instance of RtcUser
if (rtcUser.isSignedIn()) {
console.log('signed in');
} else {
console.log('not signed in');
}
rtcUser.setConfig(config)
Sets global configuration for the RtcUser instance. Please note that setting the audio transcoding bitrate is currently done in startBroadcast. Parameters in braces "[ ]" are optional.
Kind: instance method of RtcUser
Emits: SetConfigError
Param | Type | Default | Description |
---|---|---|---|
config | object | The config object. | |
[config.logLevel] | 0 | 1 | 2 | 3 | 4 | Verbosity of console logging. Allowed values: 0 (minimum verbosity) - 4 (maximum verbosity). | |
[config.metrics] | object | The metrics configuration object. | |
[config.metrics.accountId] | string | An account id provided to you. | |
[config.metrics.accountKey] | string | An account key provided to you. | |
[config.metrics.eventId] | string | An id of an event a stream is related to. | |
[config.metrics.statsInterval] | number | 10 | The interval how often the stats should be collected in seconds. Allowed values: 5 - 10 second(s). |
[config.metrics.customField*] | string | A custom field. * can be replaced with 1 - 10 e.g. 'customField3'. Possible from 'customField1' to 'customField10'. | |
[config.reconnect] | object | The reconnect configuration object. | |
[config.reconnect.minDelay] | number | 1 | Minimum delay for a reconnect attempt in seconds. Minimum value: 1. |
[config.reconnect.maxDelay] | number | 8 | Maximum delay for a reconnect attempt in seconds. Minimum value: 1. |
[config.reconnect.maxRetries] | number | 10 | Maximum amount of successive attempts to reconnect a broken webcast before failure. Setting this to 0 will disable reconnection. |
[config.bitrates] | object | The codec configuration object. | |
[config.bitrates.videoSendInitialBitrate] | number | 0 | The minimum video upstream bitrate in kbps (lower bound, does not work in Firefox). Allowed values: 0 - 34000 kbps. |
[config.bitrates.videoSendBitrate] | number | 0 | The maximum video upstream bitrate in kbps. Allowed values: 0 - 34000 kbps. |
[config.bitrates.audioSendBitrate] | number | 0 | The maximum audio upstream bitrate in kbps (does not work in Firefox). Allowed values: 0 - 510 kbps. |
Example
// rtcUser: instance of RtcUser
var config = {
logLevel: 2,
metrics: {
accountId: 'YOUR_ACCOUNT_ID',
accountKey: 'YOUR_ACCOUNT_KEY'
},
bitrates: {
videoSendInitialBitrate: 500,
videoSendBitrate: 1000
},
reconnect: {
minDelay: 2,
maxDelay: 8,
maxRetries: 10
}
};
rtcUser.setConfig(config);
rtcUser.setIceServers(iceServers)
This method is deprecated.
Sets an array of turn/stun-servers for the peer-to-peer connection. Parameters in braces "[ ]" are optional.
Kind: instance method of RtcUser
Param | Type | Description |
---|---|---|
iceServers | Array.<object> | The ice servers object. |
iceServers[].urls | Array.<string> | An array of URLs. |
[iceServers[].username] | string | The username for the ice servers if required. |
[iceServers[].credential] | string | The password for the ice servers if required. |
Example
// rtcUser: instance of RtcUser
var iceServers = [
{
urls: [
'turn:turn.nanocosmos.de:80?transport=udp'
],
username: 'username',
credential: 'password'
}
];
rtcUser.setIceServers(iceServers);
rtcUser.checkServer()
Checks the state of a Webcaster server.
Kind: instance method of RtcUser
Emits: ReceivedServerStats
Example
// rtcUser: instance of RtcUser
rtcUser.checkServer();
rtcUser.on('ReceivedServerStats', function(event) {
console.log(event.data);
});
rtcUser.enableStats([enable], [interval])
Enables to receive WebRTC stats in a given time interval. Parameters in braces "[ ]" are optional.
Kind: instance method of RtcUser
Emits: ReceivedWebRTCStats
Param | Type | Default | Description |
---|---|---|---|
[enable] | boolean | true | A flag to enable WebRTC stats. |
[interval] | number | 1000 | The interval time in milliseconds. The minimum value: 1 second. |
Example
// rtcUser: instance of RtcUser
rtcUser.enableStats();
rtcUser.on('ReceivedWebRTCStats', function(event) {
console.log(JSON.stringify(event.data.results));
});
rtcUser.startBroadcast(config)
Starts a broadcast to an RTMP ingest URL. Note: by default, only audio will be transcoded on server side, H264 codec will be used for video upstream and passed through directly to RTMP. Therefore you will find the configuration for the video upstream bitrate here: setConfig. Parameters in braces "[ ]" are optional.
Kind: instance method of RtcUser
Emits: StartBroadcastSuccess
, StartBroadcastError
, BroadcastStatus
, BroadcastError
Param | Type | Default | Description |
---|---|---|---|
config | object | The config object. | |
config.transcodingTargets | object | The transcoding config object. | |
config.transcodingTargets.output | string | The RTMP ingest URL. | |
config.transcodingTargets.streamname | string | null | The RTMP streamname. |
[config.transcodingTargets.audiobitrate] | number | 0 | The RTMP audio transcoded bitrate in bps, eg 64000. |
[config.transcodingTargets.rtmpconnectinfo] | object |
| Data to be send with the RTMP streams "onconnect". Pass flat object with key value pairs, hierarchies are not supported. |
[config.encoding] | object | The encoding config object. | |
[config.encoding.h264Profile] | 'cbp' | The H264 profile. Note: the H264 profile should only be set to 'cbp' in desktop Chrome (Windows). | |
[config.jwt] | string | A JWT containing ingest information can be passed. This will replace usage of transcodingTargets.streamname & transcodingTargets.output. Note that the JWT can be passed in signIn as authorization method. |
Example (Start a webcast with a JWT)
// rtcUser: instance of RtcUser
rtcUser.startBroadcast({
jwt: 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Im5hbm9jb3Ntb3MifQ...'
});
Example (Start a webcast with rtmp url and rtmp stream name)
// rtcUser: instance of RtcUser
var config = {
transcodingTargets: {
output: 'rtmp://bintu-stream.nanocosmos.de:1935/live',
streamname: 'xAuOp-IaIYi',
audiobitrate: 64000,
rtmpconnectinfo: {
'key1': 'value1',
'key2': 7.5,
'key3': false
}
}
};
rtcUser.startBroadcast(config);
rtcUser.stopBroadcast()
Stops a running broadcast.
Kind: instance method of RtcUser
Emits: StopBroadcastSuccess
, BroadcastError
Example
// rtcUser: instance of RtcUser
rtcUser.stopBroadcast();
rtcUser.sendMetaData(handlerName, jsonValues)
Adds live meta data to a broadcast stream.
Kind: instance method of RtcUser
Emits: RtcUser#event:Error
Param | Type | Description |
---|---|---|
handlerName | 'onMetaData' | 'onCuePoint' | Name of the meta data handler. Other types are not supported. |
jsonValues | object | The data to be sent. The parameter can contain a maximum object depth of 6. |
Example
// rtcUser: instance of RtcUser
rtcUser.sendMetaData('onMetaData', {myString: 'hello', myInteger: 1234});
rtcUser.addScreenCaptureExtension(name)
This method is deprecated.
Adds a Screen Capture Extension to the RtcUser for Chrome. Only needed in Chrome version < 72.
Kind: instance method of RtcUser
Param | Type | Description |
---|---|---|
name | string | The name of the screen capture extension. |
Example
// rtcUser: instance of RtcUser
var name = 'nanoScreenCapture';
rtcUser.addScreenCaptureExtension(name);
rtcUser.isScreenCaptureAvailable()
Checks if a Screen Capture Extension was added via addScreenCaptureExtension().
Kind: instance method of RtcUser
Example
// rtcUser: instance of RtcUser
var name = 'nanoScreenCapture';
rtcUser.addScreenCaptureExtension(name);
// wait until api has registered extension:
setTimeout(function() {
var hasScreenCapture = rtcUser.isScreenCaptureAvailable();
}, 1000);
rtcUser.getDevices()
Gets all connected input video and audio devices.
Kind: instance method of RtcUser
Emits: ReceivedDeviceList
, GetDevicesError
Example
// rtcUser: instance of RtcUser
rtcUser.getDevices();
rtcUser.setVideoDevice(config)
This method is deprecated.
Sets the input video device with config. Parameters in braces "[ ]" are optional.
Kind: instance method of RtcUser
Param | Type | Description |
---|---|---|
config | object | The config object. |
config.device | boolean | number | The value of the video device, possible values: true (auto device), false (no video), number (index of the video device). |
[config.width] | number | The input width (only if device will be set by index). |
[config.height] | number | The input height (only if device will be set by index). |
[config.framerate] | number | The input framerate (only if device will be set by index). |
Example
// rtcUser: instance of RtcUser
var config = {
device: 0,
width: 640,
height: 360,
framerate: 30
};
rtcUser.setVideoDevice(config);
Example
// rtcUser: instance of RtcUser
var config = {
device: 0
};
rtcUser.setVideoDevice(config);
Example
// rtcUser: instance of RtcUser
var config = {
device: true // auto device
};
rtcUser.setVideoDevice(config);
Example
// rtcUser: instance of RtcUser
var config = {
device: false // no video
};
rtcUser.setVideoDevice(config);
rtcUser.setAudioDevice(config)
This method is deprecated.
Sets the input audio device.
Kind: instance method of RtcUser
Param | Type | Description |
---|---|---|
config | object | The config object. |
config.device | boolean | number | The value of the audio device, possible values: true (auto device), false (no audio), number (index of the audio device). |
Example
// rtcUser: instance of RtcUser
var config = {
device: 0
};
rtcUser.setAudioDevice(config);
Example
// rtcUser: instance of RtcUser
var config = {
device: 0
};
rtcUser.setAudioDevice(config);
Example
// rtcUser: instance of RtcUser
var config = {
device: true // auto device
};
rtcUser.setAudioDevice(config);
Example
// rtcUser: instance of RtcUser
var config = {
device: false // no video
};
rtcUser.setAudioDevice(config);
rtcUser.getSelectedVideoDevice()
This method is deprecated.
Gets the current input video device.
Kind: instance method of RtcUser
Example
// rtcUser: instance of RtcUser
var device = rtcUser.getSelectedVideoDevice();
rtcUser.getSelectedAudioDevice()
This method is deprecated.
Gets the current input audio device.
Kind: instance method of RtcUser
Example
// rtcUser: instance of RtcUser
var device = rtcUser.getSelectedAudioDevice();
rtcUser.getSelectedDevice(config)
Gets the current input video/audio device.
Kind: instance method of RtcUser
Emits: GetSelectedDeviceError
Param | Type | Description |
---|---|---|
config | object | The config object. |
config.kind | 'videoinput' | 'audioinput' | The device kind. |
Example
// rtcUser: instance of RtcUser
var config = {
kind: 'videoinput'
};
var device = rtcUser.getSelectedDevice(config);
rtcUser.startPreview(config)
Starts the preview. Parameters in braces "[ ]" are optional.
Kind: instance method of RtcUser
Emits: StartPreviewSuccess
, ReceivedDeviceList
, StartPreviewError
Param | Type | Default | Description |
---|---|---|---|
config | object | The config object. | |
config.videoDeviceConfig | object | The video config object. | |
config.videoDeviceConfig.device | boolean | number | The device id to use. Allowed values: 0...n - specific device, true - auto device, false - no video. | |
[config.videoDeviceConfig.width] | number | The video width. Allowed values: 320 - 3840(4K). | |
[config.videoDeviceConfig.height] | number | The video height. Allowed values: 240 - 2160(4K). | |
[config.videoDeviceConfig.framerate] | number | The video framerate. Allowed values: 0 - 60 fps. | |
videoDeviceConfig.source | 'camera' | 'screen' | The video source to be requested. | |
config.audioDeviceConfig | object | The audio config object. | |
config.audioDeviceConfig.device | boolean | number | The device id to use. Allowed values: 0...n - specific device, true - auto device, false - no audio. | |
[config.audioDeviceConfig.autoGainControl] | boolean | Automatic gain control attempts to automatically maintain a steady overall volume level. | |
[config.audioDeviceConfig.echoCancellation] | boolean | Echo cancellation attempts to prevent echo effects. | |
[config.audioDeviceConfig.noiseSuppression] | boolean | Noise suppression automatically filters the audio to remove background noise. | |
config.elementId | string | The id of a video element to pass in the requested stream directly. | |
[config.useWebView] | boolean | false | A flag to indicate that a WebView is used. |
Example (Audio & video.)
// rtcUser: instance of RtcUser
var config = {
videoDeviceConfig : {
device: 0, // video is enabled using specific device
width: 640,
height: 360,
framerate: 30,
source: 'camera'
},
audioDeviceConfig : {
device: 0 // audio is enabled using specific device
},
elementId : 'video-local',
useWebView : true
};
rtcUser.startPreview(config);
Example (Audio & screen capture.)
// rtcUser: instance of RtcUser
var config = {
videoDeviceConfig : {
width: 640,
height: 360,
framerate: 30,
source: 'screen'
},
audioDeviceConfig : {
device: 0 // audio is enabled using specific device
},
elementId : 'video-local',
useWebView : true
};
rtcUser.startPreview(config);
Example (Video only.)
// rtcUser: instance of RtcUser
var config = {
videoDeviceConfig : {
device: 0, // video is enabled using specific device
width: 640,
height: 360,
framerate: 30,
source: 'camera'
},
audioDeviceConfig : {
device: false // no audio; video-only preview
},
elementId : 'video-local',
useWebView : false
};
rtcUser.startPreview(config);
Example (Audio only.)
// rtcUser: instance of RtcUser
var config = {
videoDeviceConfig : {
device: false // no video; audio-only preview
},
audioDeviceConfig : {
device: 0 // audio is enabled using specific device
},
elementId : 'video-local',
useWebView : false
};
rtcUser.startPreview(config);
Example (Audio only with all preprocessing disabled.)
// rtcUser: instance of RtcUser
var config = {
videoDeviceConfig : {
device: false // no video; audio-only preview
},
audioDeviceConfig : {
device: 0, // audio is enabled using specific device
autoGainControl: false,
echoCancellation: false,
noiseSuppression: false
},
elementId : 'video-local',
useWebView : false
};
rtcUser.startPreview(config);
rtcUser.stopPreview()
Stops the preview.
Kind: instance method of RtcUser
Emits: StopPreviewSuccess
, StopPreviewError
Example
// rtcUser: instance of RtcUser
rtcUser.stopPreview();
rtcUser.muteVideo(mute)
This method is deprecated.
Mutes/unmutes the video.
Kind: instance method of RtcUser
Param | Type | Description |
---|---|---|
mute | boolean | Mute/unmute. |
Example
// rtcUser: instance of RtcUser
var mute = true;
rtcUser.muteVideo(mute);
rtcUser.muteAudio(mute)
This method is deprecated.
Mutes/unmutes the audio.
Kind: instance method of RtcUser
Param | Type | Description |
---|---|---|
mute | boolean | Mute/unmute. |
Example
// rtcUser: instance of RtcUser
var mute = true;
rtcUser.muteAudio(mute);
rtcUser.muteDevice(config)
Mutes/unmutes a video/audio device.
Kind: instance method of RtcUser
Emits: MuteDeviceError
Param | Type | Description |
---|---|---|
config | object | The config object. |
config.kind | 'videoinput' | 'audioinput' | The device kind to mute. |
config.mute | boolean | A flag to mute/unmute the device. |
Example
// rtcUser: instance of RtcUser
var config = {
kind: 'videoinput',
mute: true
}
rtcUser.muteDevice(config);
rtcUser.injectExternalMediaStream(config)
Mixes tracks (currently only audio) of an external MediaStream into the currently previewed local stream.
Kind: instance method of RtcUser
Param | Type | Description |
---|---|---|
config | object | Config object with info on what to mix in. |
config.stream | MediaStream | the MediaStream containing the track(s) to mix in. |
config.tracks | Array.<string> | Array with the types of tracks which should be injected (only 'audio' is supported at the moment). |
Example
// rtcUser: instance of RtcUser
// externalStream instance of MediaStream (https://developer.mozilla.org/de/docs/Web/API/MediaStream)
var data = {stream: externalStream, tracks: ['audio']};
rtcUser.injectExternalMediaStream(data);
rtcUser.setMediaStream(config)
Sets an MediaStream that will be used as source for webcasting instead of an internally created stream (by your live cam or screen).
If you simply intent to utilize a combination of camera, microphone or screen share sources: Use the startPreview call.
Context:
It must contain one or two MediaStreamTracks, one VideoStreamTrack and / or one AudioStreamTrack.
The MediaStream can be mixed together on application level by combining different sources:
Restrictions:
When utilizing this API call, application developers are responsible for the externally created stream.
- Maintaining the provided framerate is critical for end to end latency of the webcast.
- Tab throttling. When the current tab gets out of focus, most browsers will enable tab throttling.
Timers, like
setInterval
, will be updated less frequently. You should check wether the tab left focus, and warn your users accordingly. E.g. with the DOM visibilitychange event - Video dimensions (width & height) must not change during a webcast.
- Under certain circumstances the browsers encoder will adapt the video resolution, for example when CPU overusage is being detected.
Kind: instance method of RtcUser
Param | Type | Description |
---|---|---|
config | object | The config object. |
config.stream | number | The MediaStream. |
[config.width] | number | The video width. Allowed values: 320 - 3840(4K). |
[config.height] | number | The video height. Allowed values: 240 - 2160(4K). |
[config.framerate] | number | The target video framerate. Allowed values: 0 - 60 fps. |
Example
// rtcUser: instance of RtcUser
// pass an MediaStream to the API
var canvasWidth = 1280;
var canvasHeight = 720;
var framerate = 30;
// access your HTML canvas (<canvas id="my-canvas"/> element)
var canvas = document.getElementById('my-canvas');
var context = canvas.getContext('2d');
// create a MediaStream from the canvas
var canvasStream = canvas.captureStream(framerate);
// optionally, add an AudioStreamTrack
var myAudioTrack = ...;
canvasStream.addTrack(myAudioTrack);
// your render loop, the loop calls itself 30 (framerate) times per second
// as an example, we simply draw the string "Hello World"
function renderLoop() {
context.font = '50px serif';
context.fillText('Hello world', 50, 90);
setTimeout(loop, 1000 / framerate); // drawing at 30fps
};
var config = {
stream: canvasStream,
width: canvasWidth,
height: canvasHeight,
framerate: framerate
};
// start the render loop
renderLoop();
rtcUser.setMediaStream(config);
Events
"SignInSuccess"
SignInSuccess event. The event is fired if sign in succeeded.
Kind: event emitted by RtcUser
Typeof: SignInSuccessEvent
"SignInError"
SignInError event. The event is fired if sign in failed.
Kind: event emitted by RtcUser
Typeof: ErrorEvent
"SignOutSuccess"
SignOutSuccess event. The event is fired if sign out succeeded. Session is now destroyed.
Kind: event emitted by RtcUser
Typeof: SuccessEvent
"SignOutError"
SignOutError event. The event is fired if an error occured. Session is destroyed in any case.
Kind: event emitted by RtcUser
Typeof: ErrorEvent
"SetConfigError"
SetConfigError event. The event is fired if config failed to be set.
Kind: event emitted by RtcUser
Typeof: ErrorEvent
"ReceivedServerStats"
ReceivedServerStats event. The event is fired if server stats is received.
Kind: event emitted by RtcUser
Typeof: ServerStatsEvent
"ReceivedWebRTCStats"
ReceivedWebRTCStats event. The event is fired multiple times between the "start" and "stop" broadcast events. The payload contains WebRTC stats information.
Kind: event emitted by RtcUser
Typeof: WebRTCStatsEvent
"StartBroadcastSuccess"
StartBroadcastSuccess event. The event is fired if a broadcast started successfully.
Kind: event emitted by RtcUser
Typeof: SuccessEvent
"StartBroadcastError"
StartBroadcastError event. The event is fired if a broadcast failed to start.
Kind: event emitted by RtcUser
Typeof: ErrorEvent
"BroadcastStatus"
BroadcastStatus event. The event is fired multiple times between the "start" and "stop" broadcast events. The payload contains information about the connection state.
Kind: event emitted by RtcUser
Typeof: StatusEvent
"BroadcastError"
BroadcastError event. The event is fired if a broadcasting error occurred between the "start" and "stop" broadcast events.
Kind: event emitted by RtcUser
Typeof: ErrorEvent
"StopBroadcastSuccess"
StopBroadcastSuccess event. The event is fired if a broadcast stopped successfully. It does not contain an event payload.
Kind: event emitted by RtcUser
Typeof: SuccessEvent
"StopBroadcastError"
StopBroadcastError event. The event is fired if a broadcast failed to execute the "stop" call as it is expected. Note: the broadcast is guaranteed to stop before the event is fired.
Kind: event emitted by RtcUser
Typeof: ErrorEvent
"ReceivedDeviceList"
ReceivedDeviceList event. The event is fired if a list of connected input video and audio devices is received.
Kind: event emitted by RtcUser
Typeof: DevicesReceivedEvent
"GetDevicesError"
GetDevicesError event. The event is fired if an error occured while getting connected input video and audio devices.
Kind: event emitted by RtcUser
Typeof: ErrorEvent
"GetSelectedDeviceError"
GetSelectedDeviceError event. The event is fired if a selected video/audio device getting failed.
Kind: event emitted by RtcUser
Typeof: ErrorEvent
"StartPreviewSuccess"
StartPreviewSuccess event. The event is fired if a preview started successfully.
Kind: event emitted by RtcUser
Typeof: StartPreviewSuccessEvent
"StartPreviewError"
StartPreviewError event. The event is fired if a preview failed to start.
Kind: event emitted by RtcUser
Typeof: ErrorEvent
"StopPreviewSuccess"
StopPreviewSuccess event. The event is fired if a preview stopped successfully.
Kind: event emitted by RtcUser
Typeof: SuccessEvent
"StopPreviewError"
StopPreviewError event. The event is fired if a preview failed to stop. Note: the preview is guaranteed to stop before the event is fired.
Kind: event emitted by RtcUser
Typeof: ErrorEvent
"MuteDeviceError"
MuteDeviceError event. The event is fired if a video/audio device mute/unmute failed.
Kind: event emitted by RtcUser
Typeof: ErrorEvent
Type Definitions
ErrorEvent : object
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
data | object | The data object - Deprecated: will be removed in nanoStream Webcaster v.6; please use the "error" object instead. |
error | object | The error object. |
error.code | ErrorCode | The code of the error. |
error.message | string | Human readable message of the error. |
error.name | string | The name of the error. |
error.text | string | The text of the error - Deprecated: will be removed in nanoStream Webcaster v.6; please use the "error.message" property instead. |
error.type | string | The type of the error. |
error.userinfo | object | The user info associated with the error. |
[error.userinfo.metadata] | object | Metadata with additional state information. |
[error.userinfo.metadata.sessionId] | object | Session id (defined only if signed in). |
[error.userinfo.metadata.isSignedIn] | object | Wether a session to the server was established successfully. |
[error.userinfo.metadata.server] | object | Server url (defined only if a connection to the server was made). |
[error.userinfo.metadata.streamname] | object | RTMP stream name (defined only if a broadcast was started). |
[error.userinfo.metadata.hasAudio] | object | Wether the current stream has an audio track. |
[error.userinfo.metadata.hasVideo] | object | Wether the current stream has an video track. |
[error.userinfo.metadata.isMobile] | object | Wether the current device is a mobile device. |
[error.userinfo.metadata.browser] | object | Currently used browser. |
[error.userinfo.metadata.browserVersion] | object | Currently used browser version. |
[error.userinfo.metadata.os] | object | Current operating system. |
name | string | The name of the event. |
SuccessEvent : object
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
[data] | object | The data object. Note: the property is optional, therefore, its presence is not guaranteed. |
[data.output] | string | The RTMP ingest URL. Note: the property is optional, therefore, its presence is not guaranteed. |
[data.streamname] | string | The RTMP ingest streamname. Note: the property is optional, therefore, its presence is not guaranteed. |
[data.stream] | object | The stream object. Note: the property is optional, therefore, its presence is not guaranteed. |
StatusEvent : object
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
data | object | The data object. |
data.message | 'signalling' | 'connected' | 'reconnecting' | 'broadcasting' | 'reconnecting_broadcast' | The connection state. Note that 'reconnecting' implies an RTMP reconnect on server side and 'reconnecting_broadcast' means a client side reconnect. |
[data.number] | object | Reserverd for internal developer's use. Note: the property is optional, therefore, its presence is not guaranteed - Deprecated: will be removed in nanoStream Webcaster v.6. |
[data.rtmp] | object | Reserved for internal developer's use. Note: the property is optional, therefore, its presence is not guaranteed - Deprecated: will be removed in nanoStream Webcaster v.6. |
data.state | 4 | 5 | 6 | 7 | The connection state. Possible values: 4 = 'signalling', 5 = 'connected', 6 = 'broadcasting', 7 = 'reconnecting'. |
data.streamname | object | The RTMP ingest streamname. |
[name] | object | The name of the event. Note: the property is optional, therefore, its presence is not guaranteed. |
[target] | object | Reserved for internal developer's use. Note: the property is optional, therefore, its presence is not guaranteed - Deprecated: will be removed in nanoStream Webcaster v.6. |
DevicesReceivedEvent : object
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
data | object | The data object. |
data.devices | object | The audio and video devices object. |
[data.devices.audiodevices] | Array.<object> | An array of connected input audio devices. Note: the property is optional, therefore, its presence is not guaranteed. |
data.devices.audiodevices.id | string | The id of an audio device. |
data.devices.audiodevices.index | number | The index of an audio device. Note: indices start from 0. |
[data.devices.videodevices] | Array.<object> | An array of connected input video devices. Note: the property is optional, therefore, its presence is not guaranteed. |
data.devices.videodevices.id | string | The id of a video device. |
data.devices.videodevices.index | number | The index of a video device. Note: indices start from 0. |
data.updated | boolean | Reserved for internal developer's use - Deprecated: will be removed in nanoStream Webcaster v.6. |
StartPreviewSuccessEvent : object
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
data | object | The data object. |
data.constraints | object | The constraints object. |
[data.constraints.audio] | object | The audio constraints object. Note: the property is optional, therefore, its presence is not guaranteed. |
data.constraints.audio.deviceId | object | The id of an audio device. |
[data.constraints.video] | object | The video constraints object. Note: the property is optional, therefore, its presence is not guaranteed. |
data.constraints.video.deviceId | object | The id of a video device. |
[data.constraints.video.framerate] | object | The video framerate. Note: the property is optional, therefore, its presence is not guaranteed. |
[data.constraints.video.height] | object | The video height. Note: the property is optional, therefore, its presence is not guaranteed. |
data.constraints.video.source | string | The video source. |
[data.constraints.video.width] | object | The video width. Note: the property is optional, therefore, its presence is not guaranteed. |
data.metadata | object | The metadata object. |
data.metadata.framerate | number | The video framerate set in metdata. |
data.metadata.hasAudio | number | A flag to indicate that audio is present. |
data.metadata.hasVideo | number | A flag to indicate that video is present. |
data.metadata.height | number | The video height set in metadata. |
data.metadata.width | number | The video width set in metadata. |
data.stream | object | The stream object. |
data.stream.active | boolean | A flag to indicate that a stream is active. |
data.stream.id | string | The stream id. |
SignInSuccessEvent : object
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
data | object | The data object. |
data.server | string | The URL of the Webcaster server |
data.userId | string | The user id of the Webcaster server. |
ServerStatsEvent : object
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
data | object | The data object. |
data.stats | object | The stats object. |
data.stats.active_connections | number | The total number of active connections to the Webcaster server. |
data.stats.active_passthroughs | number | The number of active connections with passthrough enabled to the Webcaster server. |
data.stats.active_transcoders | number | The number of active connections with transcoding enabled to the Webcaster server. |
data.stats.cpu_load | number | Server CPU load. |
data.stats.disk_space | number | Server disk space. |
data.stats.domainname | string | Server domain name. |
data.stats.hostname | string | Server host name. |
data.stats.license | object | Server license. |
data.stats.license.end | string | The license expiration date. |
data.stats.license.expired | boolean | A flag to indicate that the license has expired. |
data.stats.license.expiring | boolean | A flag to indicate if the license has an end date or not. |
data.stats.license.start | string | The license issue date. |
data.stats.license.valid | boolean | A flag to indicate that the license is valid. |
data.stats.max_cpu_load | number | Server maximum CPU load. |
data.stats.max_transcoders | number | Server maximum number of transcoders. |
data.stats.server_version | string | The version of the Webcaster server. |
data.stats.transcoder_version | string | The version of the transcoder. |
name | string | The name of the event. |
target | string | Reserved for internal developer's use - Deprecated: will be removed in nanoStream Webcaster v.6. |
WebRTCStatsEvent : object
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
data | object | The data object. |
data.message | string | The connection state message (expected value: 'broadcasting'). |
data.stats.results | object | The results object. It contains the stats key/value pairs. All stats in the result object are optional and are present based on the capabilities of the currently used browser. |
[data.stats.results.audioBitrate] | number | The audio bitrate in kbps. |
[data.stats.results.audioBitrateMin] | number | Minimum 'audioBitrate' during past 10 seconds. |
[data.stats.results.audioBitrateMax] | number | Maximum 'audioBitrate' during past 10 seconds. |
[data.stats.results.audioBitrateAverage] | number | Average 'audioBitrate' during past 10 seconds. |
[data.stats.results.audioCodec] | string | The audio codec. |
[data.stats.results.frameHeight] | number | The video frame height in pixels. |
[data.stats.results.frameWidth] | number | The video frame width in pixels. |
[data.stats.results.framerate] | number | The video frame rate in frames per second. |
[data.stats.results.framerateMin] | number | Minimum 'framerate' during past 10 seconds. |
[data.stats.results.framerateMax] | number | Maximum 'framerate' during past 10 seconds. |
[data.stats.results.framerateAverage] | number | Average 'framerate' during past 10 seconds. |
[data.stats.results.videoBitrate] | number | The video bitrate in kbps. |
[data.stats.results.videoBitrateMin] | number | Minimum 'videoBitrate' during past 10 seconds. |
[data.stats.results.videoBitrateMax] | number | Maximum 'videoBitrate' during past 10 seconds. |
[data.stats.results.videoBitrateAverage] | number | Average 'videoBitrate' during past 10 seconds. |
[data.stats.results.videoCodec] | string | The video codec. |
[data.stats.results.videoSendDelay] | number | An indication for video packet delay, before packets are send to the server. |
[data.stats.results.videoSendDelayMax] | number | Maximum 'videoSendDelay' during past 10 seconds. |
[data.stats.results.videoSendDelayAverage] | number | Average 'videoSendDelay' during past 10 seconds. |
[data.stats.results.packetLoss] | number | Percentage of packets lost during past 10 seconds. |
[data.stats.results.roundTripTime] | number | Current time in milliseconds that data takes from the client to the webcaster server and back. |
data.stats.state | number | The connection state. The expected value: 6 = 'broadcasting'. |
data.stats.streamname | string | The RTMP ingest streamname. |
data.stats.text | string | The connection state text. The expected value: 'broadcasting'. |
name | string | The name of the event. |
target | string | Reserved for internal developer's use - Deprecated: will be removed in nanoStream Webcaster v.6. |
ErrorCode : number
The possible client error codes in an ErrorEvent event.
Kind: global typedef
See: ErrorEvent
Properties
Name | Type | Description |
---|---|---|
1000-1999 | GeneralError | |
1000 | A general error returned by any nanoStream Webcaster component (see the error message for more informaiton). | |
1001 | A type is not valid. | |
1002 | A value is not valid. | |
1003 | An enum value is not valid. | |
1004 | An object does not exist. | |
1005 | A function is not defined. | |
1006 | An operation is not allowed to be executed. | |
2000-2999 | RequestError | |
2000 | A general request error - Deprecated: will be removed in nanoStream Webcaster v.6. | |
3000-3999 | WebSocketError | |
3000 | A general WebSocket error (see the error message for more information). | |
3001 | A WebSocket state is wrong (see an error message for more information). | |
3002 | An error occurred when creating a WebSocket. | |
4000-4999 | SessionError | |
4000 | Sign in failed. | |
4001 | A session is not signed in. | |
5000-5999 | BroadcastError | |
5001 | A broadcast failed to start. | |
5002 | A Broadcast failed after it was started (see the error message for more information). | |
5003 | Stopping broadcast caused an error. Either no broadcast is runnung or an active broadcast is currently shutting down. | |
6000-6999 | WebRTCError | |
6000 | A media stream was received, but no video/audio data is coming from a device. The device could be in use from another application. | |
6001 | A media stream was received, but it contains no tracks. | |
6002 | A media stream was not found. | |
6003 | A media stream was not removed. | |
6004 | No devices are available for "getUserMedia". | |
6005 | A general "getUserMedia" error (may include: 'PermissionDenied', 'NotAllowedError', 'NotReadableError', 'NotFoundError', 'OverconstrainedError', 'AbortError', 'GetMediaError', 'NoDeviceError', 'NoStreamError'). | |
6006 | Devices failed to get enumerated. | |
6008 | A general "getDisplayMedia" error (may include: 'PermissionDenied', 'NotAllowedError'). | |
101000-109999 | ServerError | Server-side errors start with 10xxxx. |
101000-101999 | GeneralError | Server-side general errors. |
101001 | An internal server error. | |
101002 | A parameter is required. | |
101003 | A data type is wrong. | |
102000-102999 | AccessError | Server-side access errors. |
102001 | Access is denied. | |
103000-103999 | AuthenticationError | Server-side authentication errors. |
103000 | The server could not initialize authentication. | |
103001 | Wrong authentification data. A valid token, or username and password is/are required. | |
103002 | Access to a feature is forbidden (features: 'webrtc'). | |
103003 | JWT authentication failed. | |
103004 | JWT contains an invalid stream. | |
104000-104999 | BintuError | Server-side bintu related errors. |
104001 | A stream option is not allowed (options: 'webrtc', 'transcoding'). | |
104002 | A bintu API key is invalid. | |
105000-105999 | TranscoderError | Server-side configuration errors. |
106000-106999 | SystemMonitorError | Server-side monitoring errors. |
106001 | An error occured while retrieving system info. | |
107000-107999 | SessionError | |
107001 | A configuration is malformed. | |
107002 | A session is invalid. | |
108000-108999 | ChatError | Deprecated. |
109000-109999 | RTMPError | |
109000 | The RTMP connection has failed. |