setDisplayMediaRequestHandler
This handler will be called when web content requests access to display media via the navigator.mediaDevices.getDisplayMedia API. Use the desktopCapturer API to choose which stream(s) to grant access to.
useSystemPicker allows an application to use the system picker instead of providing a specific video source from getSources. This option is experimental, and currently available for MacOS 15+ only. If the system picker is available and useSystemPicker is set to true, the handler will not be invoked.
Passing a WebFrameMain object as a video or audio stream captures the whole webContents that contains that frame (the tab), not just the frame: request.frame from an <iframe> therefore grants that iframe a capture of the page that embeds it. Check request.frame before using it this way, and note that the callback throws if the frame has been destroyed by the time it is called.
Passing null instead of a function resets the handler to its default state.