CallState

class CallState(client: StreamVideo, call: Call, user: User, scope: CoroutineScope)

The CallState class keeps all state for a call It's available on every call object

Samples

Constructors

Link copied to clipboard
constructor(client: StreamVideo, call: Call, user: User, scope: CoroutineScope)

Properties

Link copied to clipboard
val acceptedBy: StateFlow<Set<String>>
Link copied to clipboard
Link copied to clipboard
val backstage: StateFlow<Boolean>

if we are in backstage mode or not

Link copied to clipboard
val blockedUserIds: StateFlow<List<String>>
Link copied to clipboard
val blockedUsers: StateFlow<Set<String>>
Link copied to clipboard
val broadcasting: StateFlow<Boolean>

if the call is being broadcasted to HLS

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val createdAt: StateFlow<OffsetDateTime?>
Link copied to clipboard
val createdBy: StateFlow<User?>
Link copied to clipboard
val custom: StateFlow<Map<String, Any?>>
Link copied to clipboard
Link copied to clipboard
val duration: StateFlow<Duration?>

how long the call has been running, rounded to seconds, null if the call didn't start yet

Link copied to clipboard
val durationInDateFormat: StateFlow<String?>

how many milliseconds the call has been running in the simple date format.

Link copied to clipboard
val durationInMs: StateFlow<Long?>

how many milliseconds the call has been running, null if the call didn't start yet

Link copied to clipboard
val egress: StateFlow<EgressResponse?>
Link copied to clipboard
val egressPlayListUrl: StateFlow<String?>
Link copied to clipboard
val endedAt: StateFlow<OffsetDateTime?>
Link copied to clipboard
val endedByUser: StateFlow<User?>
Link copied to clipboard
val errors: StateFlow<List<ErrorEvent>>
Link copied to clipboard
val ingress: StateFlow<Ingress?>
Link copied to clipboard
val isReconnecting: StateFlow<Boolean>
Link copied to clipboard
val live: StateFlow<Boolean>

the opposite of backstage, if we are live or not

Link copied to clipboard
val liveDuration: StateFlow<Duration?>

How long the call has been live for, represented as Duration, or null if the call hasn't been live yet. Keeps its value when live ends and resets when live starts again.

Link copied to clipboard
val liveDurationInMs: StateFlow<Long?>

How long the call has been live for, in milliseconds, or null if the call hasn't been live yet. Keeps its value when live ends and resets when live starts again.

Link copied to clipboard
Link copied to clipboard

Your own participant state

Link copied to clipboard
val me: StateFlow<ParticipantState?>

Your own participant state

Link copied to clipboard
val members: StateFlow<List<MemberState>>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Participants returns a list of participant state object. @see ParticipantState

Link copied to clipboard
Link copied to clipboard
val pinnedParticipants: StateFlow<Map<String, OffsetDateTime>>

Pinned participants, combined value both from server and local pins.

Link copied to clipboard
Link copied to clipboard
val recording: StateFlow<Boolean>
Link copied to clipboard
val rejectedBy: StateFlow<Set<String>>
Link copied to clipboard

participants other than yourself

Link copied to clipboard
val ringingState: StateFlow<RingingState>
Link copied to clipboard
Link copied to clipboard
val session: StateFlow<CallSessionResponse?>
Link copied to clipboard
Link copied to clipboard

Sorted participants based on

Link copied to clipboard
val speakingWhileMuted: StateFlow<Boolean>
Link copied to clipboard
val startedAt: StateFlow<OffsetDateTime?>

Will return always null with current SFU implementation - it may be fixed later. For now do not use it.

Link copied to clipboard
val startsAt: StateFlow<OffsetDateTime?>
Link copied to clipboard
Link copied to clipboard
val team: StateFlow<String?>
Link copied to clipboard
val totalParticipants: StateFlow<Int>

a count of the total number of participants.

Link copied to clipboard
val transcribing: StateFlow<Boolean>
Link copied to clipboard
val updatedAt: StateFlow<OffsetDateTime?>

updatedAt

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun getOrCreateParticipant(sessionId: String, userId: String, updateFlow: Boolean = false): ParticipantState
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun hasPermission(permission: String): StateFlow<Boolean>

Check if you have permissions to do things like share your audio, video, screen etc

Link copied to clipboard
Link copied to clipboard
fun pin(userId: String, sessionId: String)
Link copied to clipboard
Link copied to clipboard
fun unpin(sessionId: String)
Link copied to clipboard
Link copied to clipboard

Update participant sorting order

Link copied to clipboard
fun updateParticipantVisibility(sessionId: String, visibilityOnScreenState: VisibilityOnScreenState)

Update participants visibility on the UI.

Link copied to clipboard

Set a flow to update the participants visibility. The flow should emit lists with currently visible participant session IDs.

Link copied to clipboard