Skip to content

desktopCapturer: Use ScreenCaptureKit API to enable capturing loopback audio on macOS #47490

Description

@alectrocute

Preflight Checklist

Problem Description

For many years now, it has not been possible to capture loopback audio in Electron apps running on macOS. It requires installing an audio driver during install-time, which is a terrible thing for the end user. It's also a terrible thing for the dev since they have to figure out codesigning for the driver and bundling it correctly in the PKG installer.

Proposed Solution

For supported macOS versions, enable loopback audio in desktopCapturer on macOS by using the ScreenCaptureKit API to request a stream of system audio. This will probably involve bundling and distributing a codesigned Swift app or Obj-C binary.

Alternatives Considered

Oh, man. Everything.

Additional Information

Here's a Rust example: https://gist.github.com/louis030195/013fda2fa6b373f815bbeeb39e524090

And an example Swift app: https://github.com/lihaoyun6/QuickRecorder/blob/main/QuickRecorder/RecordEngine.swift

And an example Swift library (for Electron, too!): https://github.com/divyanshunegi/ElectronCaptureKit/tree/main

Activity

  1. nikwen commented on Jun 17, 2025

    @nikwen
    Member

    Thanks for the suggestion! Does Chromium use/support that API yet? If I'm not mistaken, Electron just plugs into Chromium APIs. So if Chromium doesn't support it yet, Chromium would first need to support it before Electron can.

  2. alectrocute commented on Jun 17, 2025

    @alectrocute
    Author

    Thanks for the suggestion! Does Chromium use/support that API yet? If I'm not mistaken, Electron just plugs into Chromium APIs. So if Chromium doesn't support it yet, Chromium would first need to support it before Electron can.

    Thanks @nikwen!

    Unfortunately, Chromium doesn't support it yet. I was thinking we could be a little sneaky and just include our own signed binary specifically for macOS loopback audio capture hooked into desktopCapturer's API.

    Are there any other cases where we currently do something similar in the codebase (eg. polyfill missing [desired] Chromium functionalities)?

  3. nikwen commented on Jun 17, 2025

    @nikwen
    Member

    I'm not familiar enough with that code to tell if it's a viable path.

    My suggestion would be to file an upstream bug with Chromium.

  4. alectrocute commented on Jun 18, 2025

    @alectrocute
    Author

    @nikwen Made a PR to improve docs: #47493

  5. MarshallOfSound commented on Aug 11, 2026

    @MarshallOfSound
    Member

    System audio loopback works on macOS 14.2+ as of 39 (#49717), it uses CoreAudio taps rather than SCK but that's an implementation detail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions