Skip to main content

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.

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()

Did you find this page helpful?