Re: [mediacapture-main] enumerateDevices() should print correct MediaDeviceInfo (#693)

@youennf Incorporated a means to launch `pavucontrol -t 2` (Recording tab) when `getUserMedia()` is executed into https://github.com/guest271314/captureSystemAudio in order to resemble the selection option of Firefox for the ability of the user to "seamlessly" toggle the device being captured during the capture ![Screenshot_2020-06-12_13-54-55](https://user-images.githubusercontent.com/4174848/84510203-59dd7d80-acb4-11ea-8626-2864d36446ba.png)

chromiumGetUserMediaSelectAudioDevice.js

```
async function chromiumLinuxSetAudioCaptureDevice() {
  try {
    const requestNativeScript = new Map();
    const mediaStream = await navigator.mediaDevices.getUserMedia({audio: true});
    requestNativeScript.set(
      'wait',
      (ms = 50) => new Promise(resolve => setTimeout(resolve, ms))
    );
    requestNativeScript.set(
      'dir',
      await self.chooseFileSystemEntries({ type: 'open-directory' })
    );
    requestNativeScript.set(
      'status',
      await requestNativeScript.get('dir').requestPermission({ writable: true })
    );
    // inotifywait does not fire events for getFile(), or file with no content, add space character to text file
    // FileSystemFileHandle.getFile() does not open file https://bugs.chromium.org/p/chromium/issues/detail?id=1084840
    requestNativeScript.set(
      'start',
      await (
        await requestNativeScript
          .get('dir')
          .getFile('openpavucontrol.txt', { create: false })
      ).getFile()
    );
    requestNativeScript.set(
      'stop',
      await (
        await requestNativeScript
          .get('dir')
          .getFile('closepavucontrol.txt', { create: false })
      ).getFile()
    );
    // Execute File.arrayBuffer() to read file for inotifywait to fire access or open event
    // alternatively <input type="file">.click() does fire inotifywait open event
    
    const executeNativeScript = await requestNativeScript
      .get('start')
      .arrayBuffer();
    return {requestNativeScript, mediaStream};
  } catch (e) {
    throw e;
  }
}
chromiumLinuxSetAudioCaptureDevice()
.then(({
  requestNativeScript, mediaStream
}) => {
  console.log(mediaStream, requestNativeScript);
});
```

notify.sh

```
openPavuControl() {
  inotifywait -m -e open $HOME/localscripts/openpavucontrol.txt | while read file; 
  do 
    echo "$file" | grep "openpavucontrol.txt OPEN" && $HOME/localscripts/openpavucontrol.sh
  done
}
closePavuControl() {
  inotifywait -m -e open $HOME/localscripts/closepavucontrol.txt | while read file;
  do 
    echo "$file" | grep "closepavucontrol.txt OPEN" && $HOME/localscripts/closepavucontrol.sh
  done
}
openPavuControl & closePavuControl
```

chromiumGetUserMediaSelectAudioDevice.sh

```
#!/bin/bash
chromiumLinuxGetUserMediaSelectAudioDevice() {
  pavucontrol -t 2
}
chromiumLinuxGetUserMediaSelectAudioDevice
```

closepavucontrol.sh
```

#!/bin/bash
killall -9 pavucontrol
```

Since neither `getUserMedia()` nor `getDisplayMedia()` specifications unambiguously detail the procedure for capturing system audio what would be the correct way to proceed creating a specification to do precisely that: capture system audio?



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

Received on Friday, 12 June 2020 13:56:28 UTC