Register a MediaEventsListener to receive callbacks when video state changes:
Kotlin
Java
Report incorrect code
Copy
Ask AI
callSession.addMediaEventsListener(this, object : MediaEventsListener { override fun onVideoPaused() { Log.d(TAG, "Video paused") // Update UI to show video off state } override fun onVideoResumed() { Log.d(TAG, "Video resumed") // Update UI to show video on state } override fun onCameraFacingChanged(cameraFacing: CameraFacing) { Log.d(TAG, "Camera switched to: ${cameraFacing.value}") // Update UI to reflect camera change } // Other MediaEventsListener callbacks... override fun onRecordingStarted() {} override fun onRecordingStopped() {} override fun onScreenShareStarted() {} override fun onScreenShareStopped() {} override fun onAudioModeChanged(audioMode: AudioMode) {} override fun onAudioMuted() {} override fun onAudioUnMuted() {}})
Report incorrect code
Copy
Ask AI
callSession.addMediaEventsListener(this, new MediaEventsListener() { @Override public void onVideoPaused() { Log.d(TAG, "Video paused"); // Update UI to show video off state } @Override public void onVideoResumed() { Log.d(TAG, "Video resumed"); // Update UI to show video on state } @Override public void onCameraFacingChanged(CameraFacing cameraFacing) { Log.d(TAG, "Camera switched to: " + cameraFacing.getValue()); // Update UI to reflect camera change } // Other MediaEventsListener callbacks... @Override public void onRecordingStarted() {} @Override public void onRecordingStopped() {} @Override public void onScreenShareStarted() {} @Override public void onScreenShareStopped() {} @Override public void onAudioModeChanged(AudioMode audioMode) {} @Override public void onAudioMuted() {} @Override public void onAudioUnMuted() {}});
You can configure the initial video state when joining a session using SessionSettings:
Kotlin
Java
Report incorrect code
Copy
Ask AI
val sessionSettings = CometChatCalls.SessionSettingsBuilder() .startVideoPaused(true) // Start with camera off .setInitialCameraFacing(CameraFacing.FRONT) // Start with front camera .setType(SessionType.VIDEO) // Video call (not audio-only) .build()
Report incorrect code
Copy
Ask AI
SessionSettings sessionSettings = new CometChatCalls.SessionSettingsBuilder() .startVideoPaused(true) // Start with camera off .setInitialCameraFacing(CameraFacing.FRONT) // Start with front camera .setType(SessionType.VIDEO) // Video call (not audio-only) .build();
You can hide the built-in video control buttons using SessionSettings:
Kotlin
Java
Report incorrect code
Copy
Ask AI
val sessionSettings = CometChatCalls.SessionSettingsBuilder() .hideToggleVideoButton(true) // Hide the video on/off button .hideSwitchCameraButton(true) // Hide the camera flip button .build()
Report incorrect code
Copy
Ask AI
SessionSettings sessionSettings = new CometChatCalls.SessionSettingsBuilder() .hideToggleVideoButton(true) // Hide the video on/off button .hideSwitchCameraButton(true) // Hide the camera flip button .build();