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

Feature: Wayland & Screen-sharing #32

Closed
3 tasks done
Regular-Baf opened this issue Apr 23, 2022 · 35 comments
Closed
3 tasks done

Feature: Wayland & Screen-sharing #32

Regular-Baf opened this issue Apr 23, 2022 · 35 comments
Labels
enhancement ✨ New feature or request

Comments

@Regular-Baf
Copy link

Preflight Checklist

Problem Description

Screen sharing is an essential part of modern online communication, and recently I noticed it working within Chromium, so I believe it can here too?

Proposed Solution

Implement screen-share support on Wayland

Alternatives Considered

n/a

Additional Information

No response

@Regular-Baf Regular-Baf added the enhancement ✨ New feature or request label Apr 23, 2022
@vraravam
Copy link
Contributor

We are on the latest released version of electron: 18.1.0 which bundles Chromium: 100.0.4896.127.

Could you please specify what version of Ferdium you are using? What OS? And which service does not handle screensharing? For eg, I'm using the latest Ferdium (6.0.0-nightly.9) and I can use screensharing within the MS Teams Service without any issues.

@vraravam vraravam added the question ❓ Further information is requested label Apr 23, 2022
@kris7t
Copy link
Member

kris7t commented Apr 23, 2022

If you're using ferdium outside of flatpack, you should be able to enable wayland support with passing the

 --ozone-platform=wayland --enable-features-WaylandWindowDecorations

flags. Note that there's a known electron bug that might prevent you from maximizing the window.

Nevertheless, this should run ferdi with wayland, also giving access to screensharing through pipewire.

If this doesn't work, you could still try starting apps with X11 temporarily for sharing (e.g., with GDK_BACKEN=x11 for gtk apps) and sharing them via X11.

It should in principle be possible to do this also with flatpak (see, e.g., signal desktop) using the --socket=wayland flag in the sandbox, but I'm not familiar with flatpak.


Unfortunately, the --ozone-platform=wayland flag must be passed to the outside (we can't make ferdium enable wayland support on its own). According to my experiments, trying to do some from inside electron simply crashes the chromium gpu process.

But hopefully, in the future, electron will ship with wayland enabled by default, so you wouldn't need the flags.

@mfortini
Copy link

@kris7t I'm using these flags:
--enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform=wayland

Note: maximizing works for me with nightly 10 and Linux 5.17

@kris7t
Copy link
Member

kris7t commented Apr 26, 2022

I think maximizing depends on the desktop environment you use, it works under sway or kde where the window manager draws the window decorations, but it won't (according to the electron bug tracker) work on gnome where the client is supposed to draw them.

@mfortini
Copy link

I think maximizing depends on the desktop environment you use, it works under sway or kde where the window manager draws the window decorations, but it won't (according to the electron bug tracker) work on gnome where the client is supposed to draw them.

I forgot to specify: I'm on gnome 42. Some software which is based on Electron works, as Ferdium, while for example slack 4.25 is not going full screen

@kris7t
Copy link
Member

kris7t commented Apr 26, 2022

Interesting. I guess electron might have fixed that bug without actually closing it? 🤔

@mfortini
Copy link

Interesting. I guess electron might have fixed that bug without actually closing it? thinking

Nevermind, bug is still there, it was only that it was ignoring the flags and using xwayland. My bad

@ElJeffe
Copy link

ElJeffe commented Apr 28, 2022

I am using Ferdium on archlinux with River WM. When using Ferdi, I get screensharing working with MS Teams using:
ferdi --enable-features=WebRTCPipeWireCapturer
but running in xwayland.
With Ferdium, I do not manage to get screensharing to work, with any combination of the arguments here:
ferdium --enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WebRTCPipeWireCapturer
Ferdium: 6.0.0-nightly.12
Chrome: 100.0.4896.127
Electron: 18.1.0

edit: when I use MS Teams in chromium with these options, screensharing works also.

@kris7t
Copy link
Member

kris7t commented Apr 28, 2022

Can you try it with

--ozone-platform=wayland --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer

? I think multiple --enable-features flags do not combine.

@ElJeffe
Copy link

ElJeffe commented Apr 28, 2022

Can you try it with

--ozone-platform=wayland --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer

? I think multiple --enable-features flags do not combine.

No, this does not work either.

@kris7t
Copy link
Member

kris7t commented Apr 29, 2022

This might also be affected by electron/electron#31588, unfortunately.

@kris7t
Copy link
Member

kris7t commented Apr 29, 2022

Can you try with nightly.16 (after it finishes building)? #61 just got merged, and hopefully it has fixed this issue, too.

@cedricroijakkers
Copy link
Contributor

I will do some tests this weekend, as I use X11 for most of my work, I'll need to switch to Wayland first.

According to electron/electron#31588 you need to pass the following switch to the ferdium command when starting: --enable-features=WebRTCPipeWireCapturer. This would mean we would need to create a launcher shell script that detects if Wayland is in use (I've done this before, this can be done by looking at an environment variable) and add the switch if needed. If the initial tests are successful, I'll see if I can make a PR for this. We'll have to call the shell script in the .desktop file instead of the ferdium executable directly.

@ElJeffe
Copy link

ElJeffe commented Apr 29, 2022

Can you try with nightly.16 (after it finishes building)? #61 just got merged, and hopefully it has fixed this issue, too.

I tested nightly.16. I can select the screen to share, which is a step further, but when I select the screen, I get a coredump (seg fault).
I can upload the coredump if needed.

edit: backtrace ferdium_bt.txt

@vraravam vraravam removed the question ❓ Further information is requested label May 7, 2022
@ElJeffe
Copy link

ElJeffe commented May 12, 2022

Can you try with nightly.16 (after it finishes building)? #61 just got merged, and hopefully it has fixed this issue, too.

I tested nightly.16. I can select the screen to share, which is a step further, but when I select the screen, I get a coredump (seg fault). I can upload the coredump if needed.

edit: backtrace ferdium_bt.txt

Is there something I can do to debug this?

@SarathKmrM
Copy link

hi
desktopCapturer not working in ubuntu 22.
We are using electron App stable version 18.2.0

desktopCapturer.getSources({ types: ['screen'] }).then( sources => {
  fs.writeFile(`screenshot.jpg`, sources[0].thumbnail.toJPEG(25), (err) => {
    if (err) throw err
      console.log('Image Saved')
  })
})

This code works fine in old ubuntu versions (18,20)
we are facing issue with screenshot in ubuntu 22.
Enabling "WebRTCPipeWireCapturer" , we get empty Screenshot file with no data (size is 0 kb)
Not Enabling "WebRTCPipeWireCapturer" , we get black Screenshot image.

I have added this issue in separate ticket.
electron/electron#33961

Any solutions ?

Thank you in advance

@kris7t
Copy link
Member

kris7t commented May 12, 2022

Is there something I can do to debug this?

this is likely an electron issue, so you'll probably have better luck debugging this at their repo. maybe the issue linked above is related

@ElJeffe
Copy link

ElJeffe commented Jun 13, 2022

screen sharing works now without crashing in 6.0.0-nightly.58 (probably due to #221).

@vraravam
Copy link
Contributor

If we can have 1 more confirmation, then we can close this ticket!

@vraravam vraravam added the question ❓ Further information is requested label Jun 13, 2022
@kris7t
Copy link
Member

kris7t commented Jun 13, 2022

It also works for me (albeit with quite high CPU usage, but that's maybe just due to the sway compositor)


Edit: yeah, making xdg-desktop-portal-wlr ignore the alpha channel improves performance quite a bit: https://www.reddit.com/r/swaywm/comments/fq1qoe/how_to_use_xdgdesktopportalwlr_to_share_the_screen/

@kris7t kris7t closed this as completed Jun 13, 2022
@kris7t kris7t removed the question ❓ Further information is requested label Jun 13, 2022
@ghost
Copy link

ghost commented Jul 2, 2022

--ozone-platform=wayland --enabledesktopCapturer.getSources({ types: ['screen'] }).then( sources => {
fs.writeFile(screenshot.jpg, sources[0].thumbnail.toJPEG(25), (err) => {
if (err) throw err
console.log('Image Saved')
})
})-features=UseOzonePlatform,WebRTCPipeWireCapturer

@maurerle
Copy link

Hi,

this did not work for me out of the box for ferdium 6.0.0-nightly.100

I had to edit /usr/share/applications/ferdium.desktop
and edit the Exec= line to:
Exec=/opt/Ferdium/ferdium %U --enable-features=WebRTCPipeWireCapturer

after a restart this works. But It seems like it should have worked without that too?

@Crashdummyy
Copy link

Crashdummyy commented Oct 12, 2022

Does this really work for everyone ?
I can screenshare without any issues if I launch Jitsi and stuff in chromium.
Ferdium refuses to let me share the screen at all.

When I start ferdium like this:
$ ferdium --ozone-platform=wayland --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer

I get at least presented with the xdg-desktop-portal to select the screen to share.
But the preview is "broken".
image

After the selection I can see my screen shared within my own window
but for every other participant the screen just stays black

System
         .';:cccccccccccc:;,.            ---------------------- 
      .;cccccccccccccccccccccc;.         OS: Fedora release 37 (Thirty Seven) x86_64 
    .:cccccccccccccccccccccccccc:.       Host: ROG Zephyrus G15 GA503RW_GA503RW 1.0 
  .;ccccccccccccc;.:dddl:.;ccccccc;.     Kernel: 6.1.0-0.rc0.20221011git60bb8154d1d7.8.vanilla.1.fc37.x86_64 
 .:ccccccccccccc;OWMKOOXMWd;ccccccc:.    Uptime: 1 hour, 29 mins 
.:ccccccccccccc;KMMc;cc;xMMc:ccccccc:.   Packages: 2648 (rpm), 69 (flatpak) 
,cccccccccccccc;MMM.;cc;;WW::cccccccc,   Shell: bash 5.2.2 
:cccccccccccccc;MMM.;cccccccccccccccc:   Resolution: 2560x1440 
:ccccccc;oxOOOo;MMM0OOk.;cccccccccccc:   DE: GNOME 43.0 
cccccc:0MMKxdd:;MMMkddc.;cccccccccccc;   WM: Mutter 
ccccc:XM0';cccc;MMM.;cccccccccccccccc'   WM Theme: Sweet 
ccccc;MMo;ccccc;MMW.;ccccccccccccccc;    Theme: Sweet-Dark [GTK2/3] 
ccccc;0MNc.ccc.xMMd:ccccccccccccccc;     Icons: candy-icons [GTK2/3] 
cccccc;dNMWXXXWM0::cccccccccccccc:,      Terminal: terminator 
cccccccc;.:odl:.;cccccccccccccc:,.       CPU: AMD Ryzen 9 6900HS with Radeon Graphics (16) @ 4.935GHz 
:cccccccccccccccccccccccccccc:'.         GPU: NVIDIA Geforce RTX 3070 Ti Laptop GPU 
.:cccccccccccccccccccccc:;,..            GPU: AMD ATI Radeon 680M 
  '::cccccccccccccc::;,.                 Memory: 5382MiB / 31333MiB

@ElJeffe
Copy link

ElJeffe commented Oct 12, 2022

Does this really work for everyone ? I can screenshare without any issues if I launch Jitsi and stuff in chromium. Ferdium refuses to let me share the screen at all.

For me, the preview of the Entire Screen also does not show, but screen sharing works. I have to select the screen two times though.

@Crashdummyy
Copy link

Crashdummyy commented Oct 12, 2022

Thats a known bug with the xdg-portal and not unique to ferdium.
Do other participants see your screen ?
I can only see it myself, the other participants in the call only see a black screen :/

How do you start it ?
Flatpak?
Which args ?

@ElJeffe
Copy link

ElJeffe commented Oct 12, 2022

Yes, the participants can see my screen. I start with

ferdium --ozone-platform=wayland --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer

I have ferdium-bin 6.2.0-1 installed from aur. No flatpack. I do have river, wlroots based, so I have a different xdg-desktop-portal. But since it seems to work in chromium, I doubt that this is the issue.

Edit: I just did a meeting with myself on Teams (with laptop and phone) and it does work.

@Crashdummyy
Copy link

Yes, the participants can see my screen. I start with

ferdium --ozone-platform=wayland --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer

I have ferdium-bin 6.2.0-1 installed from aur. No flatpack. I do have river, wlroots based, so I have a different xdg-desktop-portal. But since it seems to work in chromium, I doubt that this is the issue.

Edit: I just did a meeting with myself on Teams (with laptop and phone) and it does work.

I guess thats the Problem then.
I only have two laptops to test for now.
One Ubuntu 22.04 and one with Fedora 37.
Both use gnome so I guess that portal refuses to work

@Crashdummyy
Copy link

6.2.1-nightly18 doesnt work either

@dfelix
Copy link

dfelix commented Nov 2, 2022

Same issue on Fedora 36, Wayland and Gnome 42.4

@cedricroijakkers
Copy link
Contributor

After quite a long time of not testing this, I've decided to give it another try myself.

Just like @Crashdummyy, I can share screen in MS Teams in Ferdium (it works fine in Jitsi using the desktop client too), but I do need to start Ferdium with the parameters:

ferdium --ozone-platform=wayland --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer

I'm using the AUR build under Arch Linux (btw), with Gnome 43.0.

Interestingly however, is with those command-line parameters listed above, Ferdium starts just fine, but does not have a window bar in Gnome. Without those parameter, the window bar is there (but screen sharing does not work). Any idea why the window bar is missing? There is no maximise and minimise button, but Super+Up and Super+Down do work fine to manipulate the window size.

@Crashdummyy
Copy link

After quite a long time of not testing this, I've decided to give it another try myself.

Just like @Crashdummyy, I can share screen in MS Teams in Ferdium (it works fine in Jitsi using the desktop client too), but I do need to start Ferdium with the parameters:

ferdium --ozone-platform=wayland --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer

I'm using the AUR build under Arch Linux (btw), with Gnome 43.0.

Interestingly however, is with those command-line parameters listed above, Ferdium starts just fine, but does not have a window bar in Gnome. Without those parameter, the window bar is there (but screen sharing does not work). Any idea why the window bar is missing? There is no maximise and minimise button, but Super+Up and Super+Down do work fine to manipulate the window size.

I just performed some tests again end...
Well sharing worked and might always have.
Somehow its just my self hosted instance that refuses to work ( sharing through browser however does work... )

@cedricroijakkers
Copy link
Contributor

Note to self: the missing window decorator is a known Electron issue with Wayland. Check this commit for a potential fix.

@fuelflo
Copy link

fuelflo commented Jun 17, 2023

Note to self: the missing window decorator is a known Electron issue with Wayland. Check this commit for a potential fix.

unfortunately the repo has been set to private or deleted. Do you have any hints for me what the fix for missing window decorations is?

@cedricroijakkers
Copy link
Contributor

unfortunately the repo has been set to private or deleted. Do you have any hints for me what the fix for missing window decorations is?

From the top of my head, adding the following parameters makes it work in Gnome under Wayland: --ozone-platform=wayland --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer,WaylandWindowDecorations, but I also noticed that this causes problems when maximising the application. Maximised, it does not show correctly. From what I have read in different places, this seems to be Gnome-specific, and Gnome bug? Either way, on my system, it is still not fixed.

@maurerle
Copy link

For completeness, one can find the above mentioned commit here:
flathub/com.discordapp.Discord@e9f8ea9

The params set there are just: --enable-features=WebRTCPipeWireCapturer,WaylandWindowDecorations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request
Projects
None yet
Development

No branches or pull requests