- From: Jan-Ivar Bruaroey via GitHub <sysbot+gh@w3.org>
- Date: Mon, 26 Aug 2024 18:55:39 +0000
- To: public-webrtc-logs@w3.org
> > ```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). > 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 jan-ivar Please view or discuss this issue at https://github.com/w3c/mediacapture-output/issues/133#issuecomment-2310861311 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 18:55:40 UTC