The upcoming version of Firefox 116 will use Pipewire for camera access. This sparked my curiosity and I wanted to know if my setup would work for this. In recent times, Firefox has been moving rather quickly, adding dependency on these Flatpak portals (even in scenarios where Flatpak is not involved). This is no exception.
Access to the camera via pipewire is mediated by the camera portal, an
interface of the xdg-desktop-portal
. I attempted to use a test script to see
if this would work on my machine, but the xdg-desktop-portal
didn’t even
expose the relevant interface is my setup.
A friendly collaborator quickly answered and pointed out that the Camera portal requires an access portal running. The access portal is a simple portal that shows a prompt to the user asking for confirmation to grant permission to things like Location, Screenshot and, as you might have guessed, Camera access.
Only one implementation of the access portal exists: the GNOME one. I tried running it on my machine, and it only seemed to work once, but did not prompt me ever again after that.
I quickly wrote my own portal implementation (I need to improve its UI, but
I’ll publish this at some point for all the non-GNOME users out there who’ll
end up in the same situation). However, my access portal (way-access-portal
,
since it’s generic for any wayland compositor) was also not being invoked.
After some debugging and research, I found out that my impression (that the gtk
access portal had stopped working) was mistaken. The access portal is only
invoked once, and the xdg-desktop-portal
saves the response into the
xdg-permission-store
. The xdg-permission-store
is another Flatpak
component, which basically saves the response to access requests into its tiny
database in ~/.local/share/flatpak/db/devices
.
I deleted the database, attempted to use the Camera Portal once more and voila, my access portal worked!
The camera stream itself, however, didn’t work with the test script. I’m pretty sure that this is an issue with the test script, but that’s for another day.