[mediacapture-output] Adding "subkind" in MediaDeviceInfo (for detection headphones) (#125)

hoch has just created a new issue for https://github.com/w3c/mediacapture-output:

== Adding "subkind" in MediaDeviceInfo (for detection headphones) ==
## Summary

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.

## Proposal

```webidl
[Exposed=Window, SecureContext]
partial interface MediaDeviceInfo {
  readonly attribute MediaDeviceSubkind subkind;
};

enum MediaDeviceSubkind {
  "unknown",
  "headphones",
  "speakers"
};
```

## Example

```js
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.


Please view or discuss this issue at https://github.com/w3c/mediacapture-output/issues/125 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 30 September 2021 14:18:50 UTC