跳轉到

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

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.