Skip to main content
Version: v1.19.0

StageStrategy

A StageStrategy dictates certain behavior on the Stage

Methods

preferredLayerForStream()?

optional preferredLayerForStream(participant, stream): undefined | string | StageStreamLayer

Optionally return the preferred stream layer for a given participant. If defined, the returned StageStreamLayer will be used to change what video layer is delivered. This is used when a Publisher is sending Simulcast Layers, and allows the Subscriber to choose between those layers.

The strategy method can return:

  • The layer object directly based on what RemoteStageStream.getLayers returns
  • The layer object label string based on StageStreamLayer.label
  • Undefined or null, which indicates that no layer should be selected, and dynamic adaption is preferred

Parameters

ParameterType
participantStageParticipantInfo
streamRemoteStageStream

Returns

undefined | string | StageStreamLayer


shouldPublishParticipant()

shouldPublishParticipant(participant): boolean

Should return true if you wish to publish to the Stage Otherwise return false.

Parameters

ParameterType
participantStageParticipantInfo

Returns

boolean


shouldSubscribeToParticipant()

shouldSubscribeToParticipant(participant): SubscribeType

Should return whether or not you wish to subscribe to a given participant. Return SubscribeType.AUDIO_VIDEO to subscribe to audio and video. Return SubscribeType.AUDIO_ONLY to subscribe to just audio. Return SubscribeType.NONE to not subscribe at all. This will be invoked after a new participant joins or against every participant when Stage.refreshStrategy is called

Parameters

ParameterType
participantStageParticipantInfo

Returns

SubscribeType


stageStreamsToPublish()

stageStreamsToPublish(): LocalStageStream[]

Should return the local streams that should be published to the stage. This will be invoked during the Stage.join call and every subsequent Stage.refreshStrategy call. This will not be invoked if StageStrategy.shouldPublishParticipant returns false

Returns

LocalStageStream[]


subscribeConfiguration()?

optional subscribeConfiguration(participant): SubscribeConfiguration

Optionally return the subscribe configuration for a given participant. If given, the returned SubscribeConfiguration will be merged against SDK default values. If not given, the default values will be applied.

Parameters

ParameterType
participantStageParticipantInfo

Returns

SubscribeConfiguration