Unify Applications
Logo
Camera & Photo Booth

Camera & Photo Booth

Logo

9 mins READ

Camera

The Camera block shows a live camera feed and lets the user capture photos or record video clips. Captured photos are uploaded automatically and exposed as file objects your actions can use. Adding the Recording add-on converts the block from a photo capture surface to a video recorder — with optional auto-start, fixed duration, looping, and audio inclusion. On web apps, a Face Detection add-on can coach the user into a well-framed selfie before allowing the shutter.

unify-applications-camera-and-photo-booth-01-camera-block.png
unify-applications-camera-and-photo-booth-01-camera-block.png

A new Camera block starts on the front camera, mirrored, and fills its container at 100% width and height.

Tip: When to use Camera: Capture a photo as part of a flow — profile pictures, document scans, proof-of-delivery. Record short video clips (with the Recording add-on), hands-free if needed with Auto Record. Gate capture behind face alignment (Face Detection add-on, web only). For picking an existing file rather than capturing, use the File Upload block instead. For a richer mobile capture experience with crop and drawing, use the Photo Booth block.

Warning: In mobile apps the Camera block captures photos only. The Recording add-on is offered but produces no clip, and On Permission Denied and On Face Detected don't fire. Use Photo Booth with Video Mode for video on mobile, and watch {{ id.hasCameraPermission }} for refusals.

Properties

Content

Property

Type

Default

Description

facingMode

"user" | "environment"

user (Front)

Which camera the feed opens with.

mirror

boolean

true

Flips the preview and, on web, the captured photo. Most users expect this for front-camera selfies. Turn it off for back-camera capture (documents, labels) or the text will come out reversed. Has no effect in mobile apps.

showImagePreview

boolean

off

Shows a preview screen after capture so users can review the photo before uploading. Mobile apps only.

addOns.faceDetection

{ orientation, detectFace }

Off

Web apps only. When Detect Face is on, the shutter is hidden until a face is detected, centered, and properly aligned. Shows live coaching messages to the user.

addOns.recording

{ autoRecord, includeAudio, duration, fps, loop, loopIterations }

Off

Converts the block to a video recorder. Auto Record starts on page load (once per visit). Duration stops recording after a fixed millisecond count. Loop restarts recording after each clip; Loop Iterations sets the total clip count.

Appearance

PropertyTypeDefaultDescription
showTorchButtonbooleanfalseTorch on/off toggle. Mobile apps only.
showSwitchCameraButtonbooleanfalseFront/back camera switch. Mobile apps only.
showGalleryButtonbooleanfalseGallery picker button. Mobile apps only.
stylesstyle set100% width, 100% heightBlock dimensions and visibility.

Events

EventTriggerPayload
On Photo CaptureA captured photo finishes uploadingRead from {{ id.uploadedImage }}
On Recording StartRecording begins—
On Recording StopRecording ends—
On Recorded File CaptureA finished video clip is savedRead from {{ id.recordedVideoFile }}
On Permission DeniedUser blocks camera access—
On Face DetectedFace detection finds a face—

Methods

MethodParamsEffect
switchCamerafacingModeToggles to the other camera. Note: the facingMode param is ignored — the method always flips.
startRecording—Starts a video recording.
stopRecording—Stops the active recording.

Exposed State

State keyTypeDescription
{{ id.previewImage }}stringThe last captured image, set immediately at capture.
{{ id.uploadedImage }}objectThe uploaded photo file (name, url, type), set once upload completes.
{{ id.isCameraRecording }}booleanWhether a recording is in progress.
{{ id.recordedVideoFile }}objectThe most recently uploaded video clip.
{{ id.hasCameraPermission }}booleanWhether camera access is granted. Starts true; flips to false on denial.
{{ id.hasGalleryPermission }}booleanWhether gallery access is granted (mobile).

Behavior & Gotchas

Warning: On Photo Capture fires after the upload, not at the shutter. There is a gap between pressing capture and the event firing — on a slow connection this can be several seconds. {{ id.previewImage }} is set immediately at capture; {{ id.uploadedImage }} only arrives on upload success. If the upload fails, the event never fires.

Warning: switchCamera ignores the facingMode param. Calling the method always toggles to the opposite camera regardless of what you pass in the payload. Call it twice to return to the original.

Warning: Recording and face detection are mutually exclusive. If the Recording add-on has Auto Record, Duration, Loop or Loop Iterations set, face detection stops working even when its toggle is on. Recording wins.

Note: Auto Record runs once per page visit. With Auto Record on, the shutter disappears and recording starts once. After the first clip completes, it will not auto-start again. Call startRecording to record another take, or enable Loop with Loop Iterations to chain multiple clips.

Note: Looped recording emits one file per clip. Each finished clip fires On Recording Stop and On Recorded File Capture, then restarts. {{ id.recordedVideoFile }} always holds the latest clip only — save each one in your event handler if you need all clips.

Example: Save a Captured Photo

  1. Add a Camera block to the page. This example calls it camera1.

  2. Add a data source that saves the photo to your object. In its Input tab, set the file field to {{ camera1.uploadedImage }}.

  3. On the Camera block, add a Trigger Data Source action to the On Photo Capture event and pick that data source.

  4. Add a Show Snackbar action after it to confirm the save.

Because On Photo Capture fires only after the upload completes, {{ camera1.uploadedImage }} is always set when the data source runs.

Photo Booth

The Photo Booth block is a richer camera surface for native mobile apps only. It supports both photo and video capture, selectable quality and aspect ratio, a gallery picker, flash control, and optional editing steps — crop and drawing — before the upload. Every capture is uploaded automatically and exposed as a file object in state.

Warning: Native mobile apps only. Photo Booth does not appear in the web block library and has no web fallback. If your app targets web or responsive, use the Camera block instead.

Tip: When to use Photo Booth: Capture photos or short videos inside a mobile flow — ID verification, field inspections, support tickets. Let users annotate a capture before it uploads. For picking existing files without a camera UI, use a File Upload block instead. For web apps, use the Camera block.

Properties

Content

Property

Type

Default

Description

facingMode

"user" | "environment"

user (Front)

Which camera opens first.

quality

"4k" | "fhd" | "hd"

4k

Capture resolution.

aspectRatio

"1_1" | "4_3" | "16_9" | "FULL_SCREEN"

4_3

Frame shape of the capture.

photoMode

boolean

true

Enables photo capture. Mirror option appears when on.

mirror

boolean

On (for new blocks)

Known limitation: has no effect today. The captured photo is not flipped.

videoMode

boolean

false

Enables video recording. Unlocks recording method, FPS and max duration settings.

capture

"single" | "long" (Tap/Hold)

single

Shown as Recording Method. Known limitation: has no effect today. Recording is always tap to start, tap to stop. Visible when Video Mode is on.

fps

30 | 60

30

Recording frame rate. Visible when Video Mode is on.

maxDuration

number (ms)

—

Recording stops automatically at this length. When blank, a recording stops after 60000 ms (60 s). Visible when Video Mode is on.

Add-ons

Add-onAppears whenDescription
View GalleryAlwaysPick an existing photo or video from the device gallery instead of capturing.
Switch CameraAlwaysAdds a front/back switch button to the capture UI.
Flash LightPhoto Mode onAdds a flash toggle to the capture UI.
Photo CropPhoto Mode onOpens a crop editor after capture, before upload.
Drawing SupportPhoto Mode onOpens a drawing/annotation editor after crop (or after capture if no crop), before upload.

Events

Event

Trigger

Payload

On Photo Capture

Photo finishes uploading (after any crop/draw step).

Read from {{ id.uploadedMedia }}

On Recording Start

Video recording begins.

—

On Recording Stop

Video recording ends.

—

On Recorded File Capture

Recorded video finishes uploading.

Read from {{ id.uploadedMedia }}

On Permission Denied

Camera access refused. Note: does not fire in the native runtime — watch {{ id.hasCameraPermission }} instead.

—

Methods

MethodParamsEffect
switchCamerafacingModeToggles to the opposite camera (param is ignored).
startRecording—Starts a video recording programmatically. Video Mode must be on.
stopRecording—Stops the active recording.

Exposed State

State keyTypeDescription
{{ id.previewMedia }}stringLocal preview of the latest capture, set immediately at capture.
{{ id.uploadedMedia }}objectThe uploaded file (URL, name, type), set after upload completes.
{{ id.isCameraRecording }}booleanWhether a video recording is in progress.
{{ id.hasCameraPermission }}booleanWhether camera access is granted.
{{ id.hasGalleryPermission }}booleanWhether gallery access is granted.

Behavior & Gotchas

Warning: On Photo Capture fires only after the upload AND all editing steps. Taking a photo opens crop (if enabled), then drawing (if enabled), then uploads. The event fires after upload completes. Cancelling crop discards the capture. Closing the drawing screen returns to crop when Photo Crop is on; otherwise it discards the capture. No event fires for a discarded capture.

Warning: On Permission Denied does not fire in the native runtime. Camera permission refusals update the state keys but do not invoke the event handler. Watch {{ id.hasCameraPermission }} with a conditional to respond to denial.

Note: Recording and photo editing add-ons are separate. Mirror, Photo Crop, Drawing Support and Flash Light are tied to Photo Mode — they disappear from the inspector when it is off and never affect video recordings.

Note: Known limitations: Mirror and Recording Method appear in the inspector but have no effect today. Photos are never flipped, and recording is always tap to start, tap to stop.

Note: Recording events come in pairs, the file event later. On Recording Start and On Recording Stop wrap the recording itself. On Recorded File Capture fires separately after the video uploads. Use the stop event for UI feedback and the file event to act on the video.

BlockRelationship
ScannerCamera-based code decoding instead of photo/video capture.
File UploadPick existing files without opening a camera.
Audio RecorderRecord audio without video.
MeetingLive video meeting with an AI agent — manages its own camera preview.

For a side-by-side comparison of Camera, Photo Booth, Scanner and Barcode, see Camera, Photo Booth, Scanner & Barcode. Scanner is covered in full in QR Code, Barcode & Scanner.

FAQs

Should I use Camera or Photo Booth for a mobile app?

Use Photo Booth for video, or for richer capture features: crop editors, drawing/annotation, flash control, or combined photo-and-video modes with separate quality and aspect ratio settings. In mobile apps the Camera block captures photos only: the Recording add-on produces no clip, and On Permission Denied and On Face Detected don't fire. Use Camera when you need a cross-platform photo block, or for face detection and recording with loop control on web. Both blocks upload automatically and expose the file in exposed state.

Why does my On Photo Capture action run long after the user taps the shutter?

On Photo Capture fires after the upload completes, not at the moment of capture. On a slow or congested network this can be several seconds. If you need to show immediate feedback, read {{ id.previewImage }} (Camera) or {{ id.previewMedia }} (Photo Booth) — these are set the instant the shutter fires, before the upload begins. Reserve On Photo Capture handlers for the actions that need the final uploaded file URL.

Can I start and stop recording programmatically, without the on-screen button?

Yes. Both Camera and Photo Booth expose startRecording and stopRecording methods you can call from any event using the Trigger Component Method action. For the Camera block, enable the Recording add-on first (recording works in web apps only; in mobile apps the Camera block captures photos only). For Photo Booth, turn on Video Mode. To record automatically without user input, enable Auto Record on the Camera block — it starts once per page visit and you call startRecording to capture additional takes.

The face detection shutter never appears even when I'm looking at the camera — what should I check?

Face detection on the Camera block has two known blockers: (1) it only works on web apps, not mobile; (2) if the Recording add-on has any of Auto Record, Duration, Loop or Loop Iterations set, recording mode takes over and face detection stops working even if its Detect Face toggle is on. Verify you're building a web app and that the Recording add-on has no settings active.

What happens if the user cancels the crop or drawing step in Photo Booth?

Cancelling crop discards the capture. Closing the drawing screen returns to crop when Photo Crop is on; otherwise it discards the capture. For a discarded capture, no upload happens, no event fires, and the uploaded state keys are not updated. The preview may still show the captured frame. Your flow should be designed so the confirmation step only appears after On Photo Capture fires, which guarantees the editing steps were completed and the upload succeeded.