MultimediaSessionEvent

sealed interface MultimediaSessionEvent

Events emitted during the lifecycle of a MultimediaSession.

Collect these events via MultimediaSessionFlows.event to observe connection state changes, participant updates, and errors. Use a when expression for exhaustive handling.

Samples

scope.launch {
    session.event.collect { event ->
        when (event) {
            is MultimediaSessionEvent.Connection.Connected -> {
                // Call connected successfully
            }
            is MultimediaSessionEvent.Connection.Reconnecting -> {
                // Network interruption, attempting to reconnect
            }
            is MultimediaSessionEvent.Connection.Disconnected -> {
                // Call ended or lost connection
            }
            is MultimediaSessionEvent.ParticipantChanged -> {
                // Agent joined or participant state changed
            }
            is MultimediaSessionEvent.Error -> {
                val errorCode = event.code
            }
            else -> {}
        }
    }
}

Inheritors

Types

Link copied to clipboard

Connection lifecycle events for a multimedia session.

Link copied to clipboard
class Error(exception: Exception, val code: MultimediaErrorCode = MultimediaErrorCode.General) : MultimediaSessionEvent, Exception

Emitted when an error occurs during the session.

Link copied to clipboard

Emitted when a participant joins, leaves, or changes state.