W3C home > Mailing lists > Public > public-webrtc-logs@w3.org > December 2019

Re: [mediacapture-main] Update getusermedia.html (#651)

From: Jan-Ivar Bruaroey via GitHub <sysbot+gh@w3.org>
Date: Thu, 12 Dec 2019 21:30:14 +0000
To: public-webrtc-logs@w3.org
Message-ID: <issue_comment.created-565195323-1576186212-sysbot+gh@w3.org>
> Whether the term of art used is "sink" or "source", "input" or "output", when the code at #650 (comment) is run at Firefox 70 and Nightly 73 the obbservable result is that only audio output is captured and recorded, not microphone.
> 
> Is your position that capturing audio output using the above linked code is still considered to be capturing a "sink"?

No. The [model](https://w3c.github.io/mediacapture-main/getusermedia.html#the-model-sources-sinks-constraints-and-settings) is _"Browsers provide a media pipeline from sources to sinks"_. _"A [MediaStreamTrack](https://w3c.github.io/mediacapture-main/getusermedia.html#mediastreamtrack) object represents a media source"_. Looking at your code:

> ```
>     }) => label === "Monitor of Built-in Audio Analog Stereo" // Firefox
>            || kind === "audiooutput" && groupId !== "default" // Chromium
> ```

The `device.kind` of the `"Monitor of Built-in Audio Analog Stereo"` device here in Firefox is `"audioinput"`—a virtual audio input that Firefox (or the underlying Linux OS) has chosen to expose as a  **_source_**.

The spec allows us to do this, saying _"User Agents MAY allow users to use any media source, including pre-recorded media files."_

Importantly, it is not an `"audiooutput"`. This is true even if you enable `media.setsinkid.enabled` in Firefox (i.e. not some side-effect or oversight of Firefox not exposing `"audiooutput"` devices by default).

`"audiooutput"` devices are _sinks_ for use with `setSinkId`:
```js
const devices = await navigator.mediaDevices.enumerateDevices();
const speaker = devices.find(({kind}) => kind == "audiooutput");
await element.setSinkId(speaker.deviceId);
```
A physical device that is both a source and a sink, like a mic'd headset, shows as two devices: one `"audioinput"` device and a separate `"audiooutput"`. They share the same `groupId`.

This supports having devices that are only sinks, only sources, and both. Makes sense?

-- 
GitHub Notification of comment by jan-ivar
Please view or discuss this issue at https://github.com/w3c/mediacapture-main/pull/651#issuecomment-565195323 using your GitHub account
Received on Thursday, 12 December 2019 21:30:16 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:22:34 UTC