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:

val call = client.call("default", "123")
val camera = call.camera
val microphone = call.microphone
val speaker = call.speaker

Camera Manager

The following methods are available on the camera manager:

call.camera.enable() // enable the camera
call.camera.disable() // disable the camera
call.camera.flip() // switch between front and back camera
call.camera.listDevices() // list of available devices

The camera manager also exposes these stateflow objects:

call.camera.direction // front/back
call.camera.status // enabled/disabled.
call.camera.selectedDevice // currently selected camera
call.camera.resolution // resolution
call.camera.availableResolutions // the resolutions that are available

Microphone Manager

The microphone manager supports both bluetooth and regular audio sources:

call.microphone.enable() // enable the microphone
call.microphone.disable() // disable the microphone
call.microphone.select(AudioDevice?) // select a specific audio device

These stateflow objects are available:

call.microphone.status // enabled/disabled.
call.microphone.selectedDevice // currently selected microphone

Speaker Manager

The speaker manager allows you to enable/disable the speakerphone and set the volume.

speaker.setVolume(100)
speaker.setVolume(0)

speaker.enableSpeakerPhone()
speaker.disableSpeakerPhone()

Pause & Resume

You'll often want to pause and resume the camera and microphone. If the device is locked or you receive an incoming call many apps pause the camera. The APIs make this easy to do

// call.speaker, call.camera and call.microphone all support this
camera.pause()
camera.resume() // goes back to the prior state. if it was off, nothing changes, if it was on, it resumes

Did you find this page helpful?