-
@Stable() public final class CallStateThe CallState class keeps all state for a call It's available on every call object
-
-
Field Summary
Fields Modifier and Type Field Description private final CallActionscallActionsprivate final StateFlow<RealtimeConnection>connectionprivate final StateFlow<Boolean>isReconnectingprivate final StateFlow<List<ParticipantState>>participantsprivate final StateFlow<OffsetDateTime>startedAtprivate final StateFlow<ParticipantCount>participantCountsprivate final StateFlow<Boolean>e2eeEnabledprivate final StateFlow<Integer>totalParticipantsprivate final StateFlow<ParticipantState>meprivate final StateFlow<ParticipantState>localParticipantprivate final StateFlow<List<ParticipantState>>activeSpeakersprivate final StateFlow<List<ParticipantState>>remoteParticipantsprivate final StateFlow<ParticipantState>dominantSpeakerprivate final StateFlow<Map<String, OffsetDateTime>>pinnedParticipantsprivate final CallStatsstatsprivate final StateFlow<ParticipantState.Video>livestreamprivate final Flow<List<ParticipantState>>sortedParticipantsprivate final StateFlow<List<MemberState>>membersprivate final StateFlow<ScreenSharingSession>screenSharingSessionprivate final StateFlow<Boolean>speakingWhileMutedprivate final StateFlow<Boolean>recordingprivate final StateFlow<Boolean>individualRecordingprivate final StateFlow<Boolean>rawRecordingprivate final StateFlow<Boolean>compositeRecordingprivate final StateFlow<Set<String>>blockedUsersprivate final StateFlow<RingingState>ringingStateprivate final StateFlow<CallSettingsResponse>settingsprivate final StateFlow<Boolean>audioProcessingEnabledprivate final StateFlow<Duration>durationprivate final StateFlow<Long>durationInMsprivate final StateFlow<String>durationInDateFormatprivate final StateFlow<List<OwnCapability>>ownCapabilitiesprivate final StateFlow<List<PermissionRequest>>permissionRequestsprivate final StateFlow<Map<String, List<String>>>capabilitiesByRoleprivate final StateFlow<Boolean>backstageprivate final StateFlow<Boolean>liveprivate final <ERROR CLASS>liveDurationInMsprivate final <ERROR CLASS>liveDurationprivate final StateFlow<EgressResponse>egressprivate final StateFlow<String>egressPlayListUrlprivate final StateFlow<Boolean>broadcastingprivate final StateFlow<Boolean>transcribingprivate final StateFlow<Set<String>>acceptedByprivate final StateFlow<Set<String>>rejectedByprivate final StateFlow<Bundle>rejectActionBundleprivate final StateFlow<CallSessionResponse>sessionprivate final StateFlow<OffsetDateTime>startsAtprivate final StateFlow<OffsetDateTime>updatedAtprivate final StateFlow<OffsetDateTime>createdAtprivate final StateFlow<List<String>>blockedUserIdsprivate final StateFlow<Map<String, Object>>customprivate final StateFlow<String>teamprivate final StateFlow<User>createdByprivate final StateFlow<Ingress>ingressprivate final StateFlow<OffsetDateTime>endedAtprivate final StateFlow<User>endedByUserprivate final StateFlow<List<ReactionResponse>>reactionsprivate final StateFlow<List<ErrorEvent>>errorsprivate final <ERROR CLASS>participantVideoEnabledOverridesprivate final StateFlow<String>thumbnailprivate final ModerationManagermoderationManagerprivate final StateFlow<Boolean>isCaptioningprivate final StateFlow<List<CallClosedCaption>>closedCaptionsprivate final StateFlow<TranscriptionSettingsResponse.ClosedCaptionMode>ccModeprivate final StateFlow<Integer>notificationIdFlowprivate final CoroutineScopescope
-
Constructor Summary
Constructors Constructor Description CallState(StreamVideo client, Call call, User user, CoroutineScope scope)
-
Method Summary
Modifier and Type Method Description final CallActionsgetCallActions()final StateFlow<RealtimeConnection>getConnection()final StateFlow<Boolean>getIsReconnecting()final StateFlow<List<ParticipantState>>getParticipants()final StateFlow<OffsetDateTime>getStartedAt()Will return always null with current SFU implementation - it may be fixed later. final StateFlow<ParticipantCount>getParticipantCounts()final StateFlow<Boolean>getE2eeEnabled()Whether media on this call is end-to-end encrypted, which is true once an io.getstream.video.android.core.e2ee.E2EEManager is attached via Call.setE2EEManager or implicitly by setting a key. final StateFlow<Integer>getTotalParticipants()a count of the total number of participants. final StateFlow<ParticipantState>getMe()Your own participant state final StateFlow<ParticipantState>getLocalParticipant()Your own participant state final StateFlow<List<ParticipantState>>getActiveSpeakers()final StateFlow<List<ParticipantState>>getRemoteParticipants()Participants other than yourself, in the same sort order as participants. final StateFlow<ParticipantState>getDominantSpeaker()final StateFlow<Map<String, OffsetDateTime>>getPinnedParticipants()Pinned participants, combined value both from server and local pins. final CallStatsgetStats()final StateFlow<ParticipantState.Video>getLivestream()final Flow<List<ParticipantState>>getSortedParticipants()final StateFlow<List<MemberState>>getMembers()final StateFlow<ScreenSharingSession>getScreenSharingSession()final StateFlow<Boolean>getSpeakingWhileMuted()final StateFlow<Boolean>getRecording()final StateFlow<Boolean>getIndividualRecording()final StateFlow<Boolean>getRawRecording()final StateFlow<Boolean>getCompositeRecording()final StateFlow<Set<String>>getBlockedUsers()final StateFlow<RingingState>getRingingState()final StateFlow<CallSettingsResponse>getSettings()final StateFlow<Boolean>getAudioProcessingEnabled()Whether local audio processing (noise cancellation) is currently running for this call. final StateFlow<Duration>getDuration()how long the call has been running, rounded to seconds, null if the call didn't start yet final StateFlow<Long>getDurationInMs()how many milliseconds the call has been running, null if the call didn't start yet final StateFlow<String>getDurationInDateFormat()how many milliseconds the call has been running in the simple date format. final StateFlow<List<OwnCapability>>getOwnCapabilities()final StateFlow<List<PermissionRequest>>getPermissionRequests()final StateFlow<Map<String, List<String>>>getCapabilitiesByRole()final StateFlow<Boolean>getBackstage()if we are in backstage mode or not final StateFlow<Boolean>getLive()the opposite of backstage, if we are live or not final <ERROR CLASS>getLiveDurationInMs()How long the call has been live for, in milliseconds, or null if the call hasn't been live yet. final <ERROR CLASS>getLiveDuration()How long the call has been live for, represented as Duration, or null if the call hasn't been live yet. final StateFlow<EgressResponse>getEgress()final StateFlow<String>getEgressPlayListUrl()final StateFlow<Boolean>getBroadcasting()if the call is being broadcasted to HLS final StateFlow<Boolean>getTranscribing()final StateFlow<Set<String>>getAcceptedBy()final StateFlow<Set<String>>getRejectedBy()final StateFlow<Bundle>getRejectActionBundle()final StateFlow<CallSessionResponse>getSession()final StateFlow<OffsetDateTime>getStartsAt()final StateFlow<OffsetDateTime>getUpdatedAt()updatedAt final StateFlow<OffsetDateTime>getCreatedAt()final StateFlow<List<String>>getBlockedUserIds()final StateFlow<Map<String, Object>>getCustom()final StateFlow<String>getTeam()final StateFlow<User>getCreatedBy()final StateFlow<Ingress>getIngress()final StateFlow<OffsetDateTime>getEndedAt()final StateFlow<User>getEndedByUser()final StateFlow<List<ReactionResponse>>getReactions()final StateFlow<List<ErrorEvent>>getErrors()final <ERROR CLASS>getParticipantVideoEnabledOverrides()final StateFlow<String>getThumbnail()final ModerationManagergetModerationManager()final StateFlow<Boolean>getIsCaptioning()Tracks whether closed captioning is currently active for the call. final StateFlow<List<CallClosedCaption>>getClosedCaptions()Holds the current list of closed captions. final StateFlow<TranscriptionSettingsResponse.ClosedCaptionMode>getCcMode()Holds the current closed caption mode for the video call. final StateFlow<Integer>getNotificationIdFlow()final CoroutineScopegetScope()final UnitsetSortPreset(SortPreset preset)Switch the active sort preset. final Unit)>updateParticipantSortingOrder(<ERROR CLASS><ParticipantState> comparator)Plug in an ad-hoc Comparator for participant sorting. final StateFlow<Boolean>hasPermission(String permission)Check if you have permissions to do things like share your audio, video, screen etc final UnithandleEvent(VideoEvent event)final UnitcancelTimeout()final UnitmarkSpeakingAsMuted()final UnitupsertParticipants(List<ParticipantState> participants)final ParticipantStategetOrCreateParticipant(String sessionId, String userId, Boolean updateFlow, ParticipantSource source)final ParticipantStategetParticipantBySessionId(String sessionId)final UnitupdateParticipant(ParticipantState participant)final UnitclearParticipants()final UnitupdateFromResponse(CallResponse response)final UnitupdateFromResponse(GetOrCreateCallResponse response)final UnitupdateFromResponse(UpdateCallResponse response)final UnitupdateFromResponse(GetCallResponse response)final UnitupdateFromResponse(JoinCallResponse response)final UnitupdateFromResponse(CallStateResponseFields callData)final UnitupdateFromResponse(QueryCallMembersResponse it)final UnitupdateFromResponse(StopLiveResponse result)final UnitupdateFromResponse(GoLiveResponse result)final UnitupdateFromResponse(StartHLSBroadcastingResponse response)final MemberStategetMember(String userId)final Unitpin(String userId, String sessionId)final Unitunpin(String sessionId)final UnitupdateParticipantVisibility(String sessionId, VisibilityOnScreenState visibilityOnScreenState)Update participants visibility on the UI. final UnitupdateParticipantVisibilityFlow(Flow<List<String>> flow)Set a flow to update the participants visibility. final UnitreplaceParticipants(List<ParticipantState> participants)final UnitupdateRejectedBy(Set<String> userId)final UnitupdateRejectActionBundle(Bundle bundle)final UnitupdateNotification(Notification notification)final UnitupdateNotification(Integer notificationId, Notification notification)final UnitsetOwnCapabilities(List<OwnCapability> ownCapability)-
-
Constructor Detail
-
CallState
CallState(StreamVideo client, Call call, User user, CoroutineScope scope)
-
-
Method Detail
-
getCallActions
final CallActions getCallActions()
-
getConnection
final StateFlow<RealtimeConnection> getConnection()
-
getIsReconnecting
final StateFlow<Boolean> getIsReconnecting()
-
getParticipants
final StateFlow<List<ParticipantState>> getParticipants()
-
getStartedAt
final StateFlow<OffsetDateTime> getStartedAt()
Will return always null with current SFU implementation - it may be fixed later. For now do not use it.
-
getParticipantCounts
final StateFlow<ParticipantCount> getParticipantCounts()
-
getE2eeEnabled
final StateFlow<Boolean> getE2eeEnabled()
Whether media on this call is end-to-end encrypted, which is true once an io.getstream.video.android.core.e2ee.E2EEManager is attached via Call.setE2EEManager or implicitly by setting a key. Use it to show a lock indicator.
Whether the call type permits encryption at all is a separate thing, readable from
settings.value?.encryption?.mode.
-
getTotalParticipants
final StateFlow<Integer> getTotalParticipants()
a count of the total number of participants.
-
getMe
final StateFlow<ParticipantState> getMe()
Your own participant state
-
getLocalParticipant
final StateFlow<ParticipantState> getLocalParticipant()
Your own participant state
-
getActiveSpeakers
final StateFlow<List<ParticipantState>> getActiveSpeakers()
-
getRemoteParticipants
final StateFlow<List<ParticipantState>> getRemoteParticipants()
Participants other than yourself, in the same sort order as participants. Lazy-initialized to defer resolving _sortedParticipantsState (defined later in this class).
-
getDominantSpeaker
final StateFlow<ParticipantState> getDominantSpeaker()
-
getPinnedParticipants
final StateFlow<Map<String, OffsetDateTime>> getPinnedParticipants()
Pinned participants, combined value both from server and local pins.
-
getLivestream
final StateFlow<ParticipantState.Video> getLivestream()
-
getSortedParticipants
final Flow<List<ParticipantState>> getSortedParticipants()
-
getMembers
final StateFlow<List<MemberState>> getMembers()
-
getScreenSharingSession
final StateFlow<ScreenSharingSession> getScreenSharingSession()
-
getSpeakingWhileMuted
final StateFlow<Boolean> getSpeakingWhileMuted()
-
getRecording
final StateFlow<Boolean> getRecording()
-
getIndividualRecording
final StateFlow<Boolean> getIndividualRecording()
-
getRawRecording
final StateFlow<Boolean> getRawRecording()
-
getCompositeRecording
final StateFlow<Boolean> getCompositeRecording()
-
getBlockedUsers
final StateFlow<Set<String>> getBlockedUsers()
-
getRingingState
final StateFlow<RingingState> getRingingState()
-
getSettings
final StateFlow<CallSettingsResponse> getSettings()
-
getAudioProcessingEnabled
final StateFlow<Boolean> getAudioProcessingEnabled()
Whether local audio processing (noise cancellation) is currently running for this call.
The SDK changes this on its own, not only in response to the app: the call type's noise-cancellation mode and the user's
enable-noise-cancellationcapability can both withdraw it mid-call. Observe this instead of snapshotting Call.isAudioProcessingEnabled, or UI bound to it will go stale.
-
getDuration
final StateFlow<Duration> getDuration()
how long the call has been running, rounded to seconds, null if the call didn't start yet
-
getDurationInMs
final StateFlow<Long> getDurationInMs()
how many milliseconds the call has been running, null if the call didn't start yet
-
getDurationInDateFormat
final StateFlow<String> getDurationInDateFormat()
how many milliseconds the call has been running in the simple date format.
-
getOwnCapabilities
final StateFlow<List<OwnCapability>> getOwnCapabilities()
-
getPermissionRequests
final StateFlow<List<PermissionRequest>> getPermissionRequests()
-
getCapabilitiesByRole
final StateFlow<Map<String, List<String>>> getCapabilitiesByRole()
-
getBackstage
final StateFlow<Boolean> getBackstage()
if we are in backstage mode or not
-
getLiveDurationInMs
final <ERROR CLASS> getLiveDurationInMs()
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.
-
getLiveDuration
final <ERROR CLASS> getLiveDuration()
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.
-
getEgress
final StateFlow<EgressResponse> getEgress()
-
getEgressPlayListUrl
final StateFlow<String> getEgressPlayListUrl()
-
getBroadcasting
final StateFlow<Boolean> getBroadcasting()
if the call is being broadcasted to HLS
-
getTranscribing
final StateFlow<Boolean> getTranscribing()
-
getAcceptedBy
final StateFlow<Set<String>> getAcceptedBy()
-
getRejectedBy
final StateFlow<Set<String>> getRejectedBy()
-
getRejectActionBundle
final StateFlow<Bundle> getRejectActionBundle()
-
getSession
final StateFlow<CallSessionResponse> getSession()
-
getStartsAt
final StateFlow<OffsetDateTime> getStartsAt()
-
getUpdatedAt
final StateFlow<OffsetDateTime> getUpdatedAt()
updatedAt
-
getCreatedAt
final StateFlow<OffsetDateTime> getCreatedAt()
-
getBlockedUserIds
final StateFlow<List<String>> getBlockedUserIds()
-
getCreatedBy
final StateFlow<User> getCreatedBy()
-
getIngress
final StateFlow<Ingress> getIngress()
-
getEndedAt
final StateFlow<OffsetDateTime> getEndedAt()
-
getEndedByUser
final StateFlow<User> getEndedByUser()
-
getReactions
final StateFlow<List<ReactionResponse>> getReactions()
-
getErrors
final StateFlow<List<ErrorEvent>> getErrors()
-
getParticipantVideoEnabledOverrides
final <ERROR CLASS> getParticipantVideoEnabledOverrides()
-
getThumbnail
final StateFlow<String> getThumbnail()
-
getModerationManager
final ModerationManager getModerationManager()
-
getIsCaptioning
final StateFlow<Boolean> getIsCaptioning()
Tracks whether closed captioning is currently active for the call. True if captioning is ongoing, false otherwise.
-
getClosedCaptions
final StateFlow<List<CallClosedCaption>> getClosedCaptions()
Holds the current list of closed captions. This list is updated dynamically and contains at most ClosedCaptionsSettings.maxVisibleCaptions captions.
-
getCcMode
final StateFlow<TranscriptionSettingsResponse.ClosedCaptionMode> getCcMode()
Holds the current closed caption mode for the video call. This object contains information about closed captioning feature availability. This state is updated dynamically based on the server's transcription setting which is io.getstream.android.video.generated.models.TranscriptionSettingsResponse.closedCaptionMode
Possible values:
ClosedCaptionMode.Available: Closed captions are available and can be enabled.
ClosedCaptionMode.Disabled: Closed captions are explicitly disabled.
ClosedCaptionMode.AutoOn: Closed captions are automatically enabled as soon as user joins the call
ClosedCaptionMode.Unknown: Represents an unrecognized or unsupported mode.
-
getNotificationIdFlow
final StateFlow<Integer> getNotificationIdFlow()
-
getScope
final CoroutineScope getScope()
-
setSortPreset
final Unit setSortPreset(SortPreset preset)
Switch the active sort preset.
-
updateParticipantSortingOrder
final Unit )>updateParticipantSortingOrder(<ERROR CLASS><ParticipantState> comparator)
Plug in an ad-hoc Comparator for participant sorting. Overrides the active preset until called again with a different comparator or setSortPreset is invoked.
- Parameters:
comparator- a new comparator to be used in sortedParticipants flow.
-
hasPermission
final StateFlow<Boolean> hasPermission(String permission)
Check if you have permissions to do things like share your audio, video, screen etc
-
handleEvent
final Unit handleEvent(VideoEvent event)
-
cancelTimeout
final Unit cancelTimeout()
-
markSpeakingAsMuted
final Unit markSpeakingAsMuted()
-
upsertParticipants
final Unit upsertParticipants(List<ParticipantState> participants)
-
getOrCreateParticipant
final ParticipantState getOrCreateParticipant(String sessionId, String userId, Boolean updateFlow, ParticipantSource source)
-
getParticipantBySessionId
final ParticipantState getParticipantBySessionId(String sessionId)
-
updateParticipant
final Unit updateParticipant(ParticipantState participant)
-
clearParticipants
final Unit clearParticipants()
-
updateFromResponse
final Unit updateFromResponse(CallResponse response)
-
updateFromResponse
final Unit updateFromResponse(GetOrCreateCallResponse response)
-
updateFromResponse
final Unit updateFromResponse(UpdateCallResponse response)
-
updateFromResponse
final Unit updateFromResponse(GetCallResponse response)
-
updateFromResponse
final Unit updateFromResponse(JoinCallResponse response)
-
updateFromResponse
final Unit updateFromResponse(CallStateResponseFields callData)
-
updateFromResponse
final Unit updateFromResponse(QueryCallMembersResponse it)
-
updateFromResponse
final Unit updateFromResponse(StopLiveResponse result)
-
updateFromResponse
final Unit updateFromResponse(GoLiveResponse result)
-
updateFromResponse
final Unit updateFromResponse(StartHLSBroadcastingResponse response)
-
getMember
final MemberState getMember(String userId)
-
updateParticipantVisibility
final Unit updateParticipantVisibility(String sessionId, VisibilityOnScreenState visibilityOnScreenState)
Update participants visibility on the UI.
- Parameters:
sessionId- the session ID of the participant.visibilityOnScreenState- the visibility state.
-
updateParticipantVisibilityFlow
final Unit updateParticipantVisibilityFlow(Flow<List<String>> flow)
Set a flow to update the participants visibility. The flow should emit lists with currently visible participant session IDs.
Note: If you pass null to the parameter it will just cancel the currently observing flow.
E.g. Grid visible items info can be used to update the CallState
val gridState = rememberLazyGridState() val updateFlow = snapshotFlow { gridState.layoutInfo.visibleItemsInfo.map { it.key // Assuming keys are sessionId } } call.state.updateParticipantVisibilityFlow(updateFlow)- Parameters:
flow- a flow that emits updates with list of visible participants.
-
replaceParticipants
final Unit replaceParticipants(List<ParticipantState> participants)
-
updateRejectedBy
final Unit updateRejectedBy(Set<String> userId)
-
updateRejectActionBundle
final Unit updateRejectActionBundle(Bundle bundle)
-
updateNotification
@Deprecated(message = Use updateNotification(Int, Notification) instead) final Unit updateNotification(Notification notification)
-
updateNotification
final Unit updateNotification(Integer notificationId, Notification notification)
-
setOwnCapabilities
final Unit setOwnCapabilities(List<OwnCapability> ownCapability)
-
-
-
-