new RTCSubscriber()
Extends
Methods
-
async _setUpMediaTransform(transformOptions, connection)
-
Assigns pipeline for optional transform streams.
Parameters:
Name Type Description transformOptions
Object connection
RTCPeerConnection -
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 -
disableStandby()
-
Removes subscriber from standby mode - turning the audio and video back on and consumable after a mute request.
-
enableStandby()
-
Enters subscriber into standby mode - keeping connection open but not bothering to consume video or audio.
-
getControls() → {PlaybackControls}
-
Returns reference to playback controls if available.
Returns:
PlaybackControls -
getDataChannel() → {RTCDataChannel}
-
Returns the optional RTCDataChannel on the opened peer connection.
Returns:
RTCDataChannel -
getMediaStream() → {MediaStream}
-
Returns the
MediaStream
instance if generated throughgetUserMedia
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 -
getPlayer() → {Element}
-
Returns the target view Element.
Returns:
Element -
getType() → {String}
-
Returns the type of implementation:
RTC
.Returns:
String -
init(options, mediaTransform) → {Promise}
-
Request to initialize the WebRTC-based Subscriber based on configuration. The returned
Promise
will either resolve with a reference to this instance or reject with an errorString
in failure.Parameters:
Name Type Description options
Object The initialization configuration map.
mediaTransform
Object The defined transforms to pipe decoding through. InsertableStreams API. { video: (function|null), audio: (function|null), worker: { video: (Worker|null), audio: (Worker|null) }, transformFrameType: (TransformFrameTypes), pipeOptions: (object), } If you have transform functions that can run on the main thread, provide them in
video
and/oraudio
. If you have transform functions that should be run in a separate thread, utilize theworker
option providing aWebWorker
. By default, the transform function will be supplied an RTCEncodedVideoFrame or RTCEncodedAudioFrame. If you would prefer to receive either a VideoFrame or AudioData instead, use the transfromFrameType of TransformFrameTypes.PACKET. You can provide some options that will be sent when defining pipe aspipeOptions
. Read more here: https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/pipeThrough TheWebWorker
- if utilized - needs to confirm to a specific API that will be called from the SDK.Returns:
Promise -
mute()
-
Request to mute the audio of the stream.
- Overrides:
-
muteAudio()
-
Mutes audio being sent from the server to the subscriber. Audio packets will be held from the subscriber on the server-side.
-
muteVideo()
-
Mutes video being sent from the server to the subscriber. Video packets will be held from the subscriber on the server-side.
-
off(type, fn)
-
Remove a callback handler for an event type.
Parameters:
Name Type Description type
String fn
function - Overrides:
-
on(type, fn)
-
Assign a callback handler to an event type.
Parameters:
Name Type Description type
String fn
function - Overrides:
-
onStreamSwitchComplete()
-
Event handler for success on request to switch streams.
-
pause()
-
Request to pause playback of stream.
- Overrides:
-
play()
-
Request to start playing the stream.
- Overrides:
-
resume()
-
Request to resume playback od stream.
- Overrides:
-
seekTo(value, duration)
-
Request to set playback point in time.
Parameters:
Name Type Description value
Number Either the percentage of the duration (if provided) or the time in seconds.
duration
Number Optional duration of video (when known through VOD) to use to determine time based on first param passed as percentage.
- Overrides:
-
sendLog(level, message)
-
Sends an RPC log to the server which will be printed out in server logs.
Parameters:
Name Type Description level
String Valid values: TRACE, INFO, DEBUG, WARN or ERROR
message
Object Either a String or a JSON-serializable Object. This param will be converted to a string to be sent to the server.
-
setVolume(value)
-
Request to set volume of audio of stream.
Parameters:
Name Type Description value
Number From 0..1.
- Overrides:
-
stop()
-
Request to stop playback of stream.
- Overrides:
-
subscribe() → {Promise}
-
Request to begin subscribing to a stream.
Returns:
Promise -The returned
Promise
will resolve or reject on successful start of playback. There are several processes that occur in order to establish a WebRTC subscription that involve - but are not limited to - ICE communication and assigning of local and remote SDPs on peer connections. -
toggleFullScreen()
-
Request to toggle fullscreen state.
-
transform(mediaTransform)
-
Request to apply media transforms to the receiver tracks on the current or future Peer Connection. If you intend to call this at a later time than
init()
with transforms, you must provide anrtcConfiguration
in the init config that hasencodedInsertableStreams
set totrue
. e.g.,rtcConfiguration: { iceServers: [{urls: 'stun:stun2.l.google.com:19302'}], iceCandidatePoolSize: 2, bundlePolicy: 'max-bundle', encodedInsertableStreams: true }
Parameters:
Name Type Description mediaTransform
Object The defined transforms to pipe decoding through. InsertableStreams API. { video: (function|null), audio: (function|null) }
-
trigger(event)
-
Dispatch an event to be handled by any assigned callbacks.
Parameters:
Name Type Description event
Event - Overrides:
-
unmute()
-
Request to unmute the audio of the stream.
- Overrides:
-
unmuteAudio()
-
Unmutes audio being sent from the server to the subscriber. Audio packets will resume being sent to the subscriber.
-
unmuteVideo()
-
Unmutes video being sent from the server to the subscriber. Video packets will resume being sent to the subscriber.
-
unsubscribe() → {Promise}
-
Request to stop a subscription. The returned
Promise
will either resolve or reject on successful stop of subscription.Returns:
Promise