From 9869d52608036da114f1b1a5db858628a1813bea Mon Sep 17 00:00:00 2001 From: "electron-website-docs-updater[bot]" <166660481+electron-website-docs-updater[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 16:57:37 +0000 Subject: [PATCH] =?UTF-8?q?chore:=20update=20ref=20to=20docs=20(?= =?UTF-8?q?=F0=9F=A4=96)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/latest/api/desktop-capturer.md | 6 +++++- docs/latest/api/session.md | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/latest/api/desktop-capturer.md b/docs/latest/api/desktop-capturer.md index e256e61..88379e5 100644 --- a/docs/latest/api/desktop-capturer.md +++ b/docs/latest/api/desktop-capturer.md @@ -27,7 +27,11 @@ app.whenReady().then(() => { // Grant access to the first screen found. callback({ video: sources[0], audio: 'loopback' }) }) - }) + // If true, use the system picker if available. + // Note: this is currently experimental. If the system picker + // is available, it will be used and the media request handler + // will not be invoked. + }, { useSystemPicker: true }) mainWindow.loadFile('index.html') }) diff --git a/docs/latest/api/session.md b/docs/latest/api/session.md index edd54ad..95cb261 100644 --- a/docs/latest/api/session.md +++ b/docs/latest/api/session.md @@ -960,7 +960,7 @@ session.fromPartition('some-partition').setPermissionCheckHandler((webContents, }) ``` -#### `ses.setDisplayMediaRequestHandler(handler)` +#### `ses.setDisplayMediaRequestHandler(handler[, opts])` * `handler` Function | null * `request` Object @@ -987,12 +987,18 @@ session.fromPartition('some-partition').setPermissionCheckHandler((webContents, and this is set to `true`, then local playback of audio will not be muted (e.g. using `MediaRecorder` to record `WebFrameMain` with this flag set to `true` will allow audio to pass through to the speakers while recording). Default is `false`. +* `opts` Object (optional) _macOS_ _Experimental_ + * `useSystemPicker` Boolean - true if the available native system picker should be used. Default is `false`. _macOS_ _Experimental_ This handler will be called when web content requests access to display media via the `navigator.mediaDevices.getDisplayMedia` API. Use the [desktopCapturer](latest/api/desktop-capturer.md) 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. + ```js const { session, desktopCapturer } = require('electron') @@ -1001,7 +1007,11 @@ session.defaultSession.setDisplayMediaRequestHandler((request, callback) => { // Grant access to the first screen found. callback({ video: sources[0] }) }) -}) + // Use the system picker if available. + // Note: this is currently experimental. If the system picker + // is available, it will be used and the media request handler + // will not be invoked. +}, { useSystemPicker: true }) ``` Passing a [WebFrameMain](latest/api/web-frame-main.md) object as a video or audio stream