Re: [mediacapture-output] The first "audiooutput" `MediaDeviceInfo` returned from `enumerateDevices()` is not the default device when the default device is not exposed (#133)

> It will only work in Chrome, not the spec. E.g. in the first "AirPods" example [above](https://github.com/w3c/mediacapture-output/issues/133#issuecomment-2307940368).
> 
> > And the model is competing with what?
> 
> The spec, which says the way to find the default is to assume it's the first one listed:
> 

Chromium lists the default as the first device, so no contradiction there.
I think I misunderstood the original problem because I conflated system default device with UA default device.
In Chromium they are the same and it's listed first as per the spec, but this doesn't need to be the case.

> > > ```js
> > > const defSpkr = (await mediaDevices.enumerateDevices()).find(d => d.kind == “audio-output”);
> > > ```
> 
> These are competing ways to learn the same thing, and we want web developers to adopt the interoperable way.
> 
> Chrome's virtual (large "D") Default device is listed first, so why do we need another way?
> 
We don't need another way.
So, my initial understanding was that it was not possible to know if the first exposed device is a default device, but I was conflating system default with UA default, which are not necessarily the same. 
The actual problem is that when you have a per-device permission model there is no way to know if the first exposed device is the UA default.

> There's no all-speakers permission model in https://w3c.github.io/mediacapture-output
> 

There is no mandated permission model. IIUC now, the problem here is specific to a per-device permission model.
In that case, I wouldn't be opposed to a field indicating if an entry is UA default.

> > > Chrome's deviceId: "default" on its virtual device is not a solution to the issue of providing a client app with a means to determine which exposed physical device, if any, is the user-agent default device.
> > > ...
> > > The way Chrome solves that problem right now is by setting the groupId to the same groupId of the physical device currently considered the default.
> 
> That's clever, but means web developers need to write additional code to work around Chrome's virtual Default device:
> 
> ```js
> const speakers = (await mediaDevices.enumerateDevices()).filter(({kind}) => kind == "audio-output");
> const defSpkr = speakers.reverse().find(({groupId}) => groupId == speakers[0].groupId);
> ```

I agree. That would be a solution to the problem of knowing if an entry for a physical device corresponds to the current system default device if you expose a system default device like Chromium does, but it's not a solution for the case when the UA default is one of the physical entries.


-- 
GitHub Notification of comment by guidou
Please view or discuss this issue at https://github.com/w3c/mediacapture-output/issues/133#issuecomment-2310968115 using your GitHub account


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

Received on Monday, 26 August 2024 19:54:41 UTC