Skip to main content

Call & Participant State

Video Call State

When you join a call, we'll automatically expose stateflow objects in 3 different places:

let clientState = streamVideo.state
let callState = call.state
let participants = call.state.participants

Call State

Here's an example of how you can access the call state:

let call = streamVideo.call(callType: "default", callId: "mycall")
let joinResult = try await call.join(create: true)
// state is now available at
let state = call.state

The following fields are available on the call:

AttributeDescription
participantsThe list of call participants.
localParticipantShortcut to your own participant state.
remoteParticipantsThe list of call participants other than yourself.
activeSpeakersThe list of participants who are currently speaking.
dominantSpeakerThe dominant speaker.
membersThe list of call members.
screenSharingSessionIf someone is screensharing, it will be available here.
recordingStateif the call is being recorded or not.
blockedUserIdsThe user ids who are blocked from this call.
settingsThe settings for this call.
ownCapabilitiesWhich actions you have permission to do.
capabilitiesByRoleWhat different roles (user, admin, moderator etc.) are allowed to do.
backstageIf a call is in backstage mode or not.
broadcastingIf a call is broadcasting (to HLS) or not.
createdAtWhen the call was created.
updatedAtWhen the call was updated.
startsAtWhen the call is scheduled to start.
endedAtWhen the call ended.
endedByUser who ended the call.
customCustom data on the call.
teamTeam that the call is restricted to. Default to null.
createdByWho created the call.
ingressIf there is an active ingress session to this call. IE if you're sending RTMP into the call
transcribinga boolean indicating if transciptions are active or or not for this call.
egresscontains URL for playlist of recording.
sessionthe session associated with the call.
reconnectionStatuswhether the call is reconnecting.
participantCountnumber of participants connected to the call.
durationThe duration of the call.
statsReportReturns stats of the call, updated every 5 seconds.

Participant State

The CallParticipant is the most essential component used to render a participant in a call. It contains all of the information to render a participant, such as audio & video renderers, availabilities of audio & video, the screen sharing session, reactions, and etc. Here's how you iterate over the participants:

// all participants
let cancellable = call.state.$participants.sink { participants in
// ..
}

// you
let localParticipant: CallParticipant? = call.state.localParticipant

The following fields are available on the participant:

AttributeDescription
idThe unique call id of the participant.
userIdThe user's id. This is not necessarily unique, since a user can join from multiple devices.
rolesThe user's roles in the call.
nameThe user's name.
profileImageURLThe user's profile image url.
trackLookupPrefixThe id of the track that's connected to the participant.
hasVideoReturns whether the participant has video.
hasAudioReturns whether the participant has audio.
isScreensharingReturns whether the participant is screenSharing.
trackReturns the participant's video track.
trackSizeReturns the size of the track for the participant.
screenshareTrackReturns the screensharing track for the participant.
showTrackReturns whether the track should be shown.
isSpeakingReturns whether the participant is speaking.
isDominantSpeakerReturns whether the participant is a dominant speaker.
sessionIdReturns whether the participant is speaking.
connectionQualityThe participant's connection quality.
joinedAtReturns the date when the user joined the call.
isPinnedReturns whether the user is pinned.
audioLevelThe audio level for the user.

Client State

// client state is available on the client object
let state = streamVideo.state

And contains these fields:

AttributeDescription
userThe user you're currently authenticated as.
connectionThe connection state. See ConnectionState.
activeCallThe call you've currently joined.
ringingCallContains the call if you're calling someone or someone is calling you.

Did you find this page helpful?