Room¶
Room holds everyone you are in a call with: you, and every friend you are connected to.
Get the room from Room.shared; you cannot create a Room yourself. There is one room per app because
ToxCore supports only one call at a time, with one camera and one microphone.
The room exists for the whole life of the app. You do not join or leave it: friends join when they accept an invitation (see Connection) and leave when the call ends (see Disconnection).
Participants¶
Room.localParticipantis you. It is ready onceinitialize(_:)returns, and is nil beforeinitialize(_:)and afterdestroy()(see Initialization and configuration).Room.remoteParticipantsholds oneRemoteParticipantfor each connected friend, keyed by friend ID.- Between
initialize(_:)anddestroy(),Room.allParticipantslists both, andRoom.participantCountcounts them, you included. Room.activeSpeakerslists the participants who are speaking, loudest first.
import RevueSDK
/// Look up a connected friend by friend ID. Returns nil when that friend is not in the room.
func connectedParticipant(friendId: String) -> RemoteParticipant? {
Room.shared.remoteParticipants[friendId]
}
Room events¶
Add a RoomDelegate to Room.delegates on Room.shared to hear about participants joining and leaving,
tracks being published and other room events. See Events.
Speaker¶
Set Room.isSpeakerMuted to true to stop playing every received audio track. Audio is still received,
so recording keeps working.
Leave the call¶
Room.disconnectAll() hangs up on every remote participant. The room stays, so you can invite friends again.
See Disconnection.