API reference

Camera Interface

Extends Closeable
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 session via DeviceSession.addCamera and automatically stopped when the parent session stops (cascading stop); it can also be stopped individually via Camera.stop or removed via DeviceSession.removeCamera.
The child features are owned by the camera and share its lifecycle:
Stream and Photo compete for the camera hardware and cannot capture simultaneously; the developer is responsible for stopping one before starting the other.

See Also

Signature

interface Camera : Closeable

Properties

state : StateFlow<CameraState>
[Get]
The current lifecycle state of this camera.
Starts at CameraState.STARTED once attached, and transitions through CameraState.STOPPING to CameraState.STOPPED when the camera or its owning session is stopped. CameraState.STARTING is reserved for a future consolidated startup lifecycle and is not currently emitted.
Signature
abstract val state: StateFlow<CameraState>
stream : Stream
[Get]
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.
Signature
abstract val stream: Stream

Methods

close ()
Signature
abstract override fun close()
stop ()
Stops this camera and its child features, releasing resources and detaching from the parent session.
After calling Camera.stop, the camera is invalidated and cannot be reused. Calling Camera.stop on an already-stopped camera is a no-op. Camera.close delegates to Camera.stop for Closeable compatibility.
Signature
abstract fun stop()