StreamingAgent

Represents a streaming object to interact with streaming platforms.
View as Markdown

Represents a streaming object to interact with streaming platforms. Add the following line to your scenario code to use the class:

require(Modules.StreamingAgent);

Methods

activeAudioTrack

Gets the track ID of an active audio track or -1 if there is none.

1activeAudioTrack(): number

activeVideoTrack

Gets the track ID of an active video track or -1 if there is none.

1activeVideoTrack(): number

addEventListener

Adds a handler for the specified StreamingAgentEvents event. Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler is called.

1addEventListener(event: StreamingAgentEvents | T, callback: (event: _StreamingAgentEvents[T]) => any): void

Parameters

event
StreamingAgentEvents | TRequired
callback
(event: _StreamingAgentEvents[T]) => anyRequired

audioTracks

Gets the list of all current audio tracks.

1audioTracks(): StreamingAgentTrack[]

id

Returns the StreamingAgent’s id.

1id(): string

removeEventListener

Removes a handler for the specified StreamingAgentEvents event.

1removeEventListener(event: StreamingAgentEvents | T, callback?: (event: _StreamingAgentEvents[T]) => any): void

Parameters

event
StreamingAgentEvents | TRequired
callback
(event: _StreamingAgentEvents[T]) => any

setActiveTrack

Sets a certain audio and/or video track as active. If an active video track is set, it is not replaced by the new one unlike in the default mode. Default mode: The active video track is the one that started sending data last. The active audio track is always the first one. To return to the default mode, set the track IDs equal to -1.

1setActiveTrack(tracks: { audioTrack?: number; videoTrack?: number }): void

Parameters

tracks
{ audioTrack?: number; videoTrack?: number }Required

stop

Stops streaming. Triggers the StreamStopped event. Do not call any other streaming methods after a StreamingAgent.stop call.

1stop(): void

videoTracks

Gets the list of all current video tracks.

1videoTracks(): StreamingAgentTrack[]