Camera and flashlight

The camera capability keeps sensitive camera work inside the shell. Shared app code asks for availability or capture, while the host owns permissions, preview UI, image capture, camera identifiers, torch control, and platform-specific failure modes.
This reference is for the exact API shape. If you are wiring the feature into an app for the first time, start with the Camera and flashlight guide, then return here when you need operation names, request types, provider contracts, or platform configuration details.

Public API

Item
Value
Effect helper or entrypoint
ctx.effects.camera()
Provider trait or host contract
CameraHost
Test provider or test entrypoint
MemoryCameraHost
Primary request types
CameraPermissionRequest / CameraCaptureRequest / CameraFlashlightRequest
Primary success types
CameraAvailability / CameraPermission / CameraCapture
Error type
CameraError
CLI value
camera

Operations

Method or operation
Purpose
Request
Success
availability
Read camera permission and visible camera devices.
()
CameraAvailability
request_permission
Ask the host to request camera permission.
CameraPermissionRequest
CameraPermission
capture_photo
Capture a still image with selected facing, resolution, format, flash, and quality.
CameraCaptureRequest
CameraCapture
set_flashlight
Enable, disable, or adjust torch intensity where available.
CameraFlashlightRequest
()
cancel_capture
Cancel an active capture flow.
()
()

Provider contract

Register a CameraHost with .with_camera_host(...). Use MemoryCameraHost in tests. A provider should expose availability, permission, capture, flashlight, and cancellation separately so apps can degrade gracefully.
CameraCapture returns a DataStreamId plus metadata such as content type, byte length, dimensions, and camera id. The provider should register the image stream through CapabilityCtx::register_data_stream(...); app reducers should pass that handle to a job or service if they need to consume the captured bytes.
Providers should return typed errors for unsupported operations, denied permissions, unavailable hardware, cancellation, timeouts, and platform policy restrictions. Silent success is not acceptable because reducers need a truthful result to update state and explain what happened.

Platform configuration

The CLI adds Android camera permission and optional camera/front/flash features. iOS receives NSCameraUsageDescription. Desktop targets need a provider and packaged apps may need macOS camera usage text or Windows webcam capability metadata.
When a CLI value exists, fission add-capability <value> --project-dir . records the capability in fission.toml and updates generated target files where Fission can do that deterministically. Android generated configuration lives in platforms/android/AndroidManifest.xml. iOS generated configuration lives in platforms/ios/Info.plist and platforms/ios/Entitlements.plist when entitlements are required. Desktop package metadata is reviewed during packaging because Windows, macOS, and Linux use different permission and distribution systems.

Runtime behavior

Capability calls are queued from reducers through ctx.effects. The active shell resolves the request with the registered provider and then dispatches the configured success or error action. Missing providers should produce typed unsupported errors. Packaging mistakes usually show up as denied permissions, missing entitlements, missing route registration, or provider-specific failures.
Fission
A cross-platform, GPU-accelerated user interface framework for Rust. MIT licensed.
Copyright (c) 2026 Fission
Ready to use today. Widget APIs are expected to remain stable; some runtime and shell APIs may change before 1.0.0.
Fission 0.7.0