แก้ไข

แชร์ผ่าน


Subscribe events in the UI Library

Important

This feature of Azure Communication Services is currently in preview.

Preview APIs and SDKs are provided without a service-level agreement. We recommend that you don't use them for production workloads. Some features might not be supported, or they might have constrained capabilities.

For more information, review Supplemental Terms of Use for Microsoft Azure Previews.

Prerequisites

Set up the feature

Participant joins the call

We expose addOnRemoteParticipantJoinedEventHandler to listen if the participant joins the call.

callComposite.addOnRemoteParticipantJoinedEventHandler { remoteParticipantJoinedEvent -> 
                remoteParticipantJoinedEvent.identifiers.forEach { identifier ->
                    // identifier is communication identifier
                }
            }

Participant left the call

We expose addOnRemoteParticipantLeftEventHandler to listen if the participant leaves the call.

callComposite.addOnRemoteParticipantLeftEventHandler { remoteParticipantLeftEvent -> 
                remoteParticipantLeftEvent.identifiers.forEach { identifier ->
                    // identifier is communication identifier
                }
            }

Participant joins the call

We expose onRemoteParticipantJoined to listen if the participant joins the call.

let onRemoteParticipantJoinedHandler: ([CommunicationIdentifier]) -> Void = { [weak callComposite] ids in
            guard let composite = callComposite else {
                return
            }
            /// ids are the communication identifiers that has joined and are present in the meeting
        }
callComposite.events.onRemoteParticipantJoined = onRemoteParticipantJoinedHandler

Participant left the call

We expose onRemoteParticipantLeft to listen if the participant leaves the call.

let onRemoteParticipantLeftHandler: ([CommunicationIdentifier]) -> Void = { [weak callComposite] ids in
            guard let composite = callComposite else {
                return
            }
            /// ids are the communication identifiers which have left the meeting just now.
        }
callComposite.events.onRemoteParticipantLeft = onRemoteParticipantLeftHandler

Next steps