Capture system sound from browser Capture system sound from browser google-chrome google-chrome

Capture system sound from browser


In Chrome, the chrome.desktopCapture extension API can be used to capture the screen, which includes system audio (but only on Windows and Chrome OS and without plans for OS X or Linux). E.g.

chrome.desktopCapture.chooseDesktopMedia([    'screen', 'window' // ('tab' is not supported; use chrome.tabCapture instead)], function(streamId) {    navigator.webkitGetUserMedia({        audio: {            mandatory: {                chromeMediaSource: 'system',                chromeMediaSourceId: streamId            }        },        video: false, // We only want audio for now.    }, function(stream) {        // Do what you want with this MediaStream.    }, function(error) {        // Handle error    });});

I'm not sure whether Firefox can capture system sound, but at the very least it is capable of capturing some output (tab/window/browser/OS?).First you need to visit about:config and set media.getusermedia.audiocapture.enabled to true (this could be automated through a Firefox add-on). Then the stream can be captured as follows:

navigator.mozGetUserMedia({    audio: {        mediaSource: 'audioCapture'    },    video: false, // Just being explicit, we only want audio for now}, function(stream) {    // Do what you want with this MediaStream.}, function(error) {    // Handle error});

This was implemented in Firefox 42, at https://bugzilla.mozilla.org/show_bug.cgi?id=1156472