interface StreamSession
state
: StateFlow<StreamSessionState>
[Get] |
The current state of the streaming session.
State transitions:
Signature
abstract val state: StateFlow<StreamSessionState> |
videoStream
: Flow<VideoFrame>
[Get] |
Flow of video frames from the streaming session.
Video frames are delivered while the session 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.
Example:
session.capturePhoto().fold(
onSuccess = { photo ->
when (photo) {
is PhotoData.HEIC -> saveHeic(photo.encodedPhoto)
is PhotoData.Bitmap -> displayBitmap(photo.rawBitmap)
}
},
onFailure = { error ->
when (error) {
CaptureError.DeviceDisconnected -> showDeviceError()
CaptureError.NotStreaming -> showStreamingRequired()
CaptureError.CaptureInProgress -> showBusyMessage()
CaptureError.CaptureFailed -> showCaptureError()
}
}
)
Signature
abstract suspend fun capturePhoto(): DatResult<PhotoData, CaptureError> |
close
()
|
Stops video streaming and releases all resources.
Shuts down the streaming pipeline and transitions to CLOSED state. The session cannot be reused after closing.
State transitions: Any state -> STOPPING -> STOPPED -> CLOSED
Signature
abstract fun close() |