hokein / electron-sample-apps

Sample apps for Electron
Apache License 2.0
3.91k stars 934 forks source link

[Desktop Capture] Why use GetUserMedia with chromeMediaSource : 'desktop', focus on the window application? #62

Open jbeurel opened 5 years ago

jbeurel commented 5 years ago

Hi.

Like in the Desktop Capture example, I use getUserMedia() (or webkitGetUserMedia()) to get the Desktop app video stream:

navigator.mediaDevices
      .getUserMedia({
        audio: false,
        video: {
          mandatory: {
            chromeMediaSource: 'desktop',
            chromeMediaSourceId: source.id,
            minWidth: 1920,
            maxWidth: 1920,
            minHeight: 1080,
            maxHeight: 1080,
            maxFrameRate: 25,
          },
        },
      })
      .then()
      .catch();

When I use this function, the window selected is focused and go to the foreground. How to avoid this behaviour? I need to stay focused on my Electron application.

Thanks a lot.

Jo.