API reference

Camera Class

Extends Sendable
Modifiers: const
Consolidated camera capability for a Meta Wearables device.
A Camera owns the camera hardware resource and exposes its child features. It is attached to a DeviceSession via DeviceSession/addCamera(config:) and is automatically stopped when the parent session stops (cascading stop); it can also be stopped individually via stop().
The child features are owned by the camera and share its lifecycle:
- stream — video streaming (and in-stream photo capture).
Stream and Photo compete for the camera hardware and cannot capture simultaneously; the developer is responsible for stopping one before starting the other.
In Swift, create a Camera by first creating and starting a DeviceSession, then calling DeviceSession/addCamera(config:). The returned camera is attached to that device session and stops automatically when the parent device session stops.

Signature

class Camera: Sendable

Properties

state : CameraState
[Get]
The current lifecycle state of this camera.
statePublisher : any Announcer<CameraState>
[Get]
Publisher for camera lifecycle state changes.
stream : Stream
The video streaming child feature, owned by this camera.
Use it to receive real-time camera frames. Its lifecycle is bound to this camera: stopping the camera stops the stream.

Functions

stop ()
Stops this camera and its child features, releasing resources and detaching from the parent session.
After calling stop(), the camera is invalidated and cannot be reused. Calling stop() on an already-stopped camera is a no-op.
Signature
public func stop()