搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

Learn More

navigator.mediaDevices.getUserMedia never resolves

  • 4 回覆
  • 1 有這個問題
  • 60 次檢視
  • 最近回覆由 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...

被選擇的解決方法

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)

從原來的回覆中察看解決方案 👍 0

所有回覆 (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.

有幫助嗎?

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?

有幫助嗎?

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

由 Ki-Hyoun Kim 於 修改

有幫助嗎?

more options

選擇的解決方法

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)

由 Ki-Hyoun Kim 於 修改

有幫助嗎?

問個問題

如果您還沒有帳號,您必須先 登入您的帳號 來回覆文章。請 開始一個新問題