Skip to main content
Version: v1.39.0

RemoteStageStream

A RemoteStageStream is a wrapper for media coming from remote participants. It's obtained from the StageEvents.STAGE_PARTICIPANT_STREAMS_ADDED event and contains APIs for manipulating the quality and state of the media playback.

The RemoteStageStream emits RemoteStageStreamEvents which can be listened to by calling stream.on(event, callback) or stream.off(event, callback). The callback types are defined in the RemoteStageStreamEventMap.

Extends​

Implements​

Accessors​

id​

Get Signature​

get id(): string

Returns the MediaTrack Id for the track associated with the stream.

Returns​

string

Implementation of​

StageStream.id


isAdapting​

Get Signature​

get isAdapting(): boolean

Returns whether or not the server is dynamically adapting layers based on the network conditions of the device (true), or a manual layer has been chosen by the application (false).

Use this value in conjunction with the RemoteStageStream.getSelectedLayer to determine whether the selected layer is associated with Dynamic Simulcast or have been manually selected.

For example:

  • isAdapting === true --> getSelectedLayer is server selected layer
  • isAdapting === false --> getSelectedLayer is app selected layer
Returns​

boolean


isMuted​

Get Signature​

get isMuted(): boolean

Returns whether the audio or video stream is muted or not. A muted audio stream is one that does not send audio samples (silent), and a muted video stream is one that does not send video frames (frozen).

Returns​

boolean

Implementation of​

StageStream.isMuted


mediaStreamTrack​

Get Signature​

get mediaStreamTrack(): MediaStreamTrack

Returns the MediaStreamTrack associated with the stream.

Returns​

MediaStreamTrack

Implementation of​

StageStream.mediaStreamTrack


participantInfo​

Get Signature​

get participantInfo(): StageParticipantInfo

Returns the StageParticipantInfo associated with this stream.

Returns​

StageParticipantInfo


streamType​

Get Signature​

get streamType(): StreamType

Returns the stream type associated with the stream.

Returns​

StreamType

Implementation of​

StageStream.streamType

Methods​

getHighestQualityLayer()​

getHighestQualityLayer(): undefined | StageStreamLayer

Returns the highest quality layer available. Quality here is defined first by dimension, then bitrate, and finally framerate.

For example, a 1080p stream is higher quality than a 720p stream, even if (in the rare case) the 720p stream has a higher bitrate, or framerate.

Returns​

undefined | StageStreamLayer


getLayers()​

getLayers(): StageStreamLayer[]

Returns the list of all current StageStreamLayers. Note that this list will change dynamically over time according to the publishers stream. For example, if the publisher only is able to send two layers (e.g. low, mid) and stops sending hi, then this method will only list the available layers for selection.

Returns​

StageStreamLayer[]


getLowestQualityLayer()​

getLowestQualityLayer(): undefined | StageStreamLayer

Returns the lowest quality layer available. Quality here is defined first by dimension, then bitrate, and finally framerate.

For example, a 180p stream is lower quality than a 360p stream, even if (in the rare case) the 180p stream has a higher bitrate, or framerate.

Returns​

undefined | StageStreamLayer


getSelectedLayer()​

getSelectedLayer(): undefined | StageStreamLayer

Return the currently selected layer. If the publisher is not sending multiple simulcast layers, then no layer will be returned.

If the publisher stops sending the selected layer, the server will attempt to select the next best layer, which will be notified via the RemoteStageStreamEvents.LAYER_SELECTED.

Use this value in conjunction with the RemoteStageStream.isAdapting flag to determine whether the selected layer is associated with Dynamic Simulcast or have been manually selected.

For example:

  • isAdapting === true --> getSelectedLayer is server selected layer
  • isAdapting === false --> getSelectedLayer is app selected layer

Returns​

undefined | StageStreamLayer


getStats()​

getStats(): Promise<undefined | RTCStatsReport>

This API is the previous internal API and now just defers internally to the requestRTCStats.

Returns​

Promise<undefined | RTCStatsReport>

Deprecated​

Implementation of​

StageStream.getStats


hasListenersFor()​

hasListenersFor<Event>(event): boolean

Returns a boolean indicating whether an event has actively registered listeners.

Type Parameters​

Type Parameter
Event extends keyof RemoteStageStreamEventMap

Parameters​

ParameterTypeDescription
eventEventthe event to register the callback for

Returns​

boolean

Implementation of​

StageStream.hasListenersFor

Inherited from​

TypedEmitter.hasListenersFor


off()​

off<Event>(event, callback, context?): void

Deregister a new callback based on the event provided. The events enum is either linked in the EventMap type or in the root of the class.

Type Parameters​

Type Parameter
Event extends keyof RemoteStageStreamEventMap

Parameters​

ParameterTypeDescription
eventEventthe event to de-register the callback for
callbackRemoteStageStreamEventMap[Event]the callback to be de-registered
context?any-

Returns​

void

Implementation of​

StageStream.off

Inherited from​

TypedEmitter.off


on()​

on<Event>(event, callback, context?): void

Register a new callback based on the event provided. The events enum is either linked in the EventMap type or in the root of the class.

Type Parameters​

Type Parameter
Event extends keyof RemoteStageStreamEventMap

Parameters​

ParameterTypeDescription
eventEventthe event to register the callback for
callbackRemoteStageStreamEventMap[Event]the callback to be invoked for the event
context?any-

Returns​

void

Implementation of​

StageStream.on

Inherited from​

TypedEmitter.on


requestQualityStats()​

requestQualityStats(): Promise<undefined | RemoteAudioStats[] | RemoteVideoStats[]>

Request quality statistics for the remote stream.

This method provides access to detailed WebRTC statistics for the remote stream, including network quality, packet received and lost, jitter, and frame-related metrics.

Returns​

Promise<undefined | RemoteAudioStats[] | RemoteVideoStats[]>

A promise that resolves to an array of RemoteAudioStats or RemoteVideoStats depending on the stream type, or undefined if statistics are not available


requestRTCStats()​

requestRTCStats(): Promise<undefined | RTCStatsReport>

Request a snapshot of the RTCStatsReport from the stream.

Returns​

Promise<undefined | RTCStatsReport>

Implementation of​

StageStream.requestRTCStats