Public bug reported:

I have found that Firefox (Snap) on Ubuntu 24.04 is unable to access
cameras when PipeWire is enabled, due to policy rules that PipeWire
enforces. It seems that Snap packaging would have to change in order for
Firefox's Pipewire support to be utilised effectively. It looks like an
issue between Firefox Snap confinement, Wayland focus tracking and xdg-
desktop-portal policy enforcement. If we want to be able to move beyond
v4l2, this issue will need to be resolved somehow... not sure how
though!

john@ovo:~$ which firefox
/usr/bin/firefox
john@ovo:~$ snap list | grep -i firefox || true
firefox                    146.0-2                         7477   latest/stable 
   mozilla**         -
john@ovo:~$ apt-cache policy firefox | sed -n '1,20p'
firefox:
  Installed: 1:1snap1-0ubuntu5
  Candidate: 1:1snap1-0ubuntu5
  Version table:
 *** 1:1snap1-0ubuntu5 500
        500 http://au.archive.ubuntu.com/ubuntu noble/main amd64 Packages
        100 /var/lib/dpkg/status
john@ovo:~$ 


In Firefox:

<!doctype html>
<html>
<body>
<button onclick="go()">List cameras</button>
<script>
async function go() {
  await navigator.mediaDevices.getUserMedia({ video: true });
  const devices = await navigator.mediaDevices.enumerateDevices();
  console.table(devices.filter(d => d.kind === "videoinput"));
}
</script>
</body>
</html>

This page raises an error:

Uncaught (in promise) DOMException: The request is not allowed by the user 
agent or the platform in the current context. 127.0.0.1:8000:7:32
    go http://127.0.0.1:8000/:7
    AsyncFunctionThrow self-hosted:804
    (Async: async)
    onclick http://127.0.0.1:8000/:1

​And this is what xdg-desktop-portal is reporting:

john@ovo:~$ journalctl --user -f -u xdg-desktop-portal
[...]
Dec 17 12:35:31 ovo xdg-desktop-por[735598]: A backend call failed: 
GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: 
GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Only the focused app is 
allowed to show a system access dialog
[...]


Meanwhile, to confirm that the camera exists in PipeWire:

john@ovo:~$ pw-cli list-objects Node | grep -A4 -i camera
                node.description = "Integrated Camera (V4L2)"
                node.name = "v4l2_input.pci-0000_00_14.0-usb-0_8_1.0"
                node.nick = "Integrated Camera"
                media.class = "Video/Source"
                media.role = "Camera"
        id 66, type PipeWire:Interface:Node/3
                object.serial = "66"
                object.path = "v4l2:/dev/video2"
                factory.id = "10"
--
                node.description = "Integrated Camera (V4L2)"
                node.name = "v4l2_input.pci-0000_00_14.0-usb-0_8_1.2"
                node.nick = "Integrated Camera"
                media.class = "Video/Source"
                media.role = "Camera"
        id 72, type PipeWire:Interface:Node/3
                object.serial = "72"
                object.path = "alsa:pcm:0:hw:sofhdadsp,5:playback"
                factory.id = "18"
john@ovo:~$ 


And also

john@ovo:~$ pw-cli list-objects Node | grep -E 'node.name|media.class'
                node.name = "Dummy-Driver"
                node.name = "Freewheel-Driver"
                node.name = "Midi-Bridge"
                media.class = "Midi/Bridge"
                node.name = "v4l2_input.pci-0000_00_14.0-usb-0_8_1.0"
                media.class = "Video/Source"
                node.name = "v4l2_input.pci-0000_00_14.0-usb-0_8_1.2"
                media.class = "Video/Source"
                node.name = 
"alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_5__sink"
                media.class = "Audio/Sink"
                node.name = 
"alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_4__sink"
                media.class = "Audio/Sink"
                node.name = 
"alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_3__sink"
                media.class = "Audio/Sink"
                node.name = 
"alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp__sink"
                media.class = "Audio/Sink"
                node.name = 
"alsa_input.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp__source"
                media.class = "Audio/Source"
                node.name = 
"alsa_input.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_6__source"
                media.class = "Audio/Source"
                node.name = "Thunderbird"
                media.class = "Stream/Input/Audio"
john@ovo:~$ 


I can also confirm via 'pw-top' that the camera is connecting via PipeWire when 
I use the 'snapshot' program on Ubuntu 24.04:

S   ID   QUANT   RATE     WAIT     BUSY   W/Q   B/Q   ERR   FORMAT        NAME
S   29   0       0        ---      ---    ---   ---   0                 
Dummy-Driver
S   30   0       0        ---      ---    ---   ---   0                 
Freewheel-Driver
S   55   0       0        ---      ---    ---   ---   0                 
Midi-Bridge
R   64   1       30       54.6us   4.0us  0.00  0.00  0     MJPG 1280x720 
v4l2_input.pci-0000_00_14.0-usb-0_8_1.0
R   103  0       0        41.3us   5.6us  0.00  0.00  0     MJPG 1280x720 + 
org.gnome.Snapshot
S   66   0       0        ---      ---    ---   ---   0                 
v4l2_input.pci-0000_00_14.0-usb-0_8_1.2
S   72   0       0        ---      ---    ---   ---   0                 
alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp
S   73   0       0        ---      ---    ---   ---   0                 
alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp
S   74   0       0        ---      ---    ---   ---   0                 
alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp
S   75   0       0        ---      ---    ---   ---   0                 
alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp
S   76   0       0        ---      ---    ---   ---   0                 
alsa_input.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp
S   77   0       0        ---      ---    ---   ---   0                 
alsa_input.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp
S   98   0       0        ---      ---    ---   ---   0                 
Thunderbird

** Affects: firefox (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2136591

Title:
  Pipewire cameras inaccessible due to Snap packaging

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/2136591/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to