Reputation: 642
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?
Upvotes: 2
Views: 2677
Reputation: 42430
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.
Upvotes: 3