Rate this page:

StreamingAgent

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

Copy URL
activeAudioTrack(): 

number

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

Returns

  • type:

    number

activeVideoTrack

Copy URL
activeVideoTrack(): 

number

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

Returns

  • type:

    number

addEventListener

Copy URL
addEventListener(event: 

StreamingAgentEvents

,
callback:

Function

):

void

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.

Parameters

Returns

  • type:

    void

audioTracks

Copy URL
audioTracks(): 

number[]

Gets the list of all current audio tracks.

Returns

  • type:

    number[]

removeEventListener

Copy URL
removeEventListener(event: 

StreamingAgentEvents

,
callback:

Function

):

void

Removes a handler for the specified StreamingAgentEvents event.

Parameters

Returns

  • type:

    void

setActiveTrack

Copy URL
setActiveTrack(tracks: 

{audioTrack: number | undefined, videoTrack: number | undefined}

):

void

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.

Parameters

  • tracks:

    {audioTrack: number | undefined, videoTrack: number | undefined}

    Audio and video track to set as active

Returns

  • type:

    void

stop

Copy URL
stop(): 

void

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

Returns

  • type:

    void

videoTracks

Copy URL
videoTracks(): 

number[]

Gets the list of all current video tracks.

Returns

  • type:

    number[]