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

# setCamera

> Play a video file as the simulator camera feed.

Feeds a video file into the camera of the simulator, so the app under test sees
the video instead of a blank camera. Use it to test flows like QR code scanning
or document capture.

This command runs only on Momentic-hosted iOS simulators. It is not supported on
Android or on local simulators.

## Parameters

| Parameter | Type      | Required | Description                                                       |
| --------- | --------- | -------- | ----------------------------------------------------------------- |
| `path`    | `string`  | Yes      | Path to the video file on the host. May be a local path or a URL. |
| `loop`    | `boolean` | No       | Repeat the video until it is cleared. Defaults to `true`.         |
| `saveAs`  | `string`  | No       | Variable to store this step's return value on `env.<name>`.       |
| `retries` | `number`  | No       | Times to retry the step on failure before failing the test.       |
| `skipped` | `boolean` | No       | Skip this step at execution time.                                 |

Use an `.mp4`, `.mov`, or `.m4v` file with a decodable video track.

## Examples

Simplified form:

```yaml theme={null}
- setCamera: ./fixtures/qr-code.mp4
```

Detailed form, with a single pass instead of a loop:

```yaml theme={null}
- setCamera:
    path: ./fixtures/qr-code.mp4
    loop: false
```

The camera feed stays active until you change it or clear it. Put the step in
`before` to keep one feed active for the whole test:

```yaml theme={null}
before:
  - setCamera: ./fixtures/qr-code.mp4
steps:
  - tap: Scan code
  - checkScreenContains: Code accepted
```

You can also change the feed during a test:

```yaml theme={null}
steps:
  - setCamera: ./fixtures/first-code.mp4
  - tap: Scan code
  - setCamera: ./fixtures/second-code.mp4
  - tap: Scan again
  - clearCamera
```

## Related

* [`clearCamera`](/docs/reference/mobile-commands/clear-camera)
* [`setMicrophone`](/docs/reference/mobile-commands/set-microphone)
* [YAML format](/docs/core-concepts/test-format)
