A short conversational Q&A (from a YouTube video by Tsahi Levent-Levi) about whether WebRTC screen sharing can bypass Chrome's screen-share picker. The speakers state that Chrome will always show the picker for security reasons, but note two practical workarounds: (1) automated/browser testing environments can preselect via command-line flags (e.g., Puppeteer/Selenium), and (2) in self-controlled apps (Electron or custom Chromium builds) developers can implement their own picker or control sharing. The OS may still impose constraints.
Chapters
So how do we screen share using WebRTC without the pop up prompt in Chrome?
You can't do that for security reasons.
Okay, so I cannot ask, for example, to be able to screen share immediately when I go get a user to a URL?
No, Chrome will always show the screen share picker because any JavaScript code could run that function. And if it just got access to the screen, that would allow a malicious website to record your screen and see what you're doing there. And that's not something that is going to fly.
Okay, so the first part of our answer is you can't. How can I do that if I really, really want to?
If you are using something like automated tests, there are flags for pre selecting what gets picked, but they're command line flags, so you will not convince any actual user to ever do that.
Wait, so it means that I can use it in things like Puppeteer or Selenium, where automate browsers. So if my use case is that where I want to share the screen for something from these types of devices or automated bots machines, whatever. I can do that.
You can do that.
It also means that I can do it from things like Electron or my own Chromium or.
Yes, yes, if you have. If you're doing Electron. Electron uses a slightly different API and actually requires you to implement your own picker.
Okay, so essentially if I own and control the code of my application and not rely on Chrome as an external application, I can do whatever I want?
Yes. Well, the operating system keeps you from doing that in your own application because it is getting access to the screen recording as well. And sometimes Chrome and the operating system get into each other's way while you try to screen share and then things go south for the user.