Overview
TheJitsiMediaDevices class provides utilities for managing media devices in Jitsi. It handles device enumeration, permission checking, and audio output device selection.
Constructor
JitsiMediaDevices object. There will be a single instance of this class accessible via JitsiMeetJS.mediaDevices.
Methods
init()
Initializes the media devices manager. Starts listening for device changes and initializes permission checks.This method is marked as internal and is automatically called by the library.
enumerateDevices()
Executes a callback with a list of media devices connected.Function
required
Function that will be called with an array of MediaDeviceInfo objects
isDeviceChangeAvailable()
Returns true if changing the input (camera/microphone) or output (audio) device is supported.string
Type of device to check. Options:
undefinedor'input'- Check for input device change support (default)'output'- Check for audio output device change support
boolean
True if device change is available, false otherwise
isDevicePermissionGranted()
Checks if the permission for the given device was granted.MediaType
Type of device to check:
'audio'- Check microphone permission'video'- Check camera permissionundefined- Check both audio and video permissions
Promise
Resolves with true if permission is granted, false otherwise
isMultipleAudioInputSupported()
Returns true if it is possible to simultaneously capture audio from more than one device.boolean
True if multiple audio inputs are supported, false otherwise
Returns false for Firefox versions below 101 and iOS browsers.
getAudioOutputDevice()
Returns the currently used audio output device ID.string
The device ID of the current audio output device, or ‘default’ for the default device
setAudioOutputDevice()
Sets the current audio output device.string
required
ID of ‘audiooutput’ device from navigator.mediaDevices.enumerateDevices(), or ‘default’ for default device
Promise
Resolves when audio output is changed, rejects otherwise
Events
JitsiMediaDevices extends the Listenable class and emits the following events:DEVICE_LIST_CHANGED
Fired when the list of available media devices changes (devices connected/disconnected).PERMISSIONS_CHANGED
Fired when media permissions change.Example Usage
Enumerate Devices
Check Permissions
Change Audio Output Device
Listen for Device Changes
Check Browser Capabilities
MediaDeviceInfo Object
TheenumerateDevices() callback receives an array of MediaDeviceInfo objects with the following properties:
string
Unique identifier for the device
string
The kind of device: ‘audioinput’, ‘videoinput’, or ‘audiooutput’
string
Human-readable device name (empty string if permission not granted)
string
Group identifier (devices in the same physical device share the same group ID)