WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: picam, firefox, picore 15: js error. camera not found  (Read 392 times)

Offline segfault

  • Newbie
  • *
  • Posts: 20
picam, firefox, picore 15: js error. camera not found
« on: September 02, 2024, 08:41:59 AM »
Firefox outputs JavaScript error: Unable to find Camera. And sure enough about:support in firefox does _not_ list the camera under the media / input devices. I know that the camera works on, because from terminal I can snap a photo and view the JPEG. However, I did run into an issue when installing firefox.tcz because it was looking for libffi.so.6 and I got libffi.so.8.1.4 (to fix this error I created a tce package that creates a softlink to the lib), so this might be why?! Next I will try to find a libffi.so.6 from another version if picore, but if anyone else knows a better path to making this work, Im all ears  ;D

Im running picore15.
Ive installed firefox.
Im running JavaScript that Ive verified can access Camera (on another device).

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14752
Re: picam, firefox, picore 15: js error. camera not found
« Reply #1 on: September 02, 2024, 09:14:38 AM »
libffi6 needs to be added to the firefox dep file - I won’t be able to get to it for a couple of weeks.

I seem to remember that the ability to access a camera needs to be added to the firefox configuration at compile time - building firefox takes several days, but I might have a go soon.

Offline segfault

  • Newbie
  • *
  • Posts: 20
Re: picam, firefox, picore 15: js error. camera not found
« Reply #2 on: September 03, 2024, 05:02:11 AM »
I wonder if there is some kind of permission I need to set on the OS level? ???

I tried the camera in firefox on piCore-13 and got the same JavaScript error: Unable to find the Camera. I can take photos from CLI. No issues when installing firefox on piCore-13. But the Camera does not show up in firefox about:support media / input devices. I tried to launch the webpage using python -m SimpleHTTPSever to rule out permissions issues but it makes no difference. Firefox does ask for enabling camera when webpage loads and the "unable to find Camera" error shows up when I select unicam.

Im thinking that maybe firefox is not getting access to the camera at a lower level. Anyone have any idea on if I need to add firefox to some video group or something like that?

libffi6 needs to be added to the firefox dep file - I won’t be able to get to it for a couple of weeks.

I seem to remember that the ability to access a camera needs to be added to the firefox configuration at compile time - building firefox takes several days, but I might have a go soon.

Sounds great! Looking forward to trying it out! Cheers!  ;D

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14752
Re: picam, firefox, picore 15: js error. camera not found
« Reply #3 on: September 03, 2024, 05:10:58 AM »
You could check the permissions of /dev/media* or /dev/media/* and try setting them to tc:staff

Offline segfault

  • Newbie
  • *
  • Posts: 20
Re: picam, firefox, picore 15: js error. camera not found
« Reply #4 on: September 03, 2024, 06:08:09 AM »
You could check the permissions of /dev/media* or /dev/media/* and try setting them to tc:staff

Thanks! I already had those set, but when I added: sudo chown tc:staff /dev/video*
I got a wee bit further... now the HMTL element rendering the camera stream is at least a black square (before there was nothing). Then after a long time of waiting there is the "Camera not found" error message and firefox about:support input devices, list is still empty. I tried setting dtoverlay=imx219, camera_auto_detect=1, gpu_mem=128 (with 512 firefox wont even start, with 256 it crashes with send/recv channel error) in /mnt/mmcblk0p1/config.txt.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11512
Re: picam, firefox, picore 15: js error. camera not found
« Reply #5 on: September 03, 2024, 10:29:39 AM »
Hi segfault
... but when I added: sudo chown tc:staff /dev/video* ...
That takes care of  /dev/video0  and  /dev/video1.  It also takes care
of  /dev/video/  but not its contents. Try it like this:
Code: [Select]
sudo chown -Rv tc:staff /dev/video*That also should recurse into the directory and change its contents
as well as report what it is doing.

Offline segfault

  • Newbie
  • *
  • Posts: 20
Re: picam, firefox, picore 15: js error. camera not found
« Reply #6 on: September 04, 2024, 03:53:16 AM »
Thanks Rich.  :)

I did as you said, but the error persists. I also did "dmesg | grep video" and I can see that bcm2835-isp and bcm2835-codec is registered on multiple /dev/video<number> (which makes sense because the camera does work when snapping photos using CLI) then I checked which PID firefox has using "ps" and "fuser /dev/video<number>" and firefox does show up as a being connected to these video files.

I'm starting to doubt that it's a permission thing... but what else could it be?

I'm using:
sudo chown tc:staff /dev/media*
sudo chown tc:staff /dev/dma_heap/*
sudo chown -Rv tc:staff /dev/video*

And when firefox asks me which camera to pick it shows unicam (along with bcm2835-isp, etc) which is the same device picked when running "libcamera-jpeg -o ~/camera.jpg --width 640 --height 320 --nopreview".

EDIT: it's not related to firefox extensions either I think, because I've not installed any  ;) and also tried running in -save-mode
« Last Edit: September 04, 2024, 03:57:35 AM by segfault »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11026
Re: picam, firefox, picore 15: js error. camera not found
« Reply #7 on: September 04, 2024, 09:20:20 AM »
FF usually has an about: page with more detailed errors. Try finding if there's one for the camera.
The only barriers that can stop you are the ones you create yourself.