|
1 | 1 | # openFaceCamera |
2 | 2 |
|
3 | | -Use `openFaceCamera` when you need face-aware capture (for example selfie verification, identity checks, or attendance) instead of generic photo capture. |
| 3 | +Use `openFaceCamera` when you need **real-time** face detection — such as selfies, profile photos etc — instead of plain camera access. |
4 | 4 |
|
5 | | -`openFaceCamera` provides guided framing, face validation, and optional auto-capture once the face qualifies. |
| 5 | +It adds face detection, alignment guidance (framing overlay), status messages, and optional **auto-capture** when the face meets quality criteria. |
6 | 6 |
|
7 | | -## When to use this instead of openCamera |
| 7 | +### When to use this instead of `openCamera` |
8 | 8 |
|
9 | | -- You need face alignment guidance before capture. |
10 | | -- You need automatic capture when a valid face is detected. |
11 | | -- You need stricter face quality checks, especially on web via `accuracyConfig`. |
| 9 | +- You want visual guidance to center and align the face before capture |
| 10 | +- You need automatic capture once a valid face is detected |
| 11 | +- You want stricter face quality rules (especially on web with `accuracyConfig`) |
12 | 12 |
|
13 | | -For generic photo/video capture or gallery-first flows, continue using [`openCamera`](/device-capabilities/open-camera). |
| 13 | +### Key Properties |
14 | 14 |
|
15 | | -## Properties |
| 15 | +| Property | Type | Description | |
| 16 | +|------------|--------|-----------------------------------------------------------------------------| |
| 17 | +| id | string | Bind captured result (access via `${yourId.files}`) | |
| 18 | +| onCapture | action | Runs after successful capture (`event.data.files` available) | |
| 19 | +| onError | action | Handles errors (`event.error` available) | |
| 20 | +| options | object | Controls camera lens, UI, auto-capture, resolution, flash, and detection | |
16 | 21 |
|
17 | | -| Property | Type | Description | |
18 | | -| :-------- | :----- | :------------------------------------------------------------------------------ | |
19 | | -| id | string | Camera ID used to bind captured results (for example `${myFaceCamera.files}`). | |
20 | | -| onCapture | action | Executes when an image is captured. Files are available in `event.data.files`. | |
21 | | -| onError | action | Executes on error. Error message is available via `event.error`. | |
22 | | -| options | object | Face camera and detection configuration. | |
| 22 | +### Quick Examples |
23 | 23 |
|
24 | | -## options |
25 | | - |
26 | | -| Property | Type | Description | |
27 | | -| :------------------------ | :------ | :------------------------------------------------------------------------------ | |
28 | | -| initialCamera | string | Which lens to start with: `front` (default), `back` | |
29 | | -| message | string | Message shown above camera preview | |
30 | | -| messageStyle | object | Text style for `message` | |
31 | | -| showControls | boolean | Show/hide all camera controls. Default `true` | |
32 | | -| showCaptureControl | boolean | Show/hide capture button. Default `true` | |
33 | | -| showFlashControl | boolean | Show/hide flash control. Default `true` | |
34 | | -| showCameraLensControl | boolean | Show/hide camera switch control. Default `true` | |
35 | | -| showStatusMessage | boolean | Show/hide face detection status text. Default `true` | |
36 | | -| indicatorShape | string | Face indicator shape: `circle`, `square` | |
37 | | -| autoDisableCaptureControl | boolean | Disable capture while no valid face is detected. Default `false` | |
38 | | -| autoCapture | boolean | Automatically capture when face qualifies. Default `false` | |
39 | | -| imageResolution | string | Capture resolution: `low`, `medium`, `high`, `veryHigh`, `ultraHigh`, `max` | |
40 | | -| defaultFlashMode | string | Initial flash mode: `off` (default), `auto`, `always` | |
41 | | -| orientation | string | Camera orientation: `portraitUp`, `portraitDown`, `landscapeLeft`, `landscapeRight` | |
42 | | -| performanceMode | string | Face detector mode: `fast` (default), `accurate` | |
43 | | -| accuracyConfig | object | Fine-grained face detection thresholds. Web only. | |
44 | | - |
45 | | -## Usage |
46 | | - |
47 | | -### Basic |
| 24 | +**Basic face capture** |
48 | 25 |
|
49 | 26 | ```yaml |
50 | 27 | - Button: |
51 | 28 | label: Open Face Camera |
52 | 29 | onTap: |
53 | 30 | openFaceCamera: |
54 | | - id: myFaceCamera |
| 31 | + id: myFace |
55 | 32 | ``` |
56 | | -
|
57 | | -### Auto-capture |
| 33 | +**Auto-capture verified selfie** |
58 | 34 |
|
59 | 35 | ```yaml |
60 | 36 | - Button: |
61 | | - label: Capture verified selfie |
| 37 | + label: Capture Verified Selfie |
62 | 38 | onTap: |
63 | 39 | openFaceCamera: |
64 | 40 | id: profilePhoto |
65 | 41 | options: |
66 | 42 | initialCamera: front |
67 | 43 | autoCapture: true |
| 44 | + message: "Align your face in the frame" |
68 | 45 | performanceMode: accurate |
69 | | - message: "Align your face" |
70 | 46 | onCapture: |
71 | | - executeCode: |
72 | | - body: | |
73 | | - console.log('Captured face image: ' + profilePhoto.files[0].path); |
| 47 | + showToast: |
| 48 | + message: "Selfie captured!" |
74 | 49 | onError: |
75 | 50 | showToast: |
76 | | - message: "Error capturing image: ${event.error}" |
| 51 | + message: "Capture failed: ${event.error}" |
77 | 52 | ``` |
78 | 53 |
|
79 | | -## Full Reference |
80 | | -
|
81 | | -For complete module setup, advanced `accuracyConfig` fields, and more examples, see [`openFaceCamera` action docs](/actions/open-face-camera). |
| 54 | +To learn more about openCamera functionalities, test it out here in [Ensemble Kitchen Sink](https://studio.ensembleui.com/app/e24402cb-75e2-404c-866c-29e6c3dd7992/screen/iLJkHUPgX3ii9EdQ1D8K) app. |
0 commit comments