diff --git a/docs/api/session.md b/docs/api/session.md index 85bc096ef89d..7a15bcc82133 100644 --- a/docs/api/session.md +++ b/docs/api/session.md @@ -916,6 +916,10 @@ session.fromPartition('some-partition').setPermissionCheckHandler((webContents, Specifying a loopback device will capture system audio, and is currently only supported on Windows. If a WebFrameMain is specified, will capture audio from that frame. + * `enableLocalEcho` Boolean (optional) - If `audio` is a [WebFrameMain](web-frame-main.md) + 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`. This handler will be called when web content requests access to display media via the `navigator.mediaDevices.getDisplayMedia` API. Use the diff --git a/shell/browser/electron_browser_context.cc b/shell/browser/electron_browser_context.cc index 2fb81e26b082..44df84670561 100644 --- a/shell/browser/electron_browser_context.cc +++ b/shell/browser/electron_browser_context.cc @@ -501,13 +501,16 @@ void ElectronBrowserContext::DisplayMediaDeviceChosen( devices.audio_device = blink::MediaStreamDevice(request.audio_type, id, name); } else if (result_dict.Get("audio", &rfh)) { - devices.audio_device = blink::MediaStreamDevice( - request.audio_type, - content::WebContentsMediaCaptureId(rfh->GetProcess()->GetID(), - rfh->GetRoutingID(), - /* disable_local_echo= */ true) - .ToString(), - "Tab audio"); + bool enable_local_echo = false; + result_dict.Get("enableLocalEcho", &enable_local_echo); + bool disable_local_echo = !enable_local_echo; + devices.audio_device = + blink::MediaStreamDevice(request.audio_type, + content::WebContentsMediaCaptureId( + rfh->GetProcess()->GetID(), + rfh->GetRoutingID(), disable_local_echo) + .ToString(), + "Tab audio"); } else if (result_dict.Get("audio", &id)) { devices.audio_device = blink::MediaStreamDevice(request.audio_type, id, "System audio");