Camera & Microphone

The SDK does its best to make working with the camera and microphone easy. We expose the following objects on the call:

let call = streamVideo.call(callType: "default", callId: "123")
let camera = call.camera
let microphone = call.microphone
let speaker = call.speaker

Camera Manager

The following methods are available on the camera manager:

try await call.camera.enable() // enable the camera
try await call.camera.disable() // disable the camera
try await call.camera.flip() // switch between front and back camera

The camera manager also exposes these observables:

call.camera.direction // front/back
call.camera.status // enabled/ disabled.

Microphone Manager

The microphone manager supports changing the mic state:

try await call.microphone.enable() // enable the microphone
try await call.microphone.disable() // disable the microphone

You can get the microphone status like this:

call.microphone.status // enabled/ disabled.

You can also toggle the microphone state:

try await call.microphone.toggle()

Noise Cancellation

Check our Noise Cancellation guide.

Speaker Manager

The speaker allows you to enable/disable the speaker phone.

try await call.speaker.enableSpeakerPhone()
try await call.speaker.disableSpeakerPhone()

Additionally, you can enable/disable the audio output on the device.

try await call.speaker.enableAudioOutput()
try await call.speaker.disableAudioOutput()

You can also toggle the speaker phone:

try await call.speaker.toggleSpeakerPhone()

Camera Focus and Zoom

The SDK provides methods to control camera focus and zoom during a call:

// Focus on a specific point (normalized coordinates 0-1)
try await call.focus(at: CGPoint(x: 0.5, y: 0.5))

// Zoom the camera (factor relative to current zoom level)
try await call.zoom(by: 2.0)

These features are useful for allowing users to focus on specific areas or zoom in during screen sharing or presentations.