Re: [mediacapture-main] Support capturing audio output from sound card (#629)

@aboba The closure of this issue leads to other questions. 

If capturing from a source card were not possible at all and if implementations did not provide a means to create fake media devices and fake input streams available to the main thread then closure of this would be in accord with the position that capturing from an output device (or any other device, virtual or otherwise) is simply not possible under the umbrella of this specification.

However, since browsers already **do** allow for setting a fake media device and fake input media stream the question then becomes what is the canonical procedure to create a specification compliant fake media device and fake media stream from a file (https://chromium.googlesource.com/chromium/src/+/4cdbc38ac425f5f66467c1290f11aa0e7e98c6a3/media/audio/fake_audio_output_stream.cc; https://chromium.googlesource.com/chromium/src/+/4cdbc38ac425f5f66467c1290f11aa0e7e98c6a3/media/audio/fake_audio_manager.cc; https://stackoverflow.com/a/40783725). 

It is not as if the substance of this feature request is not already possible. Am asking for the functionality to be officially standardized. Instead of now having to embark on writing and implementing to code outside of the official standard (https://github.com/auscaster/webrtc-native-to-browser-peerconnection-example), if only to prove the requirement is possible and not specifying the same will only lead to disparate code in the wild that will eventually lead right back to this specification. 

`chromium-browser --allow-file-access-from-files --autoplay-policy=no-user-gesture-required --use-fake-device-for-media-stream --use-fake-ui-for-media-stream --use-file-for-fake-audio-capture=$HOME/test.wav%noloop --user-data-dir=$HOME/test 'file:///home/user/testUseFileForFakeAudioCaptureChromium.html'`

```
navigator.mediaDevices.getUserMedia({audio: true})
.then(mediaStream => {
  const ac = new AudioContext();
  const source = ac.createMediaStreamSource(mediaStream);
  source.connect(ac.destination);
});
```

The problem is that implementation has several bugs that can be fixed by the official specification body, to allow for creation of a `MediaStream` (`MediaStreamTrack`) directly from a file using, if necessary, a created fake device. In part, because this specification refuses to acknowledge that capturing `Monitor from <device>` is a concreate use case that is well within the purview of this standard.

Will ask the question ("How to create a fake media device and MediaStream from a file") officially in an issue. 

-- 
GitHub Notification of comment by guest271314
Please view or discuss this issue at https://github.com/w3c/mediacapture-main/issues/629#issuecomment-572639862 using your GitHub account

Received on Thursday, 9 January 2020 16:29:08 UTC