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's none.

Returns

  • type:

    number

activeVideoTrack

Copy URL
activeVideoTrack(): 

number

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

Returns

  • type:

    number

addEventListener

Copy URL
addEventListener(event: 

StreamingAgentEvents

,
callback:

Function

):

void

Adds a handler for the specified event triggered by a streaming object.

Parameters

  • Streaming event, e.g., StreamError.

  • callback:

    Function

    Handler function that can take one parameter – the object with event information

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 event triggered by a streaming object.

Parameters

  • Streaming event, e.g., StreamError.

  • callback:

    Function

    Optional

    Handler function that can take one parameter – the object with event information

Returns

  • type:

    void

setActiveTrack

Copy URL
setActiveTrack(tracks: 

{audioTrack: number, videoTrack: number}

):

void

Sets a certain audio and/or video track as active. If an active video track is set, it won't be 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, videoTrack: number}

    Audio and video track to set as active.

Returns

  • type:

    void

stop

Copy URL
stop(): 

void

Stops streaming. Triggers the StreamStopped event. You must 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[]