2

I have no audio playback or recording in the new snap Firefox on Ubuntu 22.04. Somewhat uniquely, I run pulseaudio in system-wide mode (despite the warnings, long story). When I run snap connection firefox I can see that it is plugged into the audio-playback slot. Still, it won't connect to system-wide pulseaudio and play. Is there any way to connect a snap to system-wide pulseaudio?

I've tried replacing the snap with a apt version of firefox, which worked temporarily, but whenever I update the system it automatically re-installs the snap(!).

EDIT: sounds like it's possible to get ubuntu to keep the apt version during updates, so that's good. But I still want to know if it's possible to use the recommended snap version and also system-wide pulseaudio.

1 Answers1

1

The latest snaps in 22.04 use pipewire, not pulseaudio. You can see it by checking /snap/*/current/usr/lib/x86_64-linux-gnu/

Still, it's possible to make pipewire work with the system-wide pulseaudio by using a network interface or a unix socket, which is largely compatible between the two.

For the network interface you'd need to pass PULSE_SERVER server env variable to the firefox snap like this:

echo "export PULSE_SERVER=<server>; /snap/firefox/current/usr/lib/firefox/firefox " | snap run --shell firefox

PULSE_SERVER should be either tcp:<hostname> if your pulseaudio server is listening on a network interface (check /etc/pulse/default.pa for load-module module-native-protocol-tcp) or unix:<pulseaudio socket file>

The variable is set in the shell of the snap, which is then used to start the main process.

AiB
  • 26
  • Glorious, thanks. I actually got it working first with your command and then permanently by adding the PULSE_SERVER=hostname.tld to my /etc/environment file. – partofthething Nov 10 '22 at 19:01