LiveKit Swift Client SDK Documentation

Protocol Participant​Delegate

@objc
public protocol ParticipantDelegate: AnyObject  

Delegate methods for a participant.

Since Participant inherits from MulticastDelegate, you can call add(delegate:) on Participant to add as many delegates as you need. All delegate methods are optional.

To ensure each participant's delegate is registered, you can look through Room/localParticipant and Room/remoteParticipants on connect and register it on new participants inside RoomDelegate/room(_:participantDidJoin:)-9bkm4

%227 ParticipantDelegate ParticipantDelegate AnyObject AnyObject ParticipantDelegate->AnyObject ObservableParticipant ObservableParticipant ObservableParticipant->ParticipantDelegate

Conforms To

AnyObject

Types Conforming to Participant​Delegate

ObservableParticipant

Optional Requirements

participant(_:​did​Update:​)

@objc(participant:didUpdateMetadata:) optional
    func participant(_ participant: Participant, didUpdate metadata: String?) 

A Participant's metadata has updated. participant Can be a LocalParticipant or a RemoteParticipant.

participant(_:​did​Update​Name:​)

@objc(participant:didUpdateName:) optional
    func participant(_ participant: Participant, didUpdateName: String) 

A Participant's name has updated. participant Can be a LocalParticipant or a RemoteParticipant.

participant(_:​did​Update:​)

@objc(participant:didUpdateSpeaking:) optional
    func participant(_ participant: Participant, didUpdate speaking: Bool) 

The isSpeaking status of a Participant has changed. participant Can be a LocalParticipant or a RemoteParticipant.

participant(_:​did​Update:​)

@objc(participant:didUpdateConnectionQuality:) optional
    func participant(_ participant: Participant, didUpdate connectionQuality: ConnectionQuality) 

The connection quality of a Participant has updated. participant Can be a LocalParticipant or a RemoteParticipant.

participant(_:​did​Update:​muted:​)

@objc(participant:publication:didUpdateMuted:) optional
    func participant(_ participant: Participant, didUpdate publication: TrackPublication, muted: Bool) 

muted state has updated for the Participant's TrackPublication.

For the LocalParticipant, the delegate method will be called if setMute was called on LocalTrackPublication, or if the server has requested the participant to be muted.

participant Can be a LocalParticipant or a RemoteParticipant.

participant(_:​did​Update:​)

@objc(participant:didUpdatePermissions:) optional
    func participant(_ participant: Participant, didUpdate permissions: ParticipantPermissions) 

participant(_:​did​Update:​stream​State:​)

@objc(participant:publication:didUpdateStreamState:) optional
    func participant(_ participant: RemoteParticipant, didUpdate publication: RemoteTrackPublication, streamState: StreamState) 

RemoteTrackPublication/streamState has updated for the RemoteParticipant.

participant(_:​did​Update:​permission:​)

@objc(participant:publication:didUpdateCanSubscribe:) optional
    func participant(_ participant: RemoteParticipant, didUpdate publication: RemoteTrackPublication, permission allowed: Bool) 

RemoteTrackPublication/subscriptionAllowed has updated for the RemoteParticipant.

participant(_:​did​Publish:​)

@objc(remoteParticipant:didPublish:) optional
    func participant(_ participant: RemoteParticipant, didPublish publication: RemoteTrackPublication) 

When a new RemoteTrackPublication is published to Room after the LocalParticipant has joined.

This delegate method will not be called for tracks that are already published.

participant(_:​did​Unpublish:​)

@objc(remoteParticipant:didUnpublish:) optional
    func participant(_ participant: RemoteParticipant, didUnpublish publication: RemoteTrackPublication) 

The RemoteParticipant has unpublished a RemoteTrackPublication.

local​Participant(_:​did​Publish:​)

@objc(localParticipant:didPublish:) optional
    func localParticipant(_ participant: LocalParticipant, didPublish publication: LocalTrackPublication) 

The LocalParticipant has published a LocalTrackPublication.

local​Participant(_:​did​Unpublish:​)

@objc(localParticipant:didUnpublish:) optional
    func localParticipant(_ participant: LocalParticipant, didUnpublish publication: LocalTrackPublication) 

The LocalParticipant has unpublished a LocalTrackPublication.

participant(_:​did​Subscribe:​track:​)

@objc(participant:didSubscribe:track:) optional
    func participant(_ participant: RemoteParticipant, didSubscribe publication: RemoteTrackPublication, track: Track) 

The LocalParticipant has subscribed to a new RemoteTrackPublication.

This event will always fire as long as new tracks are ready for use.

participant(_:​did​Fail​ToSubscribe:​error:​)

@objc(participant:didFailToSubscribeTrackWithSid:error:) optional
    func participant(_ participant: RemoteParticipant, didFailToSubscribe trackSid: String, error: Error) 

Could not subscribe to a track.

This is an error state, the subscription can be retried.

participant(_:​did​Unsubscribe:​track:​)

@objc(participant:didUnsubscribePublication:track:) optional
    func participant(_ participant: RemoteParticipant, didUnsubscribe publication: RemoteTrackPublication, track: Track) 

Unsubscribed from a RemoteTrackPublication and is no longer available.

Clients should listen to this event and handle cleanup.

participant(_:​did​Receive:​)

@objc(participant:didReceiveData:)
    @available(*, deprecated, renamed: "participant(_:didReceiveData:topic:)")
    optional
    func participant(_ participant: RemoteParticipant, didReceive data: Data) 

Data was received from a RemoteParticipant.

Notice: Deprecated, use participant(_:didReceiveData:topic:) instead.

participant(_:​did​Receive​Data:​topic:​)

@objc(participant:didReceiveData:topic:) optional
    func participant(_ participant: RemoteParticipant, didReceiveData data: Data, topic: String)