libduvet/gateway/voice_states
Types
A user’s voice state in a space’s voice room, or in a conversation’s call
(then room_id is the conversation’s ID).
pub type VoiceParticipant {
VoiceParticipant(
user_id: String,
room_id: String,
muted: Bool,
deafened: Bool,
screen_sharing: Bool,
camera: Bool,
version: Int,
)
}
Constructors
-
VoiceParticipant( user_id: String, room_id: String, muted: Bool, deafened: Bool, screen_sharing: Bool, camera: Bool, version: Int, )Arguments
- camera
-
Their camera is on.
- version
-
The state’s version.
Who’s in voice in every room and call a session knows of, kept as the gateway reports it. Updates can arrive out of order: each carries a version that grows with every change, and one older than what’s known is dropped.
pub opaque type VoiceStates
Values
pub fn apply(
states: VoiceStates,
update: event.VoiceStateEvent,
) -> Bool
VOICE_STATE_UPDATE: answers whether it applied, false for one that came after a newer one.
pub fn forget(states: VoiceStates, room_id: String) -> Nil
A room that’s gone, or a call that ended.
pub fn ongoing(
states: VoiceStates,
call: event.CallOngoingEvent,
) -> Nil
CALL_ONGOING: who is in the call’s voice as the gateway has it now replaces what was known of it.
pub fn participants_in(
states: VoiceStates,
room_id: String,
) -> List(VoiceParticipant)
Who’s in [room_id]: none when nobody is.
pub fn reset(
states: VoiceStates,
calls: List(ready.GatewayReadyActiveCall),
) -> Nil
READY: a new session, so what was known is dropped, and READY’s calls are taken.
pub fn rooms(
states: VoiceStates,
) -> dict.Dict(String, dict.Dict(String, VoiceParticipant))
Everyone in voice, by room (or call) ID, then by user ID.
pub fn space(
states: VoiceStates,
payload: event.GatewaySpaceCreatePayload,
) -> Nil
SPACE_CREATE: the space’s voice rooms as the gateway has them now replace what was known of them.
pub fn start() -> VoiceStates