Class CallState
-
-
Field Summary
Fields Modifier and Type Field Description private final StateFlow<RealtimeConnection>connectionprivate final StateFlow<Boolean>isReconnectingprivate final StateFlow<List<ParticipantState>>participantsprivate final StateFlow<OffsetDateTime>startedAtprivate final StateFlow<ParticipantCount>participantCountsprivate 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<Set<String>>blockedUsersprivate final StateFlow<RingingState>ringingStateprivate final StateFlow<CallSettingsResponse>settingsprivate 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 StateFlow<Long>liveDurationInMsprivate 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<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>>errors
-
Constructor Summary
Constructors Constructor Description CallState(StreamVideo client, Call call, User user, CoroutineScope scope)
-
Method Summary
Modifier and Type Method Description final StateFlow<RealtimeConnection>getConnection()final StateFlow<Boolean>isReconnecting()final StateFlow<List<ParticipantState>>getParticipants()Participants returns a list of participant state object. final StateFlow<OffsetDateTime>getStartedAt()Will return always null with current SFU implementation - it may be fixed later. final StateFlow<ParticipantCount>getParticipantCounts()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 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()Sorted participants based on Pinned
Dominant Speaker
Screensharing
Last speaking at
Video enabled
Call joined at
final StateFlow<List<MemberState>>getMembers()final StateFlow<ScreenSharingSession>getScreenSharingSession()final StateFlow<Boolean>getSpeakingWhileMuted()final StateFlow<Boolean>getRecording()final StateFlow<Set<String>>getBlockedUsers()final StateFlow<RingingState>getRingingState()final StateFlow<CallSettingsResponse>getSettings()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 StateFlow<Long>getLiveDurationInMs()how many milliseconds the call has been running, null if the call didn't start 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<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 UnitupdateParticipantSortingOrder(Comparator<ParticipantState> comparator)Update participant sorting order 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 UnitmarkSpeakingAsMuted()final UnitupsertParticipants(List<ParticipantState> participants)final ParticipantStategetOrCreateParticipant(String sessionId, String userId, Boolean updateFlow)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(QueryMembersResponse it)final UnitupdateFromResponse(StopLiveResponse result)final UnitupdateFromResponse(GoLiveResponse result)final UnitupdateFromResponse(StartBroadcastingResponse 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. -
-
Constructor Detail
-
CallState
CallState(StreamVideo client, Call call, User user, CoroutineScope scope)
-
-
Method Detail
-
getConnection
final StateFlow<RealtimeConnection> getConnection()
-
isReconnecting
final StateFlow<Boolean> isReconnecting()
-
getParticipants
final StateFlow<List<ParticipantState>> getParticipants()
Participants returns a list of participant state object. @see ParticipantState
-
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()
-
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
-
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()
Sorted participants based on
Pinned
Dominant Speaker
Screensharing
Last speaking at
Video enabled
Call joined at
Debounced 100ms to avoid rapid changes
-
getMembers
final StateFlow<List<MemberState>> getMembers()
-
getScreenSharingSession
final StateFlow<ScreenSharingSession> getScreenSharingSession()
-
getSpeakingWhileMuted
final StateFlow<Boolean> getSpeakingWhileMuted()
-
getRecording
final StateFlow<Boolean> getRecording()
-
getBlockedUsers
final StateFlow<Set<String>> getBlockedUsers()
-
getRingingState
final StateFlow<RingingState> getRingingState()
-
getSettings
final StateFlow<CallSettingsResponse> getSettings()
-
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 StateFlow<Long> getLiveDurationInMs()
how many milliseconds the call has been running, null if the call didn't start yet
-
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()
-
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()
-
updateParticipantSortingOrder
final Unit updateParticipantSortingOrder(Comparator<ParticipantState> comparator)
Update participant sorting order
- 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)
-
markSpeakingAsMuted
final Unit markSpeakingAsMuted()
-
upsertParticipants
final Unit upsertParticipants(List<ParticipantState> participants)
-
getOrCreateParticipant
final ParticipantState getOrCreateParticipant(String sessionId, String userId, Boolean updateFlow)
-
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(QueryMembersResponse it)
-
updateFromResponse
final Unit updateFromResponse(StopLiveResponse result)
-
updateFromResponse
final Unit updateFromResponse(GoLiveResponse result)
-
updateFromResponse
final Unit updateFromResponse(StartBroadcastingResponse 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.
-
-
-