javascript – Chrome extension: how to record microphone and system audio?

I’m trying to build a Chrome manifest v3 extension to record content from Google Meet, but no matter what I do I can’t seem to be able to record both the user’s audio and other participants’ audio.

  • navigator.mediaDevices.getUserMedia() only provides the user’s microphone input
  • navigator.mediaDevices.getDisplayMedia() only provides the system audio if the user ticks the checkbox, BUT requires the user to share his screen, which is undesirable (and the popup is nasty in itself). Also, my tests using this option have not been fruitful, the recorded audio of other users are always silent even though the stream is not muted.

Is there a way to get both the user’s mic input and the tab audio (or system audio) streams in a user-friendly way by use of the Chrome API and not the HTML5 API?

This was possible in MV2 using chrome.tabCapture and chrome.desktopCapture, but these APIs are not available in MV3. Dev page specifies “Foreground only”. That would have been ok had the tabCapture been available in content scripts which are Foreground too, but they’re undefined. Only in popup pages which is useless of course because as soon as you click someplace else the popup gets destroyed and recording stops.

Read more here: Source link