interface Stream : Capability
errorStream
: Flow<StreamError>
[Get] |
Flow of errors from the streaming session.
Emits StreamError values when error conditions occur during streaming. Non-critical errors (e.g., StreamError.STREAM_ERROR) are informational and do not stop the stream, while critical errors (e.g., StreamError.CRITICAL_STREAM_ERROR) indicate the stream should be terminated.
Signature
abstract val errorStream: Flow<StreamError> |
state
: StateFlow<StreamState>
[Get] |
The current state of the streaming session.
State transitions:
Signature
abstract val state: StateFlow<StreamState> |
videoStream
: Flow<VideoFrame>
[Get] |
Flow of video frames from the streaming session.
Video frames are delivered while the stream is in STREAMING state. The flow automatically handles buffer overflow by dropping the oldest frames to ensure smooth streaming.
Signature
abstract val videoStream: Flow<VideoFrame> |
capturePhoto
()
|
Captures a still photo during active video streaming.
Triggers a photo capture while video streaming is active. Only one capture can be in progress at a time—attempting a second capture while one is pending returns CaptureError.CaptureInProgress.
Signature
abstract suspend fun capturePhoto(): DatResult<PhotoData, CaptureError> |
close
()
|
Signature
abstract override fun close() |
start
()
|
Starts the stream, activating the camera on glasses and beginning the streaming pipeline.
Call this after obtaining a Stream from Session.addStream. The addStream() call registers the stream capability, while start() activates the camera and begins video frame delivery.
Signature
abstract fun start(): DatResult<Unit, StreamError> |
stop
()
|
Stops this capability, releasing its resources and removing it from the parent session.
After calling Capability.stop, the capability is invalidated and cannot be reused. The parent session's capability slot is released, allowing a new capability of the same type to be added.
Calling Capability.stop on an already-stopped capability is a no-op.
Signature
abstract fun stop() |