daltonmenezes / electron-screen-recorder

:vhs: A Desktop screen recorder app built using web technologies for Mac, Linux and Windows.
MIT License
291 stars 48 forks source link

system audio recording is not available #2

Open tusharojha opened 4 years ago

tusharojha commented 4 years ago

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

daltonmenezes commented 4 years ago

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

alectrocute commented 4 years ago

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

aliafshany commented 3 years ago

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

https://github.com/ExistentialAudio/BlackHole

proxybee commented 3 years ago

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

daltonmenezes commented 3 years ago

@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.

ldenoue commented 2 years ago

@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());