| name | video-controls |
| description | Control video during calls — pause/resume camera, switch front/back camera. Use when implementing camera toggle, camera switch, or custom video buttons. Triggers on "pause video", "resume video", "switch camera", "camera toggle", "video controls". |
| inclusion | manual |
CometChat Calls SDK v5 — Video Controls
Overview
Programmatically control the local camera (pause/resume) and switch between front/back cameras during an active call.
Key Imports
import CometChatCallsSDK
Implementation
Pause / Resume Video
CallSession.shared.pauseVideo()
CallSession.shared.resumeVideo()
Switch Camera
CallSession.shared.switchCamera()
Listen for Video Events
class MediaHandler: NSObject, MediaEventsListener {
func onVideoPaused() {
}
func onVideoResumed() {
}
func onCameraFacingChanged(cameraFacing: CameraFacing) {
}
}
CallSession.shared.addMediaEventsListener(handler)
Initial Video Settings (Pre-Session)
let settings = SessionSettingsBuilder()
.startVideoPaused(false)
.hideToggleVideoButton(false)
.hideSwitchCameraButton(false)
.build()
Gotchas
pauseVideo() / resumeVideo() only work during an active session
switchCamera() toggles between front and back — no parameter needed
- For voice calls, set
.startVideoPaused(true)
- Camera permissions must be granted before joining
Sample App Reference
CallView.swift — Session settings with video configuration