StreamSession

interface StreamSession

Manages a single connection and stream for publishing or playback.

Register a protocol-specific StreamSessionFactory with Builder.registerFactory, then create a session with Builder. Observe readyState for connection state changes.

Types

Link copied to clipboard
class Builder(context: Context, uri: Uri)

Builds a session using a factory registered for the URI scheme.

Link copied to clipboard

Represents the type of session to establish.

Link copied to clipboard

Represents the current connection state of a session.

Properties

Link copied to clipboard
abstract val isConnected: Boolean

Whether the underlying connection is connected to the server.

Link copied to clipboard
abstract val readyState: StateFlow<StreamSession.ReadyState>

Observable connection state for this session.

Link copied to clipboard
abstract val stream: Stream

The stream used to configure codecs and register media outputs.

Functions

Link copied to clipboard
abstract suspend fun close(): Result<Unit>

Closes the connection and its stream.

Link copied to clipboard
abstract suspend fun connect(): Result<Unit>

Connects to the server and starts publishing or playback in the configured mode.