Adds .subkind field MediaDeviceInfo to indicate the nature of the output device, specifically for personal listening devices. (e.g. headphones, headset, or earbuds)
Potential use cases:
An application can dynamically change the audio processing model according to the number of channels of the reproduction device. (e.g. 5.1 channels to 2 channels)
An application can use the binaural audio (e.g. HRTF) format for the 3D spatialization when a personal listening device is detected.
The audio content can be enhanced with the “personalized profile” when a personal listening device is detected. (e.g. loudness or equalizer setting)
Some parts of audio content can be omitted on a non-personal listening device.
let oldDeviceList_ = [];
const onDeviceChange = async (event) => {
const newDeviceList = await navigator.MediaDevices.enumerateDevices();
const newDeviceInfo = detectNewDevice(oldDeviceList_, newDeviceList);
if (newDeviceInfo && newDeviceInfo.kind === 'audiooutput' &&
newDeviceInfo.subkind === 'headphones') {
useBinauralAudio(newDeviceInfo);
}
oldDeviceList_ = newDeviceList;
}
const detectNewDevice = (oldDeviceList, newDeviceList) => {
// Compare two device lists and return a MediaDeviceInfo object if there is
// a newly detected device in |newDeviceList|.
};
Privacy Concerns
This information is already guarded by an explicit user permission via getUserMedia(). Note that when the permission is granted the device information exposed by MediaDevices.enumerateDevices() call is already abundant. (e.g. device name, unique ID, device kind) The device information obtained from MediaDevices.enumerateDevices() without a permission does NOT expose this field.
Summary
Adds
.subkind
fieldMediaDeviceInfo
to indicate the nature of the output device, specifically for personal listening devices. (e.g. headphones, headset, or earbuds)Potential use cases:
Proposal
Example
Privacy Concerns
This information is already guarded by an explicit user permission via
getUserMedia()
. Note that when the permission is granted the device information exposed byMediaDevices.enumerateDevices()
call is already abundant. (e.g. device name, unique ID, device kind) The device information obtained fromMediaDevices.enumerateDevices()
without a permission does NOT expose this field.