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".

Learn More

navigator.mediaDevices.getUserMedia never resolves

  • 4 trả lời
  • 1 gặp vấn đề này
  • 97 lượt xem
  • Trả lời mới nhất được viết bởi Ki-Hyoun Kim

more options

I found out, that the getUserMedia Promise in Firefox only resolves, if the Tab is active or by clicking on the Tab Instance: (Firefox, 81.0)

navigator.mediaDevices.getUserMedia({ audio: true}).then(() => console.log("done"))

Otherwise, the Promise never resolves or rejects. Is this a bug or a feature, and where is this documented? Is there a media Config setting, to tell Firefox to allow getUserMedia Promise to resolve in non-active Tabs? Otherwise this looks like a bug for me...

Giải pháp được chọn

Solution: "Firefox Autoplay"

about:preferences -> Security -> Autoplay

Audio Autoplay for background Tabs/Windows is not allowed due to the strict Media Policy. The Autoplay setting bypasses the Policy and allows audio to be played for non-active Tabs/Windows (Tabs/Windows in Background)

Edit (2020-12-01) After a little testing and investigation, I found out that playing Audio in non-focused Firefox Tabs/Window is possible with Autoplay. But unfortunately, it is still not possible to bypass the strict policy when it comes to WebRTC/SIP. The Promise stil doesn't resolve, even with Autoplay enabled for all Sites.

Đọc câu trả lời này trong ngữ cảnh 👍 0

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

more options

Additional Information: In my tests, I have permanently added audio permissions. The promise is only resolving as soon as I click into the Tab or Alt-Tabbing into it.

Hữu ích?

more options

One more note: I tried playing around media.block-autoplay-until-in-foreground as well. Maybe this is the setting which causes the strange bug, and not working correctly?

Hữu ích?

more options

The Bug won't be fixed. As I understand this correctly, this is a security feature: https://bugzilla.mozilla.org/show_bug.cgi?id=1195654

Được chỉnh sửa bởi Ki-Hyoun Kim vào

Hữu ích?

more options

Giải pháp được chọn

Solution: "Firefox Autoplay"

about:preferences -> Security -> Autoplay

Audio Autoplay for background Tabs/Windows is not allowed due to the strict Media Policy. The Autoplay setting bypasses the Policy and allows audio to be played for non-active Tabs/Windows (Tabs/Windows in Background)

Edit (2020-12-01) After a little testing and investigation, I found out that playing Audio in non-focused Firefox Tabs/Window is possible with Autoplay. But unfortunately, it is still not possible to bypass the strict policy when it comes to WebRTC/SIP. The Promise stil doesn't resolve, even with Autoplay enabled for all Sites.

Được chỉnh sửa bởi Ki-Hyoun Kim vào

Hữu ích?

Đặt một câu hỏi

Bạn phải đăng nhập vào tài khoản của bạn để trả lời bài viết. Vui lòng bắt đầu một câu hỏi mới, nếu bạn chưa có tài khoản.