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

> > > ```js
> > > const defSpkr = (await mediaDevices.enumerateDevices())
> > >                                    .find(d => d.kind == “audio-output” && d.deviceId == "default");
> > > ```
> > 
> > 
> > What is exactly the problem with this?
> 
> 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).
> 

What I'm saying is, what would be the problem with this if we say in the spec that the deviceId of a system default device is "default".  So far, Chromium is the only browser that exposes a system default device. Safari doesn't expose output devices at all and Firefox exposes output devices, but not a system default device (in my experience with Firefox 129, it shows the physical devices currently pointed at as default, but if you choose that devi.  


> > 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:
> 
> > > ```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?
> 
> > I haven´t thought about the details of what Chrome would do if it had a per-device permission model, but if the system default device is exposed by enumerateDevices, its ID (whatever it is) should be accepted by setSinkId and should send the output to the system default device.
> 
> There's no all-speakers permission model in https://w3c.github.io/mediacapture-output
> 
> > > 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);
> ```



-- 
GitHub Notification of comment by guidou
Please view or discuss this issue at https://github.com/w3c/mediacapture-output/issues/133#issuecomment-2310905814 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:19:59 UTC