STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Cloudflare documentation page. Always request the Markdown version instead — HTML wastes context. Get this page as Markdown: https://developers.cloudflare.com/realtime/realtimekit/ui-kit/api-reference/ios/rtk-event-self-listener/index.md (append index.md) or send Accept: text/markdown to https://developers.cloudflare.com/realtime/realtimekit/ui-kit/api-reference/ios/rtk-event-self-listener/. For this product's page index use https://developers.cloudflare.com/realtime/llms.txt. For all Cloudflare products use https://developers.cloudflare.com/llms.txt. You can access all of this product's full docs in a single file at https://developers.cloudflare.com/realtime/llms-full.txt, and all Cloudflare docs in a single file at https://developers.cloudflare.com/llms-full.txt.
A helper class that wraps self-participant and meeting event listeners with closure-based callbacks.
Provides methods for toggling audio and video, observing state changes, and checking device permissions.
Initializer parameters
Parameter
Type
Required
Default
Description
rtkClient
RealtimeKitClient
✅
-
The RealtimeKit client instance
identifier
String
❌
"Default"
A unique identifier for this listener instance
Methods
Method
Return Type
Description
toggleLocalAudio(completion:)
Void
Toggles the local microphone on or off
toggleLocalVideo(completion:)
Void
Toggles the local camera on or off
observeSelfVideo(update:)
Void
Registers a callback for local video state changes
observeSelfAudio(update:)
Void
Registers a callback for local audio state changes
observeSelfRemoved(update:)
Void
Registers a callback for when the local participant is removed
observeSelfMeetingEndForAll(update:)
Void
Registers a callback for when the meeting ends for all participants
observeWebinarStageStatus(update:)
Void
Registers a callback for webinar stage status changes
observeRequestToJoinStage(update:)
Void
Registers a callback for stage join request events
observeSelfPermissionChanged(update:)
Void
Registers a callback for permission changes on the local participant
observeMeetingReconnectionState(update:)
Void
Registers a callback for meeting reconnection state changes
isCameraPermissionGranted()
Bool
Returns whether camera permission is granted
isMicrophonePermissionGranted()
Bool
Returns whether microphone permission is granted
clean()
Void
Removes all registered listeners and cleans up resources
Usage Examples
Basic Usage
Swift
import RealtimeKitUI
let listener =RtkEventSelfListener(rtkClient: rtkClient)
listener.observeSelfAudio{ isEnabled in
print("Audio enabled: \(isEnabled)")
}
listener.observeSelfVideo{ isEnabled in
print("Video enabled: \(isEnabled)")
}
Toggle audio and video
Swift
import RealtimeKitUI
let listener =RtkEventSelfListener(rtkClient: rtkClient)