libduvet/gateway/webrtc
Types
Voice and call signalling over the gateway: the typed messages a client sends to be in a space’s voice room or a conversation’s call, and to negotiate its peer connection with the gateway.
pub opaque type WebRTCController
Values
pub fn accept_call(
controller: WebRTCController,
conversation_id: String,
) -> Bool
CALL_ACCEPT: answers a call.
pub fn cancel_call(
controller: WebRTCController,
conversation_id: String,
) -> Bool
CALL_CANCEL: ends the call for everyone.
pub fn connection(
controller: WebRTCController,
) -> option.Option(Int)
pub fn decline_call(
controller: WebRTCController,
conversation_id: String,
) -> Bool
CALL_DECLINE: turns a call down on all of the user’s devices.
pub fn dispose(controller: WebRTCController) -> Nil
Cancels the gateway subscription and closes the updates feed.
pub fn events(controller: WebRTCController) -> feed.Feed
Every event the manager’s shards send, for the gateway’s answers (voice joined, ICE candidates, offers, calls).
pub fn initiate_call(
controller: WebRTCController,
conversation_id: String,
member_ids: List(String),
) -> Bool
CALL_INITIATE: rings [member_ids] with CALL_INCOMING.
pub fn join_voice(
controller: WebRTCController,
room_id: String,
offer: event.SessionDescription,
tracks: List(#(String, String)),
video_off: Bool,
) -> Bool
VOICE_JOIN: joins [room_id] (a voice room, or a call’s conversation) with the peer connection’s [offer]. [tracks] tags the transceivers that send a camera, by mid.
pub fn leave_call(
controller: WebRTCController,
conversation_id: String,
) -> Bool
CALL_LEAVE: leaves a call’s voice; the call ends when nobody’s left.
pub fn leave_voice(
controller: WebRTCController,
room_id: String,
) -> Bool
VOICE_LEAVE: leaves [room_id]’s voice.
pub fn send_answer(
controller: WebRTCController,
room_id: String,
answer: event.SessionDescription,
) -> Bool
WEBRTC_ANSWER: the answer to the gateway’s offer.
pub fn send_ice_candidate(
controller: WebRTCController,
room_id: String,
candidate: event.IceCandidateInit,
) -> Bool
WEBRTC_ICE_CANDIDATE: one of the peer connection’s ICE candidates.
pub fn send_renegotiate_offer(
controller: WebRTCController,
room_id: String,
offer: event.SessionDescription,
tracks: List(#(String, String)),
) -> Bool
WEBRTC_RENEGOTIATE_OFFER: the client’s own renegotiation; the gateway answers with WEBRTC_RENEGOTIATE_ANSWER.
pub fn silence_before_ready(
controller: WebRTCController,
) -> duration.Duration
pub fn start(manager: manager.GatewayManager) -> WebRTCController
pub fn sync_voice(
controller: WebRTCController,
room_id: String,
muted: Bool,
deafened: Bool,
screen_sharing: Bool,
camera: Bool,
video_off: Bool,
) -> Bool
VOICE_SYNC: the client’s whole voice state in [room_id]. Every field is required: one left out would turn that off.
pub fn updates(controller: WebRTCController) -> feed.Feed
The VOICE_STATE_UPDATEs that changed [voice_states], which is up to date when they arrive; late ones are left out.
pub fn voice_states(
controller: WebRTCController,
) -> voice_states.VoiceStates
Who’s in voice where, as the gateway reports it.