navigator.mediaDevices.getUserMedia does not resolve

898 Views Asked by At

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. It looks for me like a bug.

I have seen that behaviour in Firefox only. Safari and Chrome are working fine. I also have played around the media Settings in about:config, but nothing helped

In my tests, I have accepted Audio Permission permanently.

Thx

(edit): Additional Information: Firefox has the setting in about:config media.block-autoplay-until-in-foreground. But this setting doesn't change the behaviour. Maybe it should?

(edit 2020-12-10: related Forum Post on Mozo;;a Forum: https://support.mozilla.org/en-US/questions/1307318)

(Solved)

The strict Media policy can be bypassed by going to

about:prererences -> Security -> Autoplay 

This gives the possibility to disable Autoplay blocking, or whitelisting Websites with autoplay enabled, and makes it possible to play Media for Background Tabs/Windows.

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.

0

There are 0 best solutions below