> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# DeviceController

> Interface for media device management.

Interface for media device management.

Provides reactive access to available media devices, device selection,
and monitoring for device changes (connect/disconnect).

## **Properties**

Current snapshot of available audio input devices. See [`MediaDeviceInfo`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo).

Observable list of available audio input (microphone) devices. See [`MediaDeviceInfo`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo).

Whether audio input is currently disabled.

Observable that emits `true` when audio input is disabled (receive-only).

Current snapshot of available audio output devices. See [`MediaDeviceInfo`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo).

Observable list of available audio output (speaker) devices. See [`MediaDeviceInfo`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo).

Observable that emits when the SDK auto-switches a device due to disconnect, reconnect, or recovery. See [`DeviceRecoveryEvent`](/docs/browser-sdk/v4/reference/interfaces/device-recovery-event).

Observable stream of errors from device enumeration and monitoring.

Currently selected audio input device, or `null` if none. See [`MediaDeviceInfo`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo).

Observable of the currently selected audio input device, or `null` if none. See [`MediaDeviceInfo`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo).

Media track constraints for the selected audio input device. Returns `false` when disabled. See [`MediaTrackConstraints`](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints).

Currently selected audio output device, or `null` if none. See [`MediaDeviceInfo`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo).

Observable of the currently selected audio output device, or `null` if none. See [`MediaDeviceInfo`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo).

Currently selected video input device, or `null` if none. See [`MediaDeviceInfo`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo).

Observable of the currently selected video input device, or `null` if none. See [`MediaDeviceInfo`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo).

Media track constraints for the selected video input device. Returns `false` when disabled. See [`MediaTrackConstraints`](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints).

Current snapshot of available video input devices. See [`MediaDeviceInfo`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo).

Observable list of available video input (camera) devices. See [`MediaDeviceInfo`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo).

Whether video input is currently disabled.

Observable that emits `true` when video input is disabled (receive-only).

## **Methods**

### clearDeviceState()

```ts
clearDeviceState(): Promise<void>
```

Clears all device state (history, selections, persisted prefs) and re-enumerates.

#### Returns

`Promise<void>`

***

### deviceInfoToConstraints()

```ts
deviceInfoToConstraints(deviceInfo): MediaTrackConstraints
```

Converts a MediaDeviceInfo to track constraints suitable for `getUserMedia`.

#### Parameters

The device to convert, or `null` for default constraints. See [`MediaDeviceInfo`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo).

#### Returns

`MediaTrackConstraints`

***

### disableAudioInput()

```ts
disableAudioInput(): void
```

Disables audio input (receive-only mode). No track will be acquired.

#### Returns

`void`

***

### disableDeviceMonitoring()

```ts
disableDeviceMonitoring(): void
```

Stops monitoring for media device changes.

#### Returns

`void`

***

### disableVideoInput()

```ts
disableVideoInput(): void
```

Disables video input (receive-only mode). No track will be acquired.

#### Returns

`void`

***

### enableAudioInput()

```ts
enableAudioInput(): void
```

Re-enables audio input, restoring the last selection or auto-selecting.

#### Returns

`void`

***

### enableDeviceMonitoring()

```ts
enableDeviceMonitoring(): void
```

Starts monitoring for media device changes (connect/disconnect).

#### Returns

`void`

***

### enableVideoInput()

```ts
enableVideoInput(): void
```

Re-enables video input, restoring the last selection or auto-selecting.

#### Returns

`void`

***

### enumerateDevices()

```ts
enumerateDevices(): Promise<void>
```

Force a device re-enumeration.

#### Returns

`Promise<void>`

***

### getDeviceCapabilities()

```ts
getDeviceCapabilities(deviceInfo): Promise<MediaTrackCapabilities | null>
```

Returns the capabilities of a media device.

#### Parameters

The device to query. See [`MediaDeviceInfo`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo).

#### Returns

`Promise<MediaTrackCapabilities | null>`

The device capabilities, or `null` if unavailable.

***

### isValidDevice()

```ts
isValidDevice(deviceInfo): Promise<boolean>
```

Checks whether a device is still available and usable.

#### Parameters

The device to validate, or `null`. See [`MediaDeviceInfo`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo).

#### Returns

`Promise<boolean>`

`true` if the device is valid and available. Returns `false` for `null`, audio output devices, or unavailable devices.

***

### selectAudioInputDevice()

```ts
selectAudioInputDevice(device): void
```

Sets the preferred audio input device for future calls.

#### Parameters

The device to select, or `null` to use the system default. See [`MediaDeviceInfo`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo).

#### Returns

`void`

***

### selectAudioOutputDevice()

```ts
selectAudioOutputDevice(device): void
```

Sets the preferred audio output device for future calls.

#### Parameters

The device to select, or `null` to use the system default. See [`MediaDeviceInfo`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo).

#### Returns

`void`

***

### selectVideoInputDevice()

```ts
selectVideoInputDevice(device): void
```

Sets the preferred video input device for future calls.

#### Parameters

The device to select, or `null` to use the system default. See [`MediaDeviceInfo`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo).

#### Returns

`void`

***

### setStorageManager()

```ts
setStorageManager(storageManager): void
```

Injects the storage manager for device persistence.

#### Parameters

Optional storage manager used to persist device selections.

#### Returns

`void`