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
- An Azure account with an active subscription. Create an account for free.
- A deployed Communication Services resource. Create a Communication Services resource.
- A user access token to enable the call client. Get a user access token.
- Optional: Completion of the quickstart for getting started with the UI Library composites.
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.
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