Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(screensharing) add support for getDisplayMedia #434

Merged
merged 3 commits into from
Feb 13, 2025
Merged

Conversation

saghul
Copy link
Member

@saghul saghul commented Feb 6, 2025

No description provided.

@csett86
Copy link
Member

csett86 commented Feb 8, 2025

Thank you for picking this up! Just a minor question: Is this really a breaking change? Otherwise I would leave the version at 6.*, and just do a minor bump, eg. to 6.1.0

@csett86 csett86 linked an issue Feb 8, 2025 that may be closed by this pull request
@saghul
Copy link
Member Author

saghul commented Feb 9, 2025

You are right. When I started it looked like it needed to be a breaking change, but as I got deeper things cleared out so I can indeed just bump the minor.

@saghul
Copy link
Member Author

saghul commented Feb 11, 2025

@hristoterezov Fixed the version mismatch. PTAL!

@saghul
Copy link
Member Author

saghul commented Feb 11, 2025

On a second thought, I think we should bump the major to 7. #430 should've probably done that, and now seems like a good time to do it.

The screen-sharing implementation has gone through quite a bit:

  • 1st it relied on injecting stuff into the iframe -> bad!
  • 2nd we implemented the "new" flow
  • 3rd, now, we are adding (hopefully) The Final Way To Do It: getDisplayMedia

So, I propose we bump to 7 now, since we got rid of option 1 in Jitsi Meet, and this signals that.

Then, in 6 months - 1 year bump it to 8 and drop option 2, leaving gDM as the one and only option and removing all vestiges of the previous ones from JM and LJM.

Thoughts?

@csett86
Copy link
Member

csett86 commented Feb 11, 2025

I agree that the legacy flow removal should have been a major bump, so lets do that (retrospectively) now

Thank you for giving this more thought, @saghul

@hristoterezov
Copy link
Member

hristoterezov commented Feb 12, 2025

@saghul I've also tested on Linux (Ubuntu 24.04) and the whole app is crashing after the callback is called!

Have you tested on Linux? I'm wondering if it some misconfiguration on my side because I can't find many complaints online...

Otherwise it is crashing with:

'loop->recurse > 0' failed at ../src/pipewire/thread-loop.c:426 pw_thread_loop_wait()
[1] /home/xxxx/xxx/xx/jitsi-meet-electron/node_modules/electron/dist/electron exited with signal SIGSEGV

for me!

@saghul
Copy link
Member Author

saghul commented Feb 12, 2025

PipeWire is known to cause crashes, or at least it has in the past.

Not sure how this could cause it but I'll see if I can repro.

@hristoterezov
Copy link
Member

Did a second test and what actually happens is:

  • Press the screen sharing button
  • Our desktop picker is displayed and also the native linux SS picker window pops up
    At this point I can't go beyond this window, after a selection I see the error in the console and the native linux SS picker window pops up again and again. At the end if I decide to close it the whole app crashes...

@saghul
Copy link
Member Author

saghul commented Feb 12, 2025

This is a known bug with pipewire. Not new.

IIRC you need to be very quick selecting it and it will work.

Setting the system picker to true should avoid it, and was next on my list.

@saghul
Copy link
Member Author

saghul commented Feb 13, 2025

@hristoterezov I was wrong about the system picker, it currently is only implemented for macOS >= 15 and has its own quirks, so I'm leaving it disabled.

As for SS on Linux, see: https://github.com/jitsi/jitsi-meet-electron?tab=readme-ov-file#gnulinux

I'll give it a test though.

@csett86
Copy link
Member

csett86 commented Feb 13, 2025

@saghul Can we maybe use this opportunity to add the trick mentioned here: jitsi/jitsi-meet-electron#963 (comment)

@saghul
Copy link
Member Author

saghul commented Feb 13, 2025

Ah good one, I had forgotten about this. I will test it out!

@saghul
Copy link
Member Author

saghul commented Feb 13, 2025

Good news! I implemented the Wayland workaround and it works! For some reason the PipeWire picker is displayed twice 🤷 but once you pick what you want to share it works without displaying our dialog and weird warnings. We don't control the portal, that is displayed as a result to calling desktopCapturer.getSources.

PipeWire crashing has nothing to do with this PR, alas. I upgraded my system and didn't get crashes.

(I've waited for this moment for a long time) I USED ARCH BY THE WAY.

Things are, of course, still working fine in X11.

Copy link
Member

@hristoterezov hristoterezov left a comment

Choose a reason for hiding this comment

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

Great work!

I love the change for the wayland!

Retested on my linux machine and Now everything seems to work fine! I think before it was combination between me picking to share the whole screen and also I believe I somehow ended up using not the correct version of the sdk....

@saghul saghul merged commit 5f8eee3 into master Feb 13, 2025
3 checks passed
@saghul saghul deleted the electron-gdm branch February 13, 2025 14:27
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.

Migrate to new getDisplayMedia API
3 participants