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
activeAudioTrack(): number
Gets the track ID of an active audio track or -1 if there is none.
Returns
- type:- number 
activeVideoTrack
activeVideoTrack(): number
Gets the track ID of an active video track or -1 if there is none.
Returns
- type:- number 
addEventListener
addEventListener(event: , 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
- event:- Event class (i.e., StreamingAgentEvents.Connected) 
- callback:- Function - Handler function. A single parameter is passed - object with event information 
Returns
- type:- void 
audioTracks
audioTracks(): Gets the list of all current audio tracks.
Returns
- type:
id
id(): string
Returns the StreamingAgent's id.
Returns
- type:- string 
removeEventListener
removeEventListener(event: , callback: Function
): void
Removes a handler for the specified StreamingAgentEvents event.
Parameters
- event:- Event class (i.e., StreamingAgentEvents.Connected) 
- callback:- Function Optional- Optional. Handler function. If not specified, all handler functions are removed 
Returns
- type:- void 
setActiveTrack
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
stop(): void
Stops streaming. Triggers the StreamStopped event. Do not call any other streaming methods after a StreamingAgent.stop call.
Returns
- type:- void 
videoTracks
videoTracks(): Gets the list of all current video tracks.
Returns
- type: