2

I have 2 pages in my project. I ask for permission to use camera on the first page by using webRTC.

navigator.getUserMedia = navigator.getUserMedia || 

navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
    window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL;

link_to_second_page != active   
    if (navigator.getUserMedia) {
        // Accepted.
link_to_second_page = active
    } else {
        // Not accepted.
    }

And if user accept it, than the link to the second page become active. And there is a video chat on the second page, that is using webRTC too. The issue is that on Chrome it works perfect, because it saves the "permission accepted" status. But Firefox users are asked for permission for two times. Because Firefox doesn't save "permission accepted" status. Is there any method to ask for cam permission just once on the first page, and launch webRTC on the second?

tagaism
  • 624
  • 2
  • 7
  • 26
  • Possible duplicate of [always accept webRTC webcam request](http://stackoverflow.com/questions/12160174/always-accept-webrtc-webcam-request) – mido Feb 28 '16 at 01:54
  • 2
    Not really a duplicate IMHO since the developer controls the end-system in the other question. – jib Feb 28 '16 at 19:59

1 Answers1

3

Convince your users to select "Always Share" in Firefox's permission prompt (assumes https). Once they do this, it will work just like Chrome.

Firefox is less liberal with permissions by design, and unfortunately there is no way for a web page to carry non-persistent permission from one page to another (or even from one call to getUserMedia to another on the same page), without user-consent for each call.

Assuming you have to use the camera on the first page, the only other options I can think of would be to somehow re-engineer the two pages to be one by repopulating the DOM, or maybe request the camera from a common iframe.

jib
  • 40,579
  • 17
  • 100
  • 158
  • unfortunately you're right. I had to give up it, and my firefox users are still in some inconvenience. ))) – tagaism Feb 29 '16 at 08:44