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

# setCamera()

> Switch to a specific camera on a mobile device by device ID.

`setCamera(cameraDeviceId)`

Switches the local camera stream to the device identified by `cameraDeviceId`. The `cameraDeviceId` should match a `deviceId` value returned by [`enumerateDevices()`](/reference/react-native/instance-methods/enumerate-devices).

Because [`enumerateDevices()`](/reference/react-native/instance-methods/enumerate-devices) classifies cameras by their `facing` value (`'user'` or `'environment'`), this method can be used to switch between front and rear cameras. Has no effect if `cameraDeviceId` matches the camera already in use.

This method can only be invoked while video is unmuted.

## Parameters

<ParamField body="cameraDeviceId" type="string" required>
  The `deviceId` of the camera to switch to. Must match a `deviceId` from [`enumerateDevices()`](/reference/react-native/instance-methods/enumerate-devices).
</ParamField>

## Return value

Returns a `Promise<{ device: { facingMode: DailyCameraFacingMode } | null }>` with the newly active camera's facing mode (`'user'` or `'environment'`), or `null` if no device was found.

## Example

```javascript theme={null}
const { devices } = await call.enumerateDevices();
const rearCamera = devices.find(
  (d) => d.kind === 'videoinput' && d.facing === 'environment'
);
if (rearCamera) {
  await call.setCamera(rearCamera.deviceId);
}
```

## See also

<CardGroup>
  <Card title="Methods" icon="code" iconType="solid">
    * [cycleCamera()](/reference/react-native/instance-methods/cycle-camera)
    * [getCameraFacingMode()](/reference/react-native/instance-methods/get-camera-facing-mode)
    * [enumerateDevices()](/reference/react-native/instance-methods/enumerate-devices)
  </Card>

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