Prerequisites
- An active call session
- Access to the
CallSessioninstance - Camera permissions granted
Get CallSession Instance
All video control methods are called on theCallSession singleton:
CallSession.getInstance() returns null if no active session exists. Always use the null-aware ?. operator when calling methods.Pause Video
Turn off the local camera. Other participants will see a placeholder instead of your video feed.When you pause your video, the
onVideoPaused() callback is triggered on your MediaEventsListener.Resume Video
Turn on the local camera to resume transmitting video.When you resume your video, the
onVideoResumed() callback is triggered on your MediaEventsListener.Toggle Pause Video
Convenience method that toggles between paused and resumed video. It checks the current state and calls the appropriate action automatically.Switch Camera
Toggle between the front-facing and rear cameras.When the camera is switched, the
onCameraFacingChanged(CameraFacing) callback is triggered on your MediaEventsListener.CameraFacing Enum
| Value | Description |
|---|---|
CameraFacing.front | Front-facing camera (selfie camera) |
CameraFacing.rear | Rear camera |
Toggle Camera Source
Convenience method that toggles between front and rear camera. Equivalent toswitchCamera().
Check Video Pause State
Use theisVideoPaused state getter to check whether the local camera is currently paused.
| Return Type | Description |
|---|---|
bool? | true if video is paused, false otherwise, null if no active session |
Listen for Video Events
Register aMediaEventsListener to receive callbacks when video state changes:
Flutter listeners are not lifecycle-aware. You must manually remove listeners in your widget’s
dispose() method to prevent memory leaks.Initial Video Settings
You can configure the initial video state when joining a session usingSessionSettings:
Hide Video Controls in UI
You can hide the built-in video control buttons usingSessionSettings:
Next Steps
Recording
Record call sessions
Media Events Listener
Handle all media events