Protocol
ParticipantDelegate
@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
Relationships
Conforms To
AnyObject
Types Conforming to ParticipantDelegate
ObservableParticipant
Optional Requirements
participant(_:didUpdate:)
@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(_:didUpdateName:)
@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(_:didUpdate:)
@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(_:didUpdate:)
@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(_:didUpdate: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(_:didUpdate:)
@objc(participant:didUpdatePermissions:) optional
func participant(_ participant: Participant, didUpdate permissions: ParticipantPermissions)
participant(_:didUpdate:streamState:)
@objc(participant:publication:didUpdateStreamState:) optional
func participant(_ participant: RemoteParticipant, didUpdate publication: RemoteTrackPublication, streamState: StreamState)
RemoteTrackPublication/streamState
has updated for the RemoteParticipant
.
participant(_:didUpdate:permission:)
@objc(participant:publication:didUpdateCanSubscribe:) optional
func participant(_ participant: RemoteParticipant, didUpdate publication: RemoteTrackPublication, permission allowed: Bool)
RemoteTrackPublication/subscriptionAllowed
has updated for the RemoteParticipant
.
participant(_:didPublish:)
@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(_:didUnpublish:)
@objc(remoteParticipant:didUnpublish:) optional
func participant(_ participant: RemoteParticipant, didUnpublish publication: RemoteTrackPublication)
The RemoteParticipant
has unpublished a RemoteTrackPublication
.
localParticipant(_:didPublish:)
@objc(localParticipant:didPublish:) optional
func localParticipant(_ participant: LocalParticipant, didPublish publication: LocalTrackPublication)
The LocalParticipant
has published a LocalTrackPublication
.
localParticipant(_:didUnpublish:)
@objc(localParticipant:didUnpublish:) optional
func localParticipant(_ participant: LocalParticipant, didUnpublish publication: LocalTrackPublication)
The LocalParticipant
has unpublished a LocalTrackPublication
.
participant(_:didSubscribe: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(_:didFailToSubscribe: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(_:didUnsubscribe: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(_:didReceive:)
@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(_:didReceiveData:topic:)
@objc(participant:didReceiveData:topic:) optional
func participant(_ participant: RemoteParticipant, didReceiveData data: Data, topic: String)