3

In Google Meet, if you click "Present Now" then "A Chrome Tab", it brings up a window that lets you share from another tab. This is different to the standard Screen Capture API as if you simply run

navigator.mediaDevices.getDisplayMedia({
    video: true,
    audio: true,
})

you get a window where you can choose between sharing your whole screen, sharing a window, or sharing a tab. I would like to limit this to tab only. I have tried applying constraints like:

video: { displaySurface: 'browser' }

or

video: { displaySurface: { exact: 'browser' } }

however, the specs say that this doesn't work and indeed it doesn't. But if that's the case, then how does Google Meet do it?

Yousef Amar
  • 435
  • 4
  • 14

1 Answers1

8

Google Meet uses the older extension API for screensharing. This API allows restricting the source types. It is still available but requires an extension (Google meet delivers a preinstalled extensions).

The standard getDisplayMedia does not allow restricting the types of displaySurface.

Philipp Hancke
  • 11,534
  • 1
  • 15
  • 23
  • Could you elaborate on this preinstalled extension please? Is it baked into Chromium or something? – Yousef Amar Aug 30 '20 at 15:27
  • 3
    it is -- [here](https://source.chromium.org/chromium/chromium/src/+/master:chrome/browser/resources/hangout_services/thunk.js?q=thunk.js) – Philipp Hancke Aug 30 '20 at 16:29
  • 9
    Thanks for the link! It seems like it's only for *.google.com domains too. Isn't this super anti-competitive? How is Google getting away with this? – Yousef Amar Aug 30 '20 at 18:22