Electron MediaRecorder record audio only from current window

Viewed 498

I'm trying to only record the video and audio from the current application window but I am only able to record the video and the entire desktop audio.

Here is what I have:

async function selectSource(source) {


  const constraints = {
    audio:  { 
        mandatory: {
            chromeMediaSource: 'desktop',
            chromeMediaSourceId: source.id
          }
        },
    video: {
      mandatory: {
        chromeMediaSource: 'desktop',
        chromeMediaSourceId: source.id
      }
    }
  };

  const stream = await navigator.mediaDevices
    .getUserMedia(constraints);

  const options = { mimeType: 'video/webm; codecs=vp9' };

  mediaRecorder = new MediaRecorder(stream, options);
}

Thanks

0 Answers
Related