electron-screen-recorder icon indicating copy to clipboard operation
electron-screen-recorder copied to clipboard

system audio recording is not available

Open tusharojha opened this issue 4 years ago • 6 comments

Hi there I find this project interesting and helpful but at one point it's lagging i.e. system audio recording. This means if I am playing some video, song, alerts then they should be recorded with it. Currently, the output is not having any audio.

Can you please help me with this issue. Thanks

tusharojha avatar May 03 '20 16:05 tusharojha

Hi @tusharojha , this is expected. Audio isn't supported yet, PR welcome.

daltonmenezes avatar May 04 '20 14:05 daltonmenezes

Not possible currently on macOS or Windows without third party software for audio patching.

alectrocute avatar Jun 01 '20 17:06 alectrocute

Not possible currently on macOS or Windows without third party software for audio patching.

https://github.com/ExistentialAudio/BlackHole

aliafshany avatar Mar 04 '21 07:03 aliafshany

I have added audio to this, will like to know if you're open to contributions. Thanks

proxybee avatar Mar 25 '21 09:03 proxybee

@proxybee Sure, contributions are always welcome. I have no more plans to electron screen recorder as it is, it will be replaced in a near future to Astro, but I can take your contribution here to make the audio possible also to Astro. When Astro is released, this repository will be archived.

daltonmenezes avatar Mar 26 '21 04:03 daltonmenezes

@daltonmenezes to add audio, I ask for getUserMedia again and add the audio track to the desktopCapturer stream.

let stream = await navigator.mediaDevices.getUserMedia({
    audio: false,
    video: {
      mandatory: {
        chromeMediaSource: 'desktop',
        chromeMediaSourceId: mediaSourceId,
      }
    }
})
try {
    audioStream = await navigator.mediaDevices.getUserMedia({audio:true})
    audioTrack = audioStream.getAudioTracks()[0];
} catch (eaudio) {
  console.log('no audio allowed')
}
if (audioTrack)
  stream.addTrack(audioTrack);

and then to stop grabbing the audio: stream.getAudioTracks().forEach((t) => t.stop());

ldenoue avatar Nov 21 '21 15:11 ldenoue