Skip to content

Adding DesktopAudio capture op for electron - #8355

Open
UUoocl wants to merge 3 commits into
cables-gl:developfrom
UUoocl:develop
Open

Adding DesktopAudio capture op for electron#8355
UUoocl wants to merge 3 commits into
cables-gl:developfrom
UUoocl:develop

Conversation

@UUoocl

@UUoocl UUoocl commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

The electron desktopCapturer module supports system audio capture. The DesktopAudio op captures system audio and outputs an audio node.

@UUoocl

UUoocl commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

related to cables electron pull request 243

@steam0r

steam0r commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

hi, sorry for getting to this so late. thanks for your contribution. i have a few questions, though:

  • why do you need to try to get the ipcRenderer in three different ways (window, op.require, window.nodeRequire), is this really this complicated? as far as i am concerend the op.require("electron") should do.
  • later you are only accessing window.ipcRenderer, is this a session/permission thing?
  • then, later, you are also mixing ipc and op.patch.api, does that even work the way you are calling it?
  • why are you checking permissions every five seconds on macos, is this neccessary?
  • typeof CABLES !== "undefined" && CABLES.WEBAUDIO, did you encounter cases where CABLES is undefined?
  • i see some of these also in the DesktopCapture op, so maybe these are neccessary, but i would like to know how/why to make this easier

looking forward to your answers. thank you!

@UUoocl

UUoocl commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for reviewing my op and sending these questions.

  • why do you need to try to get the ipcRenderer in three different ways...?

    • the reasoning for getting the ipcRenderer in different ways is to run the op in exported patches and in the editor.
    • window.ipcRenderer is used for exported, context-isolated standalone players.
    • op.require("electron") and window.nodeRequire("electron") are fallback methods to access Electron APIs when running inside the editor's sub-frame.
    • this approach is recommended by AI, does this seem like a correct solution?
  • op.patch.api

    • this was left in by mistake.
    • I was trying to make a version with per window audio capture, but couldn't figure out how.
  • why are you checking permissions every five seconds on macos, is this neccessary?

    • this permission check was intended to be once on initialization.
    • the permission check has been changed to once on initialization and before capture starts.
  • typeof CABLES !== "undefined" && CABLES.WEBAUDIO, did you encounter cases where CABLES is undefined?

    • no, this was an AI assumption.
    • CABLES !== "undefined" has been removed.

I'll review the desktopTexture op too

@steam0r

steam0r commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

hey, thanks for keeping in there!

  • the reasoning for getting the ipcRenderer in different ways is to run the op in exported patches and in the editor.
  • window.ipcRenderer** is used for exported, context-isolated standalone players.

does this mean cables exe exports or what are context-isolated standalone players?

  • op.require("electron")** and window.nodeRequire("electron") are fallback methods to access Electron APIs when running inside the editor's sub-frame.

something like this should be sufficient, or not? asking because i am doing this in ops already and maybe don't know the edge-case where is isnt sufficient:

const electron = op.require("electron");
if(!electron || !electron.ipcRenderer) electron.ipcRenderer.send("closeApplication");

I'll review the desktopTexture op too

thanks!

Refactor getIpcRenderer function to simplify electron retrieval and handle application closure.
@UUoocl

UUoocl commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

Yes, the cables exe export is what that condition was for. Now I'm thinking it is not needed because this op will only run in the cables gl standalone editor.
Your example works in my test, and I've updated the PR to use your simplified check. Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants