Documentation Index
Fetch the complete documentation index at: https://cometchat-22654f5b-docs-android-v6-beta2.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Manage audio and video devices during calls, including selecting microphones, speakers, and cameras.
Get Available Devices
Get a list of available microphones:
const audioInputDevices = CometChatCalls.getAudioInputDevices();
console.log(audioInputDevices);
Audio Output Devices (Speakers)
Get a list of available speakers:
const audioOutputDevices = CometChatCalls.getAudioOutputDevices();
console.log(audioOutputDevices);
Get a list of available cameras:
const videoInputDevices = CometChatCalls.getVideoInputDevices();
console.log(videoInputDevices);
Get Current Device
Get the currently selected microphone:
const currentMic = CometChatCalls.getCurrentAudioInputDevice();
console.log("Current microphone:", currentMic);
Current Audio Output Device
Get the currently selected speaker:
const currentSpeaker = CometChatCalls.getCurrentAudioOutputDevice();
console.log("Current speaker:", currentSpeaker);
Get the currently selected camera:
const currentCamera = CometChatCalls.getCurrentVideoInputDevice();
console.log("Current camera:", currentCamera);
Change Device
Switch to a different microphone:
CometChatCalls.setAudioInputDevice(deviceId);
Set Audio Output Device
Switch to a different speaker:
CometChatCalls.setAudioOutputDevice(deviceId);
Switch to a different camera:
CometChatCalls.setVideoInputDevice(deviceId);
Device Change Events
Device Selection Changed
Monitor when the selected device changes:
CometChatCalls.addEventListener("onAudioInputDeviceChanged", (device) => {
console.log("Microphone changed:", device);
});
CometChatCalls.addEventListener("onAudioOutputDeviceChanged", (device) => {
console.log("Speaker changed:", device);
});
CometChatCalls.addEventListener("onVideoInputDeviceChanged", (device) => {
console.log("Camera changed:", device);
});
Available Devices Changed
Monitor when devices are connected or disconnected:
CometChatCalls.addEventListener("onAudioInputDevicesChanged", (devices) => {
console.log("Available microphones updated:", devices);
});
CometChatCalls.addEventListener("onAudioOutputDevicesChanged", (devices) => {
console.log("Available speakers updated:", devices);
});
CometChatCalls.addEventListener("onVideoInputDevicesChanged", (devices) => {
console.log("Available cameras updated:", devices);
});
Settings Dialog
Open the built-in settings dialog for device selection:
// Show settings dialog
CometChatCalls.showSettingsDialog();
// Hide settings dialog
CometChatCalls.hideSettingsDialog();
Device Object
Each device object contains:
| Property | Type | Description |
|---|
deviceId | String | Unique identifier for the device |
label | String | Human-readable device name |
kind | String | Device type (audioinput, audiooutput, videoinput) |