Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Tìm hiểu thêm

Chủ đề này đã đóng và được lưu lại. Vui lòng hỏi một câu hỏi mới nếu bạn cần giúp đỡ.

How to select camera?

  • 3 trả lời
  • 2 gặp vấn đề này
  • 31 lượt xem
  • Trả lời mới nhất được viết bởi UniQMG

more options

On Firefox 90 on Ubuntu 20.04, when a site asks for camera and microphone permissions, it’s not possible to select any device anymore. It just shows the default camera and the default microphone.

Earlier Firefox releases used to show a selection list for the camera and also another one for the microphone.

My default camera is the one built into the laptop and I would like to use an external one that has adequate picture quality.

Can you please help selecting a camera with the new Firefox?

On Firefox 90 on Ubuntu 20.04, when a site asks for camera and microphone permissions, it’s not possible to select any device anymore. It just shows the default camera and the default microphone. Earlier Firefox releases used to show a selection list for the camera and also another one for the microphone. My default camera is the one built into the laptop and I would like to use an external one that has adequate picture quality. Can you please help selecting a camera with the new Firefox?

Tất cả các câu trả lời (3)

more options

What site or app are you trying to use the camera for? Can you do it in Chrome?

Được chỉnh sửa bởi jonzn4SUSE vào

more options

You are right, it doesn’t have the same behaviour on all sites. It doesn’t work on Nextcloud Talk.

Is it something that the website controls or is it a setting in my browser that is specific to a site?

more options

I was having the same issue and looked into it. A website using the `getUserMedia` API can force a specific device to be requested, which removes the ability to select a device from the permission prompt.

For example:

   // Forces the permission prompt for a specific device
   var id = (await navigator.mediaDevices.enumerateDevices())[0].deviceId;
   await navigator.mediaDevices.getUserMedia({ video: { deviceId: { exact: id } } });
   // Allows you to pick a specific device
   await navigator.mediaDevices.getUserMedia({ video: true });

I wrote up a userscript that defeats this. You can load it with any userscript manager (such as tampermonkey). May also run into issues with CSPs on some sites, copy-and-pasting it into devtools also works.

 // ==UserScript==
 // @name         Force allow camera choice
 // @version      1.0
 // @author       UniQMG
 // @match        *://*/*
 // @run-at      document-start
 // @grant       unsafeWindow
 // ==/UserScript==
 (() => {
     let original = window.navigator.mediaDevices.getUserMedia;
     original = original.bind(window.navigator.mediaDevices);
     window.navigator.mediaDevices.getUserMedia = (constraints) => {
         for (let devtype of Object.values(constraints))
             for (let key of Object.keys(devtype))
                 if (devtype[key].exact)
                     devtype[key] = devtype[key].exact;
         console.log("Fixed device request", constraints);
         original(constraints);
     }
 })();