RTCPublisher()

Main entry for WebRTC-based Publisher.

new RTCPublisher()

Extends

Methods

callServer(methodName, args) → {Promise}

Request to invoke a method on the Application Adapter related to the app config setting.

Parameters:
Name Type Description
methodName String

The name of the method to invoke on thw Application Adapter

args Array

The ordered list of arguments to invoke on the method. Do not provide anything if the method takes no arguments.

Returns:
Promise

getMediaStream() → {MediaStream}

Returns the MediaStream instance if generated through getUserMedia and exists for broadcast.

Returns:
MediaStream

getOptions() → {Object}

Returns the initialization configuration used in init().

Returns:
Object

getPeerConnection() → {RTCPeerConnection}

Returns the current RTCPeerConnection helper if established.

Returns:
RTCPeerConnection

getType() → {String}

Returns the type of implementation: RTC.

Returns:
String

init(options) → {Promise}

Request to initialize the WebRTC-based Publisher based on configuration. The returned Promise will either resolve with a reference to this instance or reject with an error String in failure.

Parameters:
Name Type Description
options Object

The initialization configuration map.

Returns:
Promise

muteAudio()

Request to mute the audio of the broadcast. Can only be called once the broadcast has begun.

muteVideo()

Request to mute (not send) the video of the broadcast. Can only be called once the broadcast has begun.

off(type, fn)

Remove a callback handler for an event type.

Parameters:
Name Type Description
type String
fn function
Inherited From:

on(type, fn)

Assign a callback handler to an event type.

Parameters:
Name Type Description
type String
fn function
Inherited From:

preview() → {Promise}

Request to preview the generate MediaStream in the target view prior to publishing. Automatically called when invoking publish().

Returns:
Promise
See:

publish(streamName, promise) → {Promise}

Request to begin a broadcast session after initilization has occured.

Parameters:
Name Type Default Description
streamName String null

Optional stream name to broadcast on, otherwise defaulting to the streamName provided in init() configuration.

promise Promise null

Optional Promise object to resolve/reject on based on sequence of events in establishing a broadcast, otherwise defaulting to Promise created internally and returned.

Returns:
Promise -

The returned Promise will resolve or reject on successful start of a broadcast.
There are several processes that occur in order to establish a WebRTC broadcast that involve - but are not limited to - ICE communication and assigning of local and remote SDPs on peer connections.

send(methodName, data)

Request to send a message to all subscribers.

Parameters:
Name Type Description
methodName String

The method name associated with the message to be accepted by all subscribers.

data Object

The data object to send associated with the method name.

trigger(event)

Dispatch an event to be handled by any assigned callbacks.

Parameters:
Name Type Description
event Event
Inherited From:

unmuteAudio()

Request to unmute the audio of a broadcast that has been previously muted.

unmuteVideo()

Request to unmute (resume sending) the video of a previously video-muted broadcast.

unpublish() → {Promise}

Request to stop a broadcast. The returned Promise will either resolve or reject on successful stop of broadcast.

Returns:
Promise