Skip to content

fix: address upstream Chromium shift to enable CoreAudio Tap API for audio capture used in electron's desktopCapturer (🍏 macOS). - #49717

Merged
codebytere merged 3 commits into
electron:mainfrom
Bug-Reaper:bug-reaper/audioCapturePermission
Feb 10, 2026
Merged

codebytere merged 3 commits into
electron:mainfrom
Bug-Reaper:bug-reaper/audioCapturePermission

Conversation

@Bug-Reaper

@Bug-Reaper Bug-Reaper commented Feb 8, 2026 •

Copy link
Copy Markdown
Contributor

Description of Change

Refs #49607

  1. This PR adds the NSAudioCaptureUsageDescription Info.plist key required for electron apps to use desktopCapturer. The key enables Apple's newer CoreAudio Tap API which is the new goto for chromium's plumbing responsible for desktopCapturer 1e3df01

  2. Updates documentation for desktopCapturer page to bring it up to date with macOS developments. Page has been out of date since macOS 13 when Apple introduced methods for audio-capture w/o a signed kernel extension. bc35ff5

  3. Retro-actively adds a breaking change to the V39.0.0 Breaking Changes section. Breaking change is related to chromium's use of native Apple APIs used in audio capture. bc35ff5

  4. Minor lint fix that was tripping up pre-commit hook when I went to add aforementioned docs changes. bc35ff5

🍎 : CoreAudio Tap API Reference

The new plist key is a required permission to use electron's desktopCapturer properly on macOS >= 14.2 && electron >= 39.0.0-beta4.


Additional Context

Apple quietly released a new API for doing native audio-capture and then didn't communicate well down-stream that a new Info.plist permission NSAudioCaptureUsageDescription is required.

Hope inclusion of config added in this PR can aid in downstream adoption and awareness of the new permission 🤝

In the Chromium version jump for v39.0.0-beta.4 they make the new native Apple audio API the default. So desktopCapturer abruptly stops working without the new plist entry in that version and higher. This is b/c chromium has effectively retired the old native API which didn't have plist key reqs. No fallback to the old system exists if the new system fails.

Related Website PR : electron/website#1010

Checklist

Release Notes

Notes: Addressed upstream Chromium shift to enable CoreAudio Tap API for audio capture used in electron's desktopCapturer (🍏 macOS).

@welcome

welcome Bot commented Feb 8, 2026

Copy link
Copy Markdown

💖 Thanks for opening this pull request! 💖

Semantic PR titles

We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix.

Examples of commit messages with semantic prefixes:

  • fix: don't overwrite prevent_default if default wasn't prevented
  • feat: add app.isPackaged() method
  • docs: app.isDefaultProtocolClient is now available on Linux

Commit signing

This repo enforces commit signatures for all incoming PRs.
To sign your commits, see GitHub's documentation on Telling Git about your signing key.

PR tips

Things that will help get your PR across the finish line:

  • Follow the JavaScript, C++, and Python coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made following the documentation styleguide.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@nikwen nikwen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for your work on this!

Could you please add "Refs #49607" at the beginning of the PR? That makes it easier for maintainers to find the related issue quickly.

Could you please also move over your docs changes as explained on the electron/website PR?

@VerteDinde VerteDinde added semver/patch backwards-compatible bug fixes target/39-x-y PR should also be added to the "39-x-y" branch. target/40-x-y PR should also be added to the "40-x-y" branch. target/41-x-y PR should also be added to the "41-x-y" branch. labels Feb 9, 2026
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Feb 9, 2026
@Bug-Reaper

Bug-Reaper commented Feb 10, 2026 •

Copy link
Copy Markdown
Contributor Author

Just a note, attempting to add some docs changes and I'm getting absolutely battered by the markdown pre-commit linting.


Broken Before I Got Here?

Biggest blow is getting a lint related error on a file I didn't touch?

Linting: 126 file(s)
Summary: 1 error(s)
docs/tutorial/menus.md:203:32 MD052/reference-links-images Reference links and images should use a label that is defined [Missing link or image reference definition: "sharemenu"] [Context: "[share menu][ShareMenu]"]
husky - pre-commit script failed (code 1)

Gonna rebase to see if that dislodges this issue for me. It did not, unclear how this commit was made w/o subverting the pre-commit check.


Minor Sluggification Bug

The linter fails sluggification of title ### macOS ≥14.2. Seems to incorrectly think slug should be #macos-≥142 when the correct slug should be #macos-142 (when markdown is manually placed in website repo, that's the slug).

Screenshot 2026-02-09 at 7 24 24 PM

I have changed the title to not include ≥ character as work-around but wanted to note the linting issue.


Overly eager linting

Also found out pre-commit linter

  • fails the whole commit for arbitrary markdown files that aren't even being tracked by git.
  • fails the whole commit for files not staged for commit (like WIP changes in an un-committed file)

I think it'd be nicer if linter only checked MD files that are part of the staged commit changes?

@Bug-Reaper
Bug-Reaper force-pushed the bug-reaper/audioCapturePermission branch from 48d080c to 3ff8e6e Compare February 10, 2026 01:17
@Bug-Reaper
Bug-Reaper requested a review from a team as a code owner February 10, 2026 01:17
@Bug-Reaper

Bug-Reaper commented Feb 10, 2026 •

Copy link
Copy Markdown
Contributor Author

@nikwen Just pushed in the documentation from electron/website#1010. The ported changes reflect all of your suggested adjustments as well :)


Had to fix lint issue in this file or else could not commit any documentation changes (pre-commit hook error)? Strange.

@Bug-Reaper Bug-Reaper changed the title fix: Enable CoreAudio Tap API for Audio Capture (🍏 macOS) fix: address upstream Chromium shift to enable CoreAudio Tap API for audio capture used in electron's desktopCapturer (🍏 macOS). Feb 10, 2026
@dsanders11

Copy link
Copy Markdown
Member

@Bug-Reaper, I opened electron/lint-roller#148 regarding the slugification issue, although we usually don't use special characters like ≥ and I think >= would probably slugify ok. Thanks for reporting the issue.

Biggest blow is getting a lint related error on a file I didn't touch?

This is a strange one, because in VS Code with the markdownlint extension it's properly flagged as an error, but running npx markdownlint-cli2 docs/tutorial/menus.md directly is not showing any errors on macOS, and clearly CI either. 🤔 What platform are you running into this on, Windows?

It feels like it might be a markdownlint-cli2 bug since I can't seem to get it to show up for me, but if I run npx markdownlint-cli, it is reported. Thanks for the report, that's a weird one!

@codebytere codebytere left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@codebytere
codebytere merged commit 99fce5b into electron:main Feb 10, 2026
64 checks passed
@welcome

welcome Bot commented Feb 10, 2026

Copy link
Copy Markdown

Congrats on merging your first pull request! 🎉🎉🎉

@release-clerk

release-clerk Bot commented Feb 10, 2026

Copy link
Copy Markdown

Release Notes Persisted

Addressed upstream Chromium shift to enable CoreAudio Tap API for audio capture used in electron's desktopCapturer (🍏 macOS).

trop Bot added a commit that referenced this pull request Feb 10, 2026
trop Bot added a commit that referenced this pull request Feb 10, 2026
trop Bot added a commit that referenced this pull request Feb 10, 2026
trop Bot added a commit that referenced this pull request Feb 10, 2026
@trop trop Bot added in-flight/40-x-y and removed target/39-x-y PR should also be added to the "39-x-y" branch. target/40-x-y PR should also be added to the "40-x-y" branch. labels Feb 10, 2026
@Bug-Reaper

Bug-Reaper commented Feb 10, 2026 •

Copy link
Copy Markdown
Contributor Author

@dsanders11 thanks so much for the follow up! Solid investigation :)

This is a strange one, because in VS Code with the markdownlint extension it's properly flagged as an error, but running npx markdownlint-cli2 docs/tutorial/menus.md directly is not showing any errors on macOS, and clearly CI either. 🤔 What platform are you running into this on, Windows?

Well that is strange, I'm using macOS 15.2 Sequoia. I rely on npm and not yarn though I don't think it should impact things for this case.

Had a thought, maybe stale npm libs on my end? from npm outdated:

Package                            Current    Wanted   Latest  Location                                       Depended by
@typescript-eslint/eslint-plugin    8.54.0    8.55.0   8.55.0  node_modules/@typescript-eslint/eslint-plugin  electron-PRs
@typescript-eslint/parser           8.54.0    8.55.0   8.55.0  node_modules/@typescript-eslint/parser         electron-PRs
@types/node                       24.10.12  24.10.13   25.2.3  node_modules/@types/node                       electron-PRs
@azure/storage-blob                12.30.0   12.31.0  12.31.0  node_modules/@azure/storage-blob               electron-PRs
webpack                            5.105.0   5.105.1  5.105.1  node_modules/webpack                           electron-PRs

but alas, after fresh npm install if I try to restore file to the way it was before I still get the error in the same spot.

Full log attempting to commit
 electron-PRs   👉 git commit -m "〄 : Linty linty linty"

> @electron-ci/[email protected] precommit
> lint-staged

✔ Backed up original state in git stash (d96afdacc4)
⚠ Running tasks for staged files...
  ❯ package.json — 1 file
    ↓ *.{js,ts} — no files
    ↓ *.{js,ts,d.ts} — no files
    ↓ *.{cc,mm,c,h} — no files
    ❯ *.md — 1 file
      ✖ npm run lint:docs [FAILED]
    ↓ *.{gn,gni} — no files
    ↓ *.py — no files
    ↓ docs/api/**/*.md — no files
    ↓ {*.patch,.patches} — no files
    ↓ DEPS — no files
    ↓ .github/workflows/pipeline-segment-electron-build.yml — no files
↓ Skipped because of errors from tasks.
✔ Reverting to original state because of errors...
✔ Cleaning up temporary files...

✖ npm run lint:docs:

> @electron-ci/[email protected] lint:docs
> remark docs -qf && npm run lint:js-in-markdown && npm run create-typescript-definitions && npm run lint:ts-check-js-in-markdown && npm run lint:docs-fiddles && npm run lint:docs-relative-links && npm run lint:markdown && npm run lint:api-history /Users/llama/Sorcery/electron-PRs/docs/tutorial/menus.md


> @electron-ci/[email protected] lint:js-in-markdown
> lint-roller-markdown-standard --root docs "**/*.md"


There are 0 errors in '/Users/llama/Sorcery/electron-PRs/docs'

> @electron-ci/[email protected] create-typescript-definitions
> npm run create-api-json && electron-typescript-definitions --api=electron-api.json && node spec/ts-smoke/runner.js


> @electron-ci/[email protected] create-api-json
> node script/create-api-json.mjs

- Checking argv
✔ Electron Typescript Definitions generated in "/Users/llama/Sorcery/electron-PRs/electron.d.ts" took 169ms

> @electron-ci/[email protected] lint:ts-check-js-in-markdown
> lint-roller-markdown-ts-check --root docs "**/*.md" --ignore "breaking-changes.md"


> @electron-ci/[email protected] lint:docs-fiddles
> standard "docs/fiddles/**/*.js"


> @electron-ci/[email protected] lint:docs-relative-links
> lint-roller-markdown-links --root docs "**/*.md"


> @electron-ci/[email protected] lint:markdown
> node ./script/lint.js --md

markdownlint-cli2 v0.18.1 (markdownlint v0.38.0)
Finding: CLAUDE.md CODE_OF_CONDUCT.md CONTRIBUTING.md README.md SECURITY.md shell/browser/osr/README.md script/release/bin/README.md patches/README.md patches/v8/README.md docs/README.md docs/breaking-changes.md docs/experimental.md docs/faq.md docs/glossary.md docs/why-electron.md docs/tutorial/accessibility.md docs/tutorial/application-debugging.md docs/tutorial/application-distribution.md docs/tutorial/application-menu.md docs/tutorial/asar-archives.md docs/tutorial/asar-integrity.md docs/tutorial/automated-testing.md docs/tutorial/boilerplates-and-clis.md docs/tutorial/code-signing.md docs/tutorial/context-isolation.md docs/tutorial/context-menu.md docs/tutorial/custom-title-bar.md docs/tutorial/custom-window-interactions.md docs/tutorial/custom-window-styles.md docs/tutorial/dark-mode.md docs/tutorial/debugging-main-process.md docs/tutorial/debugging-vscode.md docs/tutorial/devices.md docs/tutorial/devtools-extension.md docs/tutorial/distribution-overview.md docs/tutorial/electron-timelines.md docs/tutorial/electron-versioning.md docs/tutorial/esm.md docs/tutorial/examples.md docs/tutorial/forge-overview.md docs/tutorial/fuses.md docs/tutorial/in-app-purchases.md docs/tutorial/installation.md docs/tutorial/introduction.md docs/tutorial/ipc.md docs/tutorial/keyboard-shortcuts.md docs/tutorial/launch-app-from-url-in-another-app.md docs/tutorial/linux-desktop-actions.md docs/tutorial/mac-app-store-submission-guide.md docs/tutorial/macos-dock.md docs/tutorial/menus.md docs/tutorial/message-ports.md docs/tutorial/multithreading.md docs/tutorial/native-code-and-electron-cpp-linux.md docs/tutorial/native-code-and-electron-cpp-win32.md docs/tutorial/native-code-and-electron-objc-macos.md docs/tutorial/native-code-and-electron-swift-macos.md docs/tutorial/native-code-and-electron.md docs/tutorial/native-file-drag-drop.md docs/tutorial/navigation-history.md docs/tutorial/notifications.md docs/tutorial/offscreen-rendering.md docs/tutorial/online-offline-events.md docs/tutorial/performance.md docs/tutorial/process-model.md docs/tutorial/progress-bar.md docs/tutorial/recent-documents.md docs/tutorial/repl.md docs/tutorial/represented-file.md docs/tutorial/sandbox.md docs/tutorial/security.md docs/tutorial/snapcraft.md docs/tutorial/spellchecker.md docs/tutorial/support.md docs/tutorial/testing-on-headless-ci.md docs/tutorial/tray.md docs/tutorial/tutorial-1-prerequisites.md docs/tutorial/tutorial-2-first-app.md docs/tutorial/tutorial-3-preload.md docs/tutorial/tutorial-4-adding-features.md docs/tutorial/tutorial-5-packaging.md docs/tutorial/tutorial-6-publishing-updating.md docs/tutorial/updates.md docs/tutorial/using-native-node-modules.md docs/tutorial/using-pepper-flash-plugin.md docs/tutorial/web-embeds.md docs/tutorial/window-customization.md docs/tutorial/windows-arm.md docs/tutorial/windows-store-guide.md docs/tutorial/windows-taskbar.md docs/development/README.md docs/development/api-history-migration-guide.md docs/development/build-instructions-gn.md docs/development/build-instructions-linux.md docs/development/build-instructions-macos.md docs/development/build-instructions-windows.md docs/development/chromium-development.md docs/development/clang-tidy.md docs/development/coding-style.md docs/development/creating-api.md docs/development/debugging-on-macos.md docs/development/debugging-on-windows.md docs/development/debugging-with-symbol-server.md docs/development/debugging-with-xcode.md docs/development/debugging.md docs/development/issues.md docs/development/patches.md docs/development/pull-requests.md docs/development/reclient.md docs/development/source-code-directory-structure.md docs/development/style-guide.md docs/development/testing.md docs/development/v8-development.md docs/api/app.md docs/api/auto-updater.md docs/api/base-window.md docs/api/browser-view.md docs/api/browser-window.md docs/api/client-request.md docs/api/clipboard.md docs/api/command-line-switches.md docs/api/command-line.md docs/api/content-tracing.md docs/api/context-bridge.md docs/api/cookies.md docs/api/corner-smoothing-css.md
Linting: 126 file(s)
Summary: 1 error(s)
docs/tutorial/menus.md:203:32 MD052/reference-links-images Reference links and images should use a label that is defined [Missing link or image reference definition: "sharemenu"] [Context: "[share menu][ShareMenu]"]
husky - pre-commit script failed (code 1)

Bonus log from just running npx markdownlint-cli2 docs/tutorial/menus.md:

markdownlint-cli2 v0.18.1 (markdownlint v0.38.0)
Finding: docs/tutorial/menus.md
Linting: 1 file(s)
Summary: 1 error(s)
docs/tutorial/menus.md:203:32 MD052/reference-links-images Reference links and images should use a label that is defined [Missing link or image reference definition: "sharemenu"] [Context: "[share menu][ShareMenu]"]

although we usually don't use special characters like ≥ and I think >= would probably slugify ok

I did try two characters for the operator initially. Less-than <= (as two characters) was problematic when placed in titles. Not a bug or anything just a quirk/side-effect.

docs/tutorial/menus.md:209:11 EMD002/no-angle-brackets No unescaped opening angle brackets in text (does not play nice with MDX) [Unescaped opening angle bracket]

@dsanders11

Copy link
Copy Markdown
Member

I rely on npm and not yarn though I don't think it should impact things for this case.

Actually I think that's the explanation for the discrepancy. npm install will not make use of yarn.lock so you got a newer version of micromark-core-commonmark.

Be sure to use yarn install for Electron to ensure that the lockfile is used and you get the same versions of packages as in CI. 👍

@Bug-Reaper

Copy link
Copy Markdown
Contributor Author

Actually I think that's the explanation for the discrepancy. npm install will not make use of yarn.lock so you got a newer version of micromark-core-commonmark.

You're right @dsanders11 - Restored yarn.lock and ran yarn install and it let me commit the file no problem. What an odd edge case, I'll be sure to make sure I'm using a fresh yarn install in future PRs!

Thanks again for your investigation!

codebytere pushed a commit that referenced this pull request Feb 11, 2026
…r audio capture used in electron's `desktopCapturer` (🍏 macOS). (#49740)

* fix: Enable CoreAudio Tap API for Audio Capture (🍏 macOS)

Co-authored-by: Bug-Reaper <[email protected]>

* fix: addressed markdown issue which caused pre-commit hook failure

🧑‍🔧 : Ref : #49717 (comment)

Co-authored-by: Bug-Reaper <[email protected]>

* fix: updated docs to cover `desktopCapturer` nuances with macOS

📝 : PR #49717

Co-authored-by: Bug-Reaper <[email protected]>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Bug-Reaper <[email protected]>
@trop trop Bot added merged/39-x-y PR was merged to the "39-x-y" branch. and removed in-flight/39-x-y labels Feb 11, 2026
codebytere pushed a commit that referenced this pull request Feb 11, 2026
…r audio capture used in electron's `desktopCapturer` (🍏 macOS). (#49739)

* fix: Enable CoreAudio Tap API for Audio Capture (🍏 macOS)

Co-authored-by: Bug-Reaper <[email protected]>

* fix: addressed markdown issue which caused pre-commit hook failure

🧑‍🔧 : Ref : #49717 (comment)

Co-authored-by: Bug-Reaper <[email protected]>

* fix: updated docs to cover `desktopCapturer` nuances with macOS

📝 : PR #49717

Co-authored-by: Bug-Reaper <[email protected]>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Bug-Reaper <[email protected]>
@trop trop Bot added merged/41-x-y PR was merged to the "41-x-y" branch. and removed in-flight/41-x-y labels Feb 11, 2026
jkleinsc pushed a commit that referenced this pull request Feb 12, 2026
jkleinsc pushed a commit that referenced this pull request Feb 12, 2026
codebytere pushed a commit that referenced this pull request Feb 13, 2026
…r audio capture used in electron's `desktopCapturer` (🍏 macOS). (#49741)

* fix: Enable CoreAudio Tap API for Audio Capture (🍏 macOS)

Co-authored-by: Bug-Reaper <[email protected]>

* fix: addressed markdown issue which caused pre-commit hook failure

🧑‍🔧 : Ref : #49717 (comment)

Co-authored-by: Bug-Reaper <[email protected]>

* fix: updated docs to cover `desktopCapturer` nuances with macOS

📝 : PR #49717

Co-authored-by: Bug-Reaper <[email protected]>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Bug-Reaper <[email protected]>
@trop trop Bot added merged/40-x-y PR was merged to the "40-x-y" branch. and removed in-flight/40-x-y labels Feb 13, 2026
csett86 added a commit to jitsi/jitsi-meet-electron that referenced this pull request Feb 13, 2026
With electron/electron#49717 the desktopCapturer
supports system audio for macOS 13 and above. Is was recently fixed
in electron/electron#49740 for current
electron.

This is a preparational step, but:

This on its own does not allow audio for screenshare, as its currently
hard-coded to only show the "Share Audio" button on windows, see
https://github.com/jitsi/jitsi-meet/blob/master/react/features/screen-share/functions.ts#L34

@nikwen nikwen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for moving the docs over. Didn't get a chance to take a look at it before it was merged.

> [!NOTE]
> Capturing the screen contents requires user consent on macOS 10.15 Catalina or higher,
> which can detected by [`systemPreferences.getMediaAccessStatus`][].

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Would this newline break the NOTE block syntax?

app.commandLine.appendSwitch('disable-features', 'MacCatapLoopbackAudioForScreenShare')
```

---

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually, we don't use horizontal dividers in our docs.


### MacOS versions 12.7.6 or lower

`navigator.mediaDevices.getUserMedia` does not work on macOS versions 12.7.6 and prior for audio capture due to a fundamental limitation whereby apps that want to access the system's audio require a [signed kernel extension](https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/KernelExtensions/KernelExtensions.html). Chromium, and by extension Electron, does not provide this. Only in macOS 13 and onwards does Apple provide APIs to capture desktop audio without the need for a signed kernel extension.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually break docs lines between 80 and 100 chars as per the docs style guide.

(I know that the surrounding lines do not necessarily do this. We usually still try to follow it in new documentation that we write.)

Comment thread docs/breaking-changes.md

Per [Chromium update](https://source.chromium.org/chromium/chromium/src/+/ad17e8f8b93d5f34891b06085d373a668918255e) which enables Apple's newer [CoreAudio Tap API](https://developer.apple.com/documentation/CoreAudio/capturing-system-audio-with-core-audio-taps#Configure-the-sample-code-project) by default, you now must have `NSAudioCaptureUsageDescription` defined in your `Info.plist` to use `desktopCapturer`.

Electron's `desktopCapturer` will create a dead audio stream if the new permission is absent however no errors or warnings will occur. This is partially a side-effect of Chromium not falling back to the older `Screen & System Audio Recording` permissions system if the new system fails.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Electron's `desktopCapturer` will create a dead audio stream if the new permission is absent however no errors or warnings will occur. This is partially a side-effect of Chromium not falling back to the older `Screen & System Audio Recording` permissions system if the new system fails.
Electron's `desktopCapturer` will create a dead audio stream if the new permission is absent. However, no errors or warnings will occur. This is partially a side-effect of Chromium not falling back to the older `Screen & System Audio Recording` permissions system if the new system fails.

kycutler pushed a commit to kycutler/electron that referenced this pull request Feb 26, 2026
…r audio capture used in electron's `desktopCapturer` (🍏 macOS). (electron#49717)

* fix: Enable CoreAudio Tap API for Audio Capture (🍏 macOS)

* fix: addressed markdown issue which caused pre-commit hook failure

🧑‍🔧 : Ref : electron#49717 (comment)

* fix: updated docs to cover `desktopCapturer` nuances with macOS

📝 : PR electron#49717
akhmialeuski added a commit to akhmialeuski/advanced-audio-recorder that referenced this pull request Oct 23, 2026
…n 39.6+ (#138)

## What changes and why

A Mac user can now record the other side of a call with **Include system
audio** or a **System audio (this computer)** track, on macOS 14.2 or
later in an Obsidian installer built on Electron 39.6 or later, without
BlackHole and a Multi-Output device. Until now one platform check in
`loopbackHost()` (`process.platform !== 'win32'`) refused it with
"Recording the system output directly is granted on Windows only",
although the capture path (`setDisplayMediaRequestHandler` with `audio:
'loopback'` plus `desktopCapturer`) works on a current Mac, as the
reporter verified on macOS 27 with Electron 43. Closes
[#137](#137).

Chromium captures a Mac's output through Apple's CoreAudio tap, which
arrived in macOS 14.2 and became the default in Electron 39
([electron/electron#49717](electron/electron#49717),
and the maintainer's answer in
[electron/electron#47490](electron/electron#47490)).
The tap also needs the `NSAudioCaptureUsageDescription` key in the app's
`Info.plist`, which Electron's default `Info.plist` carries only from
v39.6.0
([electron/electron#49740](electron/electron#49740)).
Without the System Audio Recording permission the grant still returns an
audio track, created already `ended` and never delivering a sample, with
no error raised. Without the Screen Recording permission
`desktopCapturer.getSources` rejects with "Failed to get sources", which
is what the issue reports.

## Changes

Functional:

- `grantPlatform()` and `macRefusal()` in
`src/recording/systemAudioSupport.ts` grant `darwin` when the host
reports macOS 14.2 or later (`process.getSystemVersion()`) and Electron
39.6 or later. A Mac below either floor, or one that reports no version,
is refused before the host is asked, so the user never sees the
screen-recording prompt only to record silence. The refusal names the
version that falls short and, for Electron, points to the installer,
because Obsidian's in-app updates do not replace it.
- `leadingVersion()` compares the first two numbers as numbers, so
`14.10` passes the 14.2 floor and a pre-release such as `43.0.0-beta.4`
passes 39.6.
- On a Mac, five failures send the user to System Settings > Privacy &
Security > Screen & System Audio Recording (Screen Recording on macOS
14), adding Obsidian with the + button if it is not listed, then
quitting and reopening Obsidian, and offer BlackHole instead of Stereo
Mix or VB-CABLE: a refused source list, no screen, `NotAllowedError`, no
audio track, and an audio track that arrives already ended.
- The + button is in the step because macOS may never prompt on this
path: Electron raises no permission prompt for a source the app picks
itself rather than through the system picker
([electron/electron#52738](electron/electron#52738)),
so Obsidian can be missing from the list.
- `audioOnly()` reads the audio track's state before stopping the video
track, so a track that arrived ended (the macOS permission symptom) is
told apart from one the video stop took down with it.
- `isSystemAudioLoopbackAvailable()` is replaced by
`systemAudioGrantSupport()`, which returns `{ refusal, permission }`
from one probe of the host. The Windows wording is unchanged, except the
answer with no audio track, which no longer says "elsewhere".
- The **Include system audio** and **Track N source** rows show the
refusal word for word, as a refused recording would end, and show the
macOS permission where the grant is available.
- System info gains `osVersion`, read by the new `hostSystemVersion()`
in `src/platform/hostProcess.ts`, and `systemAudioLoopbackRefusal`.
- `docs/use-cases/meeting-notes-workflow.md` covers the macOS route: the
permission step with the + button, the version floors, a checklist item
and two troubleshooting entries. `docs/troubleshooting.md` gains a "This
computer's output is not recorded" section with one entry per refusal
reason. `docs/recording.md`, `docs/multi-track-recording.md`,
`docs/settings-reference.md`, `docs/features.md`, `docs/index.md` and
`README.md` say the same. Release notes are left to the release PR, per
`docs/dev/releasing.md`.

Tests:

- `tests/unit/systemAudioSupport.test.ts` covers granted Macs (the floor
itself, the reporter's machine, `14.10`, a bare `26`, `43.0.0-beta.4`),
refused Macs (macOS 14.1, 13.x, a missing or empty version, Electron
39.5.2, the Electron 39.2.6 of the Obsidian 1.11.4 installer, Electron
38, a missing or invalid Electron, both too old, a throwing
`getSystemVersion`), all refused before `getDisplayMedia` or the handler
is touched, and the five Mac permission failures with the + button step,
the BlackHole fallback, and an ended-on-arrival track against one ended
with the video on both platforms.
- `tests/integration/settingsDefinitions.test.ts` covers the macOS
permission on both rows, the version reason on an old Mac, no permission
text on Windows, and the Linux refusal.
- `tests/integration/SystemDiagnostics.test.ts` covers `osVersion` and
the refusal reason or null, and `tests/unit/hostProcess.test.ts` covers
`hostSystemVersion` absent, empty, throwing and with no process.

## Verification

The local gate on
[cb5fa63](cb5fa63)
is green. `npm run build` passes, and `npm run lint` reports 0 errors
and the 2 existing warnings. `npm run test:coverage -- --randomize`
(seed 483263896) passes 7759 of 7759 tests in 325 suites. An earlier run
of the same tree (seed -310868346) timed out once in
`tests/e2e/recordingPanel.e2e.test.ts`, whose test takes 52 ms alone and
passes with that seed. `coverage-diff` finds no regression, with total
branches at 96.35% against a baseline of 96.22%. `layer-check`,
`test-conventions` and `clone-check` stay within their ceilings.

The settings rows were rendered from a dump of the real settings tab. On
Windows the **Include system audio** and **Track N source** text is
unchanged, so `docs/images/settings-audio-input.png`,
`settings-include-system-audio.png` and `settings-multi-track.png` still
show the current rows and are not replaced.

Nothing has run on a real Mac. Every macOS case runs against a mocked
`process`, `desktopCapturer` and `getDisplayMedia`. The issue author
offered to test a build on macOS before the release, which would confirm
the permission messages, the version floors, and whether Obsidian
appears in the permission list on its own.

## Risks and what to review first

- The Electron floor is 39.6, the first 39.x whose `Info.plist` carries
`NSAudioCaptureUsageDescription`. The Obsidian 1.11.4 installer runs
Electron 39.2.6, and its DMG holds `NSMicrophoneUsageDescription` but no
`NSAudioCaptureUsageDescription`, while the 1.12.4 installer on Electron
39.7.0 holds both, so 1.11.4 is refused with the installer advice
instead of being sent to a permission that cannot help. Electron 40.0 to
40.4 lack the key too and would pass the floor, but no Obsidian
installer was built on them: the changelog lists 39.2.6, 39.7.0, 39.8.3
and then 43.x.
-
[electron/electron#52738](electron/electron#52738)
is open and describes exactly this call path (`useSystemPicker: false`):
the track arrives ended and macOS shows no prompt. The plugin handles it
by naming the permission and the + button, and the reporter of
[#137](#137)
recorded successfully after granting it by hand, but a fix in Electron
could change what macOS does on this path.
- `systemAudioGrantSupport()` replaces an exported function, and every
caller in `src/` was moved to it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged/39-x-y PR was merged to the "39-x-y" branch. merged/40-x-y PR was merged to the "40-x-y" branch. merged/41-x-y PR was merged to the "41-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants