Skip to main content
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()) or provide a raw MediaStreamTrack directly. This is a convenience wrapper around updateInputSettings() for device switching — it emits an 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.
Locally locking a device offPassing 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

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