DeviceTrackerHelper
Device tracker helper that simplifies handling audio and video device changes during an active call or conference.
Methods
attachCall(call: ): Promise<void>
Connects a conference instance to the device tracker helper. Only one Conference or Call instance can be connected to the device helper.
Parameters
call:
Call instance
Returns
type:
Promise<void>
attachConference(conference: ): Promise<void>
Connects a conference instance to the device tracker helper. Only one Conference or Call instance can be connected to the device helper.
Parameters
conference:
Conference instance
Returns
type:
Promise<void>
clear(): Promise<void>
Stops all streams managed by the device tracker helper and releases all resources.
Returns
type:
Promise<void>
disableTracker(): void
Disables the helper.
Returns
type:
void
enableTracker(): void
Enables the helper.
Returns
type:
void
startPreviewVideo(): Promise<void>
Creates a local video stream for the local preview.
Returns a promise that is resolved when the operation is completed.
If the operation is completed successfully, DeviceTrackerHelper.previewVideoStream is updated.
Returns
type:
Promise<void>
startSendingVideo(): Promise<void>
Starts sending video to a call or conference.
Returns a promise that is resolved when the operation is completed.
This method does not throw an error in case of a failure, however, in this case DeviceTrackerHelper.shouldSendVideo is not changed.
Returns
type:
Promise<void>
stopPreviewVideo(): Promise<void>
Closes a local video stream created for the local preview and releases its resources.
Returns a promise that is resolved when the operation is completed.
Returns
type:
Promise<void>
stopSendingVideo(): Promise<void>
Stops sending video to a call or conference.
Returns a promise that is resolved when the operation is completed.
This method does not throw an error in case of a failure, however, in this case DeviceTrackerHelper.shouldSendVideo is not changed.
Returns
type:
Promise<void>
togglePreviewVideo(): Promise<void>
Creates or closes a local video stream for the local preview.
Returns a promise that is resolved when the operation is completed.
Returns
type:
Promise<void>
toggleSendingVideo(): Promise<void>
Toggles the video sending state in a call or conference (starts sending video if the video is not sent or stops sending video if it is currently being sent).
Returns a promise that is resolved when the operation is completed.
This method does not throw an error in case of a failure, however, in this case DeviceTrackerHelper.shouldSendVideo is not changed.
Returns
type:
Promise<void>
toggleTracker(): void
Toggles the helper state (disables it if it is enabled and enables it if it is disabled).
Returns
type:
void
Props
audioProcessing: Watchable property that allows getting and setting the audio processing type.
audioStream: ReadonlyWatchable<null | LocalStream>
Watchable property that allows getting the currently active local audio stream and observe its changes.
The audio stream updates if:
- the audio processing type changed
- the current microphone has changed
- the current microphone has been detached from the device
- a new headset attached
bypassAudioProcessing: Watchable<boolean>
Watchable property that indicates if the audio processing should be applied.
Affects only AudioProcessingType.Balanced and AudioProcessingType.Aggressive processing types.
cameraConfig: Watchable property that allows getting and setting the current video configuration for a call or conference.
cameras: Watchable property that allows getting the list of currently available camera devices.
currentCamera: Watchable<null | InputDevice>
Watchable property that allows getting and setting the currently active camera.
When a new camera connects, camera selection remains unchanged (no automatic switch occurs).
When the active camera disconnects:
- DeviceTrackerHelper.shouldSendVideo is set to false
- DeviceTrackerHelper.videoStream is stopped and set to null
- DeviceTrackerHelper.shouldPreviewVideo is set to false
- DeviceTrackerHelper.previewVideoStream is stopped and set to null
- DeviceTrackerHelper.currentCamera is updated to point to an alternative available camera, with a fallback to null if none remain
currentMicrophone: Watchable<null | InputDevice>
Watchable property that allows getting and setting and changing the currently active microphone.
When a new microphone is connected:
- audio routing automatically switches to the new microphone (excluding microphones paired with a camera).
- DeviceTrackerHelper.audioStream is updated with the new microphone track and attached to active calls or conferences.
When the active microphone is disconnected:
- the current audio stream stops and is removed from any active call or conference.
- a fallback available microphone is selected automatically.
- DeviceTrackerHelper.audioStream is updated with the fallback microphone track and attached to the active call or conference.
currentSpeaker: Watchable<null | OutputDevice>
Watchable property that allows getting and setting the currently active speaker.
When a new speaker is connected:
- audio routing is automatically switched to the new speaker if it is part of a headset, updating all Renderer output devices.
- no automatic switch is performed if the new device is a standalone speaker (e.g., an HDMI display) and a speaker is already active.
- the new speaker is selected automatically if no active speaker was previously selected.
When the active speaker is disconnected:
- DeviceTrackerHelper.currentSpeaker is reassigned to another available speaker, or to null if no alternative exists.
- all Renderer output devices are updated to reflect the change.
enabled: boolean
Whether the helper is enabled.
id: string
Instance id.
isAudioStreamUpdating: ReadonlyWatchable<boolean>
Watchable property that allows observing if a local audio stream is currently being updated.
isPreviewVideoStreamUpdating: ReadonlyWatchable<boolean>
Watchable property that allows observing if a video stream for a local preview is currently being updated.
isVideoStreamUpdating: ReadonlyWatchable<boolean>
Watchable property that allows observing if a local video stream is currently being updated.
microphones: Watchable property that allows getting the list of currently available microphone devices.
previewVideoStream: ReadonlyWatchable<null | LocalStream>
Watchable property that allows getting a video stream preview.
The preview video stream is not sending in a call or conference, but may be used to show the local preview before a call or conference starts or in the video settings of the active call or conference.
shouldPreviewVideo: Watchable<boolean>
Watchable property that allows starting or stopping a preview video stream.
shouldSendVideo: Watchable<boolean>
Watchable property that allows getting and setting the video sending status in a call or conference.
speakers: Watchable property that allows getting the list of currently available speaker devices.
videoStream: ReadonlyWatchable<null | LocalStream>
Watchable property that allows getting the currently active local video stream and observe its changes.
The video stream is set to null and removed from the call/conference if the current input device detach.