WebCord icon indicating copy to clipboard operation
WebCord copied to clipboard

Feature/screenshare with audio

Open kakxem opened this issue 2 years ago • 17 comments

kakxem avatar Dec 15 '22 23:12 kakxem

I resolved the conflicts, but I can't try the changes until this weekend.

kakxem avatar Dec 15 '22 23:12 kakxem

Builds are failing:


Error: sources/code/common/main.ts(127,8): error TS2307: Cannot find module 'node-pipewire' or its corresponding type declarations.
Error: sources/code/main/windows/main.ts(29,35): error TS2307: Cannot find module 'node-pipewire/build/types' or its corresponding type declarations.
Error: sources/code/main/windows/main.ts(49,10): error TS2307: Cannot find module 'node-pipewire' or its corresponding type declarations.
Error: sources/code/main/windows/main.ts(56,54): error TS7006: Parameter 'node' implicitly has an 'any' type.
Error: sources/code/main/windows/main.ts(59,38): error TS7006: Parameter 'node' implicitly has an 'any' type.
Error: sources/code/main/windows/main.ts(576,18): error TS2307: Cannot find module 'node-pipewire' or its corresponding type declarations.
Error: sources/code/main/windows/main.ts(579,69): error TS7006: Parameter 'node' implicitly has an 'any' type.
Error: sources/code/main/windows/main.ts(580,67): error TS7006: Parameter 'node' implicitly has an 'any' type.
Error: sources/code/main/windows/main.ts(583,71): error TS7006: Parameter 'node' implicitly has an 'any' type.
Error: sources/code/main/windows/main.ts(583,77): error TS7006: Parameter 'index' implicitly has an 'any' type.
Error: sources/code/main/windows/main.ts(616,22): error TS2307: Cannot find module 'node-pipewire' or its corresponding type declarations.
Error: sources/code/main/windows/main.ts(626,71): error TS7006: Parameter 'port' implicitly has an 'any' type.
Error: sources/code/main/windows/main.ts(628,47): error TS7006: Parameter 'link' implicitly has an 'any' type.
Error: sources/code/main/windows/main.ts(640,65): error TS7006: Parameter 'node' implicitly has an 'any' type.
Error: Final attempt failed. Child_process exited with error code 1

orowith2os avatar Dec 17 '22 20:12 orowith2os

I test this package with archlinux + wayland, and it work fine! i can screenshare and everything looks fine! Native discord can't do that. Thx for it <3

linuxmobile avatar Jan 20 '23 13:01 linuxmobile

@kakxem I built this on Arch and NixOS, my streams do not transmit any sound at all. Wayland + Pipewire (tried it on Hyprland, Gnome, Awesome)

IceDBorn avatar Jan 27 '23 00:01 IceDBorn

Using this now, one question. There's no window share available? I appear to only be able to select entire screens and not windows.

SpookySkeletons avatar Feb 24 '23 15:02 SpookySkeletons

That depends on your compositor, wlroots is limited to full screens. Other compositors are fine.

orowith2os avatar Feb 24 '23 17:02 orowith2os

Using kwin, anything odd in my setup I can check?

SpookySkeletons avatar Mar 04 '23 03:03 SpookySkeletons

Not working for me. Screen sharing working, but no audio sink listed in Pipewire. It appears that the node-pipewire module isn't loading?

Built with @\SpacingBat3's PKGBUILD for webcord-git

Error: Cannot find module './index.node'
Require stack:
- /usr/share/webcord/app.asar/node_modules/node-pipewire/build/index.js
- /usr/share/webcord/app.asar/app/code/common/modules/node-pipewire-provider.js
- /usr/share/webcord/app.asar/app/code/main/windows/main.js
- /usr/share/webcord/app.asar/app/code/common/main.js
- /usr/lib/electron/resources/default_app.asar/main.js
- 
    at Module._resolveFilename (node:internal/modules/cjs/loader:963:15)
    at Function.n._resolveFilename (node:electron/js2c/browser_init:2:109411)
    at Module._load (node:internal/modules/cjs/loader:811:27)
    at Function.f._load (node:electron/js2c/asar_bundle:2:13330)
    at Module.require (node:internal/modules/cjs/loader:1035:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/usr/share/webcord/app.asar/node_modules/node-pipewire/src/node/index.ts:4:17)
    at Module._compile (node:internal/modules/cjs/loader:1141:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1196:10)
    at Module.load (node:internal/modules/cjs/loader:1011:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/share/webcord/app.asar/node_modules/node-pipewire/build/index.js',
    '/usr/share/webcord/app.asar/app/code/common/modules/node-pipewire-provider.js',
    '/usr/share/webcord/app.asar/app/code/main/windows/main.js',
    '/usr/share/webcord/app.asar/app/code/common/main.js',
    '/usr/lib/electron/resources/default_app.asar/main.js',
    undefined
  ]
}

GraithTiger avatar Mar 04 '23 19:03 GraithTiger

Not working for me. Screen sharing working, but no audio sink listed in Pipewire. It appears that the node-pipewire module isn't loading?

Built with @\SpacingBat3's PKGBUILD for webcord-git

Error: Cannot find module './index.node'
Require stack:
- /usr/share/webcord/app.asar/node_modules/node-pipewire/build/index.js
- /usr/share/webcord/app.asar/app/code/common/modules/node-pipewire-provider.js
- /usr/share/webcord/app.asar/app/code/main/windows/main.js
- /usr/share/webcord/app.asar/app/code/common/main.js
- /usr/lib/electron/resources/default_app.asar/main.js
- 
    at Module._resolveFilename (node:internal/modules/cjs/loader:963:15)
    at Function.n._resolveFilename (node:electron/js2c/browser_init:2:109411)
    at Module._load (node:internal/modules/cjs/loader:811:27)
    at Function.f._load (node:electron/js2c/asar_bundle:2:13330)
    at Module.require (node:internal/modules/cjs/loader:1035:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/usr/share/webcord/app.asar/node_modules/node-pipewire/src/node/index.ts:4:17)
    at Module._compile (node:internal/modules/cjs/loader:1141:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1196:10)
    at Module.load (node:internal/modules/cjs/loader:1011:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/share/webcord/app.asar/node_modules/node-pipewire/build/index.js',
    '/usr/share/webcord/app.asar/app/code/common/modules/node-pipewire-provider.js',
    '/usr/share/webcord/app.asar/app/code/main/windows/main.js',
    '/usr/share/webcord/app.asar/app/code/common/main.js',
    '/usr/lib/electron/resources/default_app.asar/main.js',
    undefined
  ]
}

@GraithTiger Native Node.js modules extracting/building (they can't be in app.asar and might be needed to be rebuilt according to Electron docs) is currently unsupported by my PKGBUILD. You can't use it for this repo, sorry.

SpacingBat3 avatar Mar 04 '23 22:03 SpacingBat3

KDE appears to have two different screen sharing portals? I think the default is screen only.

SpookySkeletons avatar Mar 09 '23 23:03 SpookySkeletons

@GraithTiger Native Node.js modules extracting/building (they can't be in app.asar and might be needed to be rebuilt according to Electron docs) is currently unsupported by my PKGBUILD. You can't use it for this repo, sorry.

I was able to get it working by compiling a separate node-pipewire package and including it in the dependencies along with a few other tweaks. Audio sharing appears to be working properly now.

System info: Kernel: 6.1.9-arch1-2 Desktop: KDE Plasma 5.27.2 Compositor: KWin-X11 Pipewire 0.3.66

GraithTiger avatar Mar 17 '23 06:03 GraithTiger

Using this now, one question. There's no window share available? I appear to only be able to select entire screens and not windows.

@SpookySkeletons This appears to be an issue with the latest version of electron (not sure if this is a known/reported bug?) as downgrading from major version 22 to 21 solved the issue you mentioned for me, giving me the choice to choose either a screen or a window.

Otherwise I can say that audio sharing seems to be working fine on both x11 and wayland (Arch, KDE Plasma), even streamed gameplay for a couple of hours when I had initially intended to just test to see if the feature was working.

PhantomShift avatar Mar 25 '23 00:03 PhantomShift

@PhantomShift Any word on latest electron 24? Webcord just updated latest 4.2.0 build to it.

EDIT: I am unable to downgrade as electron sub 23 suffers a bug that crashes the renderer during long call sessions.

SpookySkeletons avatar Apr 13 '23 20:04 SpookySkeletons

@SpookySkeletons I just made this issue in the brave browser https://github.com/brave/brave-browser/issues/29710 since well I guess they can at least post an issue in chromium issue tracker so yeah that's cool

  • there is also already a bug report made by me as well here https://github.com/SpacingBat3/WebCord/issues/402
  • do you guys have any temporary solutions to this issue

beh-10257 avatar Apr 13 '23 21:04 beh-10257

Hello, may we get a rebase of this branch to help anyone wanting to still roll these patches?

SpookySkeletons avatar Oct 18 '23 15:10 SpookySkeletons

@SpacingBat3, the last pipeline says something about 'enums' in lines 391, 394, 395...

I'm checking the code and I found the enums you've used for representing different favicon states could be causing the error. Could you please check this particular part of your code?

Thanks!

kakxem avatar Nov 21 '23 21:11 kakxem

Could you please check this particular part of your code?

If that's since the new TypeScript - will do once I'll move myself to it, right now I'm nowhere near my main dev machine and I might lack of the time...

SpacingBat3 avatar Nov 21 '23 23:11 SpacingBat3

Is this relevant anymore, given #154 ?

ThatOneCalculator avatar Feb 21 '24 22:02 ThatOneCalculator

For upstream, not really, but this PR still inspires me to make things modular in the future and to allow people replacing some Electron stuff with their own native modules for better integration. I kinda feel bad about entirely killing this PR.

I should also say, both this PR's and Electron's implementations have their advantages and disadvantages, I think with this one you have a greater control over the audio within the application, yet again Electron's implementation is much more portable and doesn't rely on PipeWire at all (for some this is a bad thing, but given there are still distros that are PulseAudio only, I still think it's more portable to implement things based on Pulse than PipeWire).

SpacingBat3 avatar Feb 22 '24 00:02 SpacingBat3

My primary goal was to enable screen sharing with sound directly, without relying on external programs or scripts. If the proposed solution had been implemented, It's a win!

It's a bit sad that the PR was closed but I understand the decision of choosing the native solution. Although it's a bit limited in what you can do, I think it'll be easier to maintain.

Despite the outcome, I'm satisfied with the knowledge and skills I've acquired during this process.

kakxem avatar Feb 22 '24 23:02 kakxem

@kakxem I have used this pr for a very long time And well all I can say is it works beautifully with qpwgraph It gives me all the power and tricks I need

Hope the native solution is in the same boat Thanks for your hard work

beh-10257 avatar Feb 23 '24 06:02 beh-10257