> For a complete documentation index, fetch https://docs.voximplant.ai/llms.txt

# DeviceTrackerHelper (interface)

[Stream](/api-reference/websdk5/stream/overview)

Device tracker helper that simplifies handling audio and video device changes during an active call or conference.

**Methods**

* [attachCall](/api-reference/websdk5/stream/devicetrackerhelper#attachcall)
* [attachConference](/api-reference/websdk5/stream/devicetrackerhelper#attachconference)
* [clear](/api-reference/websdk5/stream/devicetrackerhelper#clear)
* [disableTracker](/api-reference/websdk5/stream/devicetrackerhelper#disabletracker)
* [enableTracker](/api-reference/websdk5/stream/devicetrackerhelper#enabletracker)
* [startPreviewVideo](/api-reference/websdk5/stream/devicetrackerhelper#startpreviewvideo)
* [startSendingVideo](/api-reference/websdk5/stream/devicetrackerhelper#startsendingvideo)
* [stopPreviewVideo](/api-reference/websdk5/stream/devicetrackerhelper#stoppreviewvideo)
* [stopSendingVideo](/api-reference/websdk5/stream/devicetrackerhelper#stopsendingvideo)
* [togglePreviewVideo](/api-reference/websdk5/stream/devicetrackerhelper#togglepreviewvideo)
* [toggleSendingVideo](/api-reference/websdk5/stream/devicetrackerhelper#togglesendingvideo)
* [toggleTracker](/api-reference/websdk5/stream/devicetrackerhelper#toggletracker)

**Properties**

* [audioProcessing](/api-reference/websdk5/stream/devicetrackerhelper#audioprocessing)
* [audioStream](/api-reference/websdk5/stream/devicetrackerhelper#audiostream)
* [bypassAudioProcessing](/api-reference/websdk5/stream/devicetrackerhelper#bypassaudioprocessing)
* [cameraConfig](/api-reference/websdk5/stream/devicetrackerhelper#cameraconfig)
* [cameras](/api-reference/websdk5/stream/devicetrackerhelper#cameras)
* [currentCamera](/api-reference/websdk5/stream/devicetrackerhelper#currentcamera)
* [currentMicrophone](/api-reference/websdk5/stream/devicetrackerhelper#currentmicrophone)
* [currentSpeaker](/api-reference/websdk5/stream/devicetrackerhelper#currentspeaker)
* [enabled](/api-reference/websdk5/stream/devicetrackerhelper#enabled)
* [id](/api-reference/websdk5/stream/devicetrackerhelper#id)
* [isAudioStreamUpdating](/api-reference/websdk5/stream/devicetrackerhelper#isaudiostreamupdating)
* [isPreviewVideoStreamUpdating](/api-reference/websdk5/stream/devicetrackerhelper#ispreviewvideostreamupdating)
* [isVideoStreamUpdating](/api-reference/websdk5/stream/devicetrackerhelper#isvideostreamupdating)
* [microphones](/api-reference/websdk5/stream/devicetrackerhelper#microphones)
* [previewVideoStream](/api-reference/websdk5/stream/devicetrackerhelper#previewvideostream)
* [shouldPreviewVideo](/api-reference/websdk5/stream/devicetrackerhelper#shouldpreviewvideo)
* [shouldSendVideo](/api-reference/websdk5/stream/devicetrackerhelper#shouldsendvideo)
* [speakers](/api-reference/websdk5/stream/devicetrackerhelper#speakers)
* [videoStream](/api-reference/websdk5/stream/devicetrackerhelper#videostream)

## Methods

### attachCall

`attachCall(call: `[`Call`](/api-reference/websdk5/call/call)`): Promise<void>`

Connects a conference instance to the device tracker helper. Only one [Conference](/api-reference/websdk5/conference/conference) or [Call](/api-reference/websdk5/call/call) instance
can be connected to the device helper.

**Parameters**

| Parameter | Type                                       | Requirement | Description   |
| --------- | ------------------------------------------ | ----------- | ------------- |
| `call`    | [`Call`](/api-reference/websdk5/call/call) | Required    | Call instance |

**Returns:** Promise\<void>

### attachConference

`attachConference(conference: `[`Conference`](/api-reference/websdk5/conference/conference)`): Promise<void>`

Connects a conference instance to the device tracker helper. Only one [Conference](/api-reference/websdk5/conference/conference) or [Call](/api-reference/websdk5/call/call) instance
can be connected to the device helper.

**Parameters**

| Parameter    | Type                                                         | Requirement | Description         |
| ------------ | ------------------------------------------------------------ | ----------- | ------------------- |
| `conference` | [`Conference`](/api-reference/websdk5/conference/conference) | Required    | Conference instance |

**Returns:** Promise\<void>

### clear

`clear(): Promise<void>`

Stops all streams managed by the device tracker helper and releases all resources.

**Returns:** Promise\<void>

### disableTracker

`disableTracker(): void`

Disables the helper.

**Returns:** void

### enableTracker

`enableTracker(): void`

Enables the helper.

**Returns:** void

### startPreviewVideo

`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](/api-reference/websdk5/stream/devicetrackerhelper#previewvideostream) is updated.

**Returns:** Promise\<void>

### startSendingVideo

`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](/api-reference/websdk5/stream/devicetrackerhelper#shouldsendvideo) is not changed.

**Returns:** Promise\<void>

### stopPreviewVideo

`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:** Promise\<void>

### stopSendingVideo

`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](/api-reference/websdk5/stream/devicetrackerhelper#shouldsendvideo) is not changed.

**Returns:** Promise\<void>

### togglePreviewVideo

`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:** Promise\<void>

### toggleSendingVideo

`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](/api-reference/websdk5/stream/devicetrackerhelper#shouldsendvideo) is not changed.

**Returns:** Promise\<void>

### toggleTracker

`toggleTracker(): void`

Toggles the helper state (disables it if it is enabled and enables it if it is disabled).

**Returns:** void

## Properties

### audioProcessing

`audioProcessing: `[`Watchable`](/api-reference/websdk5/core/watchable/watchable)`<`[`AudioProcessingType`](/api-reference/websdk5/stream/audioprocessingtype)`>`

Watchable property that allows getting and setting the audio processing type.

### audioStream

`audioStream: `[`ReadonlyWatchable`](/api-reference/websdk5/core/watchable/readonlywatchable)`<null | `[`LocalStream`](/api-reference/websdk5/stream/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

`bypassAudioProcessing: `[`Watchable`](/api-reference/websdk5/core/watchable/watchable)`<boolean>`

Watchable property that indicates if the audio processing should be applied.

Affects only [AudioProcessingType.Balanced](/api-reference/websdk5/stream/audioprocessingtype#balanced) and [AudioProcessingType.Aggressive](/api-reference/websdk5/stream/audioprocessingtype#aggressive) processing types.

### cameraConfig

`cameraConfig: `[`Watchable`](/api-reference/websdk5/core/watchable/watchable)`<`[`VideoConfig`](/api-reference/websdk5/stream/videoconfig)`>`

Watchable property that allows getting and setting the current video configuration for a call or conference.

### cameras

`cameras: `[`ReadonlyWatchable`](/api-reference/websdk5/core/watchable/readonlywatchable)`<`[`InputDevice`](/api-reference/websdk5/stream/inputdevice)`[]>`

Watchable property that allows getting the list of currently available camera devices.

### currentCamera

`currentCamera: `[`Watchable`](/api-reference/websdk5/core/watchable/watchable)`<null | `[`InputDevice`](/api-reference/websdk5/stream/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](/api-reference/websdk5/stream/devicetrackerhelper#shouldsendvideo) is set to false
* [DeviceTrackerHelper.videoStream](/api-reference/websdk5/stream/devicetrackerhelper#videostream) is stopped and set to null
* [DeviceTrackerHelper.shouldPreviewVideo](/api-reference/websdk5/stream/devicetrackerhelper#shouldpreviewvideo) is set to false
* [DeviceTrackerHelper.previewVideoStream](/api-reference/websdk5/stream/devicetrackerhelper#previewvideostream) is stopped and set to null
* [DeviceTrackerHelper.currentCamera](/api-reference/websdk5/stream/devicetrackerhelper#currentcamera) is updated to point to an alternative available camera, with a fallback to null if none remain

### currentMicrophone

`currentMicrophone: `[`Watchable`](/api-reference/websdk5/core/watchable/watchable)`<null | `[`InputDevice`](/api-reference/websdk5/stream/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](/api-reference/websdk5/stream/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](/api-reference/websdk5/stream/devicetrackerhelper#audiostream) is updated with the fallback microphone track and attached to the active call or conference.

### currentSpeaker

`currentSpeaker: `[`Watchable`](/api-reference/websdk5/core/watchable/watchable)`<null | `[`OutputDevice`](/api-reference/websdk5/stream/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](/api-reference/websdk5/stream/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](/api-reference/websdk5/stream/devicetrackerhelper#currentspeaker) is reassigned to another available speaker, or to null if no alternative exists.
* all [Renderer](/api-reference/websdk5/stream/renderer) output devices are updated to reflect the change.

### enabled

`enabled: boolean`

Whether the helper is enabled.

### id

`id: string`

Instance id.

### isAudioStreamUpdating

`isAudioStreamUpdating: `[`ReadonlyWatchable`](/api-reference/websdk5/core/watchable/readonlywatchable)`<boolean>`

Watchable property that allows observing if a local audio stream is currently being updated.

### isPreviewVideoStreamUpdating

`isPreviewVideoStreamUpdating: `[`ReadonlyWatchable`](/api-reference/websdk5/core/watchable/readonlywatchable)`<boolean>`

Watchable property that allows observing if a video stream for a local preview is currently being updated.

### isVideoStreamUpdating

`isVideoStreamUpdating: `[`ReadonlyWatchable`](/api-reference/websdk5/core/watchable/readonlywatchable)`<boolean>`

Watchable property that allows observing if a local video stream is currently being updated.

### microphones

`microphones: `[`ReadonlyWatchable`](/api-reference/websdk5/core/watchable/readonlywatchable)`<`[`InputDevice`](/api-reference/websdk5/stream/inputdevice)`[]>`

Watchable property that allows getting the list of currently available microphone devices.

### previewVideoStream

`previewVideoStream: `[`ReadonlyWatchable`](/api-reference/websdk5/core/watchable/readonlywatchable)`<null | `[`LocalStream`](/api-reference/websdk5/stream/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

`shouldPreviewVideo: `[`Watchable`](/api-reference/websdk5/core/watchable/watchable)`<boolean>`

Watchable property that allows starting or stopping a preview video stream.

### shouldSendVideo

`shouldSendVideo: `[`Watchable`](/api-reference/websdk5/core/watchable/watchable)`<boolean>`

Watchable property that allows getting and setting the video sending status in a call or conference.

### speakers

`speakers: `[`ReadonlyWatchable`](/api-reference/websdk5/core/watchable/readonlywatchable)`<`[`OutputDevice`](/api-reference/websdk5/stream/outputdevice)`[]>`

Watchable property that allows getting the list of currently available speaker devices.

### videoStream

`videoStream: `[`ReadonlyWatchable`](/api-reference/websdk5/core/watchable/readonlywatchable)`<null | `[`LocalStream`](/api-reference/websdk5/stream/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.