Skip to main content
Version: v1.27.0

LocalStageStream

A LocalStageStream is a wrapper for media coming from local participants. It gives you the ability to perform various actions like mute and unmute participants.

Extends

Constructors

new LocalStageStream()

new LocalStageStream(track, config?): LocalStageStream

Creates an instance of a LocalStageStream

Parameters

ParameterTypeDescription
trackMediaStreamTrackThe MediaStreamTrack that this LocalStageStream wraps
config?StageVideoConfiguration | StageAudioConfigurationOptional video or audio configuration on the stage

Returns

LocalStageStream

Overrides

StageStream.constructor

Properties

id

id: string

Inherited from

StageStream.id


isMuted

isMuted: boolean

Inherited from

StageStream.isMuted


mediaConfig

mediaConfig: StageStreamConfiguration


mediaStreamTrack

mediaStreamTrack: MediaStreamTrack

Inherited from

StageStream.mediaStreamTrack


streamType

streamType: StreamType

Inherited from

StageStream.streamType

Methods

cleanup()

cleanup(): void

Prevents the getStats closure from preventing garbage collection for

Returns

void

Inherited from

StageStream.cleanup


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

Inherited from

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 LocalStageStreamEventMap

Parameters

ParameterTypeDescription
eventEventthe event to register the callback for

Returns

boolean

Inherited from

StageStream.hasListenersFor


insertSeiMessage()

insertSeiMessage(payload, options?): Promise<void>

Inserts an SEI payload into the published stream. The stream must be currently published by a stage's local participant using the H.264 codec, and the inBandMessaging configuration must enabled via the LocalStageStream's StageVideoConfiguration.

The payload size must be greater than 0KB and less than 1KB, and the number of SEI messages inserted must not exceed 10KB per second. Messages are not guaranteed to arrive, especially in bad network conditions.

Parameters

ParameterTypeDescription
payloadArrayBufferThe ArrayBuffer payload.
options?objectOptions for the insert operation.
options.repeatCount?numberThe number of times to repeat the SEI message. Must be between 0 and 30.

Returns

Promise<void>

A Promise that resolves to undefined.


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 LocalStageStreamEventMap

Parameters

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

Returns

void

Inherited from

StageStream.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 LocalStageStreamEventMap

Parameters

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

Returns

void

Inherited from

StageStream.on


requestQualityStats()

requestQualityStats(): Promise<undefined | LocalAudioStats[] | LocalVideoStats[]>

Request quality statistics for the local stream.

This method provides access to detailed WebRTC statistics for the local stream, including network quality, packets sent and lost, bitrate, and frame-related metrics.

Note that in Firefox and Safari the API will report the networkQuality as either NORMAL or OFFLINE. Safari's offline event is slower to fire.

Returns

Promise<undefined | LocalAudioStats[] | LocalVideoStats[]>

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


requestRTCStats()

requestRTCStats(): Promise<undefined | RTCStatsReport>

Get the RTC Stats report for this media source

Returns

Promise<undefined | RTCStatsReport>

Inherited from

StageStream.requestRTCStats


setMuted()

setMuted(mute): void

Updates the mute state of this LocalStageStream

Parameters

ParameterTypeDescription
mutebooleanThe desired mute state of this LocalStageStream

Returns

void