35

How is the status of screen sharing on Wayland? Recently this has become an essential topic for people who telecommute.

I am trying to share my screen on Google Chrome 88 with WebRTC and I run GNOME 3.36 with Wayland with the following packages:

I tried to setup everything from scratch with the following steps:

  1. Build the packages with autotools and install the required dependencies along with their .pc files for pkg-config
  2. Copy the .so shared libraries for pipewire to /usr/local/lib/x86_64-linux-gnu and run ldconfig to refresh the config
  3. Copy the unit files in /usr/local/lib/systemd/user for systemctl and start the services

With everything correctly installed, I enabled chrome://flags/#enable-webrtc-pipewire-capturer and tried this demo and it says "Success!" but I only see a black screen...

EDIT: It looks like the problem has been fixed as of Ubuntu 22.04 LTS. I tried on a Thinkpad X1 laptop, with the default installation and I was able to share my screen on the demo link above.

emandret
  • 643

4 Answers4

28

Ubuntu 22.04

Support may be working out of the box, but I did not have all the needed packages on upgrading from 20.04.

I was able to have screen sharing working with the following:

(!) if this breaks your audio, see this bug

sudo apt install xdg-desktop-portal-gnome gnome-remote-desktop

And reboot if necessary (or see Troubleshooting section).

YMMV, but for sure pipewire-media-session (dependency of gnome-remote-desktop) and xdg-desktop-portal-gnome are needed and were not installed by do-release-upgrade from 20.04.

After that I was able to validate screensharing with dpkg/snap/flatpak apps as follows:

Firefox snap

The default Ubuntu 22.04 firefox (snap) uses wayland by default, and supports WebRTC screensharing (test eg with this WebRTC experiment)

portal in firefox

Unfortunately some software (Hello M$ Teams) "blacklists" firefox currently.

Chrome wayland dpkg

Chrome 99 is still X11 by default (despite the support flags being available since April 2021), so start it with

google-chrome-stable --enable-features=UseOzonePlatform --ozone-platform=wayland &

And to make it permanent, copy+edit /usr/share/applications/google-chrome.desktop to ~/.local/share/applications/

You also need to enable the WebRTC PipeWire support flag (chrome://flags/#enable-webrtc-pipewire-capturer).

[portal in chrome]

It still suffers from the "double" portal issue discussed in WebRTC/Chromium Updates In 2020, but it's usable.

Kooha flatpak (screen recorder)

sudo apt install flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install io.github.seadve.Kooha
flatpak run io.github.seadve.Kooha &

[portal in Kooha]

Troubleshooting

Commands that can replace rebooting:

systemctl --user enable pipewire-media-session
systemctl --user start pipewire-media-session
systemctl --user restart xdg-desktop-portal-gnome
  • Relevant Arch wiki
  • wlroots' "It doesn't work" Troubleshooting Checklist
  • background: Flatpak portals - how do they work? by Peter Hutterer.
  • tip: run apps from command-line and check output for error messages like Error creating screencast session: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.ScreenCast” on object at path /org/freedesktop/portal/desktop -- which means that you don't have a portal implementation -- e.g. this is the expected dbus setup as seen with d-feet: d-feet If you see org.freedesktop.impl.portal.desktop.gnome has some interfaces but not the ScreenCast one, it can mean a missing pipewire setup, or that xdg-desktop-portal-gnome was not restarted to pick it up.
eddygeek
  • 1,839
4

The easy solution is to use ubuntu 21.04 or later which properly integrates pipewire. Ubuntu 21.04 also defaults to wayland (intel and amd only) so pipewire screen sharing should work out of the box.

The reason is this ubuntu bug which seems to have been solved for 21.04. This issue is not caused by firefox or chromium/chrome.

You may also have some success backporting packages from 21.04 into 20.04 LTS. Unfortunately in this case the only easy solution cannot be used in ubuntu LTS until 2022 (when 22.04 LTS gets wayland and pipewire by default).

I got this info from a reddit comment where the same question is asked.

2

Important info for Ubuntu 22.10 users. I also have problems with screen sharing and I was able to solve them in Chrome by setting chrome://flags/#enable-webrtc-pipewire-capturer to Enabled. I also tried to install pipewire-media-session package, and this package is dangerous! After reboot my sound devices were gone. Fortunately removing that packages brought them back. Regarding Firefox in Ubuntu 22.10 ... screen sharing is still not fully working...

2

For me it worked in Ubuntu 22.04:

sudo apt install xdg-desktop-portal-gnome gnome-remote-desktop

Then using MS Teams in Google Chrome, with the chrome://flags/#enable-webrtc-pipewire-capturer to Enabled