<ul dir="auto">
<li>Electron version: 1.4.0</li>
<li>Operating system: OS X 10.11.6</li>
</ul>
<p dir="auto">Hi Electron team,</p>
<p dir="auto">Awesome project! Discovered this the other day and it's on our way to production!</p>
<p dir="auto">Chrome 53 has a flag <code class="notranslate">Desktop Share with tab source</code> (chrome://flags/#tab-for-desktop-share) that enables audio recording on the tab level. Is this possible on Electron?</p>
<p dir="auto">I have tried this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="var screenSource = null;
desktopCapturer.getSources({  
    types: ['window', 'screen']  
}, function(err, sources) {  
    for (let source of sources) {  
        if (source.name === 'Electron Dashboard') {  
            console.log('Found dashboard:', source);  
            screenSource = source;  
        }  
    }  
});  "><pre class="notranslate"><code class="notranslate">var screenSource = null;
desktopCapturer.getSources({  
    types: ['window', 'screen']  
}, function(err, sources) {  
    for (let source of sources) {  
        if (source.name === 'Electron Dashboard') {  
            console.log('Found dashboard:', source);  
            screenSource = source;  
        }  
    }  
});  
</code></pre></div>
<p dir="auto">and then grabbing the tab with:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="getUserMedia({
    audio: {
        mandatory: {
            chromeMediaSource: 'desktop',
            chromeMediaSourceId: screenSource.id
        },
        optional: []
    },
    video: {
        mandatory: {
            chromeMediaSource: 'desktop',
            chromeMediaSourceId: screenSource.id,
            maxWidth: window.screen.width,
            maxHeight: window.screen.height
        },
        optional: []
    }
},
function(screenStream) {
    console.log('getUserMedia on screen success', screenStream);
    // attach screenStream to local video element
},
function(err) {
    console.error('getUserMedia on tab video error:', err);
});"><pre class="notranslate"><code class="notranslate">getUserMedia({
    audio: {
        mandatory: {
            chromeMediaSource: 'desktop',
            chromeMediaSourceId: screenSource.id
        },
        optional: []
    },
    video: {
        mandatory: {
            chromeMediaSource: 'desktop',
            chromeMediaSourceId: screenSource.id,
            maxWidth: window.screen.width,
            maxHeight: window.screen.height
        },
        optional: []
    }
},
function(screenStream) {
    console.log('getUserMedia on screen success', screenStream);
    // attach screenStream to local video element
},
function(err) {
    console.error('getUserMedia on tab video error:', err);
});
</code></pre></div>
<p dir="auto">The video is captured splendidly, but audio is not. This audio recording works using my old setup, with the flag enabled and Chrome extensions. I used <code class="notranslate">chrome.desktopCapture.chooseDesktopMedia</code> and passed in the captured stream id to the above <code class="notranslate">getUserMedia</code> function as the <code class="notranslate">chromeMediaSourceId</code>.</p>
<p dir="auto">Is there something I'm doing wrong? Thanks again! Let me know if you need anything else from me.</p>
<ul dir="auto">
<li>Electron version: <code class="notranslate">0.37.0</code></li>
<li>Operating system: All</li>
</ul>
<p dir="auto">I've been trying for weeks now to figure this out, I need to somehow capture the audio output from my electron application.  But the <code class="notranslate">desktopCapturer</code> API appears to exclude that exact use case <g-emoji class="g-emoji" alias="cry" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f622.png">😢</g-emoji></p>
<p dir="auto">Is there an alternative way of performing this capture WITHOUT capturing the entire computers audio through the "screen" capturer?</p>
<p dir="auto"><a href="https://github.com/atom/electron/blob/master/docs/api/desktop-capturer.md">https://github.com/atom/electron/blob/master/docs/api/desktop-capturer.md</a></p>
<p dir="auto">Also open to any JS methods of capturing a stream from an Audio element</p>