RENGA RAMA KRISHNAN
RENGA RAMA KRISHNAN

Reputation: 55

localmedia access restricted until user interacts with the page in firefox

I have given allow permission for Microphone in my domain. We are using our domain in multiple tabs. I am able to acquire local media (Microphone) when I am accessing in the same tab. But I am not able to acquire local media for WebRTC in the other tab(same domain) without visiting the tab .Only after visiting the tab localmedia access is acquired.

Is it intentionally done for Security & Privacy? . Is there any way to solve my problem ?

Reason: To restrict resources being used for WebRTC session. We are keeping WebRTC session in single tab for our domain and using only that resource for all the tabs to make calls.

Tried setting microphone-allow as iframe attribute . But it didnt solve the problem . It is working fine in GoogleChrome browser though. If I open a new tab(T1) and initiate webrtc in it and make webrtc call from another tab (T2)without ever visiting the tab T1 , call is connected in chrome but not in firefox unless i visit T1 .

Note : It is not asking permission for allowing microphone in the domain , it acquires it automatically . Just that it acquires only after i visit the tab .I have given microphone access permission to my domain already.

Upvotes: 3

Views: 134

Answers (1)

jib
jib

Reputation: 42450

Is it intentionally done for Security & Privacy?

Yes, this is intentional to prevent background tabs from turning on the camera or mic willy nilly, to spy on users. Because that's creepy. I believe Safari works the same way.

The getUsermedia specification recently made this a requirement:

  • Step 6.1. "The User Agent MUST wait to proceed to the next step until the current settings object's responsible document is fully active and has focus."*

So I would expect Chrome to follow suit soon.

Is there any way to solve my problem ?

That would very much defeat the assurance.

Users can rest assured that only the currently focused tab can turn on the camera or microphone.

If I open a new tab(T1) and initiate webrtc in it and make webrtc call from another tab (T2)without ever visiting the tab T1 , call is connected in chrome but not in firefox unless i visit T1.

That's an RTCPeerConnection connection problem, which is separate from getUserMedia.

The workaround is to not block connection establishment on mic access.

There's no reason you can't connect first and add the mic later.

Or get mic ahead of time, and connect later. Basically, the two actions don't need to coincide or block each other.

Upvotes: 2

Related Questions