> ## Documentation Index
> Fetch the complete documentation index at: https://docs.daily.co/llms.txt
> Use this file to discover all available pages before exploring further.

# setInputDevicesAsync()

> Switches the local audio or video input to a specific device or custom track.

`setInputDevicesAsync(devices)`

✓ Prebuilt✓ Custom

Switches the local audio or video input device during a call. You can specify a device by its ID (from [`enumerateDevices()`](https://docs.daily.co/reference/daily-js/instance-methods/enumerate-devices)) or provide a raw [`MediaStreamTrack`](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) directly.

This is a convenience wrapper around [`updateInputSettings()`](https://docs.daily.co/reference/daily-js/instance-methods/update-input-settings) for device switching — it emits an [`input-settings-updated`](https://docs.daily.co/reference/daily-js/events/settings-events#input-settings-updated) event on success.

## Parameters

**audioDeviceId** `string | false | null`

* `string` — ID of the audio input device to use, as returned by `enumerateDevices()`
* `false` — locally locks the mic off (see note below)
* `null` — no-op; no change is made

**audioSource** `MediaStreamTrack | false`

* `MediaStreamTrack` — use this track directly as the audio input, bypassing device selection
* `false` — locally locks the mic off (see note below)

If provided, takes precedence over `audioDeviceId`.

**videoDeviceId** `string | false | null`

* `string` — ID of the video input device to use, as returned by `enumerateDevices()`
* `false` — locally locks the camera off (see note below)
* `null` — no-op; no change is made

**videoSource** `MediaStreamTrack | false`

* `MediaStreamTrack` — use this track directly as the video input, bypassing device selection
* `false` — locally locks the camera off (see note below)

If provided, takes precedence over `videoDeviceId`.

> [!NOTE]
>
> **Locally locking a device off**
>
> Passing `false` is distinct from calling `setLocalAudio(false)` or `setLocalVideo(false)`. Those *mute* the track — it can be re-enabled. Passing `false` here *prevents Daily from acquiring or re-acquiring the track entirely*. `setLocalAudio(true)` / `setLocalVideo(true)` will have no effect until you pass a device ID, a `MediaStreamTrack`, or `true` back.
>
> This is a local-only restriction — the server has no knowledge of it. Use it to enforce device policy in your UI without relying on server-side permissions.

## Return value

Returns a `Promise<DailyDeviceInfos>` with the active camera, mic, and speaker. Fields will be an empty object `{}` if the device is unspecified, unacquired, or replaced by a custom track.

## Example

```javascript theme={null}
// Switch to a specific camera by device ID
const { devices } = await call.enumerateDevices();
const rearCamera = devices.find(d => d.kind === 'videoinput' && d.facing === 'environment');
await call.setInputDevicesAsync({ videoDeviceId: rearCamera.deviceId });

// Use a custom video track
await call.setInputDevicesAsync({
  videoSource: myCanvasStream.getVideoTracks()[0],
});
```

## See also

> [card] Types
>
> * [DailyCallOptions: inputSettings](https://docs.daily.co/reference/daily-js/types/daily-call-options.md#param-input-settings)
> * [DailyCallOptions: audioSource](https://docs.daily.co/reference/daily-js/types/daily-call-options.md#param-audio-source)
> * [DailyCallOptions: videoSource](https://docs.daily.co/reference/daily-js/types/daily-call-options.md#param-video-source)

> [card] Methods
>
> * [enumerateDevices()](https://docs.daily.co/reference/daily-js/instance-methods/enumerate-devices.md)
> * [getInputDevices()](https://docs.daily.co/reference/daily-js/instance-methods/get-input-devices.md)
> * [updateInputSettings()](https://docs.daily.co/reference/daily-js/instance-methods/update-input-settings.md)
> * [setOutputDeviceAsync()](https://docs.daily.co/reference/daily-js/instance-methods/set-output-device-async.md)

> [card] Events
>
> * [input-settings-updated](https://docs.daily.co/reference/daily-js/events/settings-events.md#input-settings-updated)
> * [selected-devices-updated](https://docs.daily.co/reference/daily-js/events/settings-events.md#selected-devices-updated)

> [card] Guides
>
> * [Audio and video](https://docs.daily.co/docs/daily-js/guides/audio-video.md)
> * [Device permissions](https://docs.daily.co/docs/daily-js/guides/device-permissions.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.