> ## 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)`

<Badge color="green">{"✓"} Prebuilt</Badge> <Badge color="green">{"✓"} Custom</Badge>

Switches the local audio or video input device during a call. You can specify a device by its ID (from [`enumerateDevices()`](/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()`](/reference/daily-js/instance-methods/update-input-settings) for device switching — it emits an [`input-settings-updated`](/reference/daily-js/events/settings-events#input-settings-updated) event on success.

## Parameters

<ParamField body="audioDeviceId" type="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
</ParamField>

<ParamField body="audioSource" type="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`.
</ParamField>

<ParamField body="videoDeviceId" type="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
</ParamField>

<ParamField body="videoSource" type="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`.
</ParamField>

<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.
</Note>

## 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

<CardGroup>
  <Card title="Types" icon="t" iconType="solid">
    * [DailyCallOptions: inputSettings](/reference/daily-js/types/daily-call-options#param-input-settings)
    * [DailyCallOptions: audioSource](/reference/daily-js/types/daily-call-options#param-audio-source)
    * [DailyCallOptions: videoSource](/reference/daily-js/types/daily-call-options#param-video-source)
  </Card>

  <Card title="Methods" icon="code" iconType="solid">
    * [enumerateDevices()](/reference/daily-js/instance-methods/enumerate-devices)
    * [getInputDevices()](/reference/daily-js/instance-methods/get-input-devices)
    * [updateInputSettings()](/reference/daily-js/instance-methods/update-input-settings)
    * [setOutputDeviceAsync()](/reference/daily-js/instance-methods/set-output-device-async)
  </Card>

  <Card title="Events" icon="bolt" iconType="solid">
    * [input-settings-updated](/reference/daily-js/events/settings-events#input-settings-updated)
    * [selected-devices-updated](/reference/daily-js/events/settings-events#selected-devices-updated)
  </Card>

  <Card title="Guides" icon="book-open" iconType="solid">
    * [Audio and video](/docs/daily-js/guides/audio-video)
    * [Device permissions](/docs/daily-js/guides/device-permissions)
  </Card>
</CardGroup>
