Skip to main content
cycleCamera(properties?) This is the simplest way to toggle between front and rear cameras on mobile. When doing so, pass preferDifferentFacingMode: true — without it, the method cycles through devices in list order, which may land on another camera with the same facing mode (common on newer iPhones that expose multiple rear cameras). Has no effect if only one camera is available. This method is a wrapper around updateInputSettings() and triggers an input-settings-updated event on success.

Parameters

preferDifferentFacingMode
boolean
Optional. When true, prefers switching to a camera with a different facing mode (front ↔ rear). Defaults to false.

Return value

Returns a Promise<{ device?: MediaDeviceInfo | null }> resolving with the newly active camera’s MediaDeviceInfo, or null if no device was found.

Example

// Toggle front/rear camera on mobile
await call.cycleCamera({ preferDifferentFacingMode: true });

// Cycle through all cameras in order
await call.cycleCamera();

See also