javascript - how to detect chrome camera access dialog is open -


how can detect google chrome camera access dialog open or not can detect user choose allow or deny can't detect dialog open or not need show little tip under need detect open or not ... open default if user choose deny second time it's not open

i don't believe there's way detect if dialog open, might able infer it's open. show tip each time call getusermedia(), , hide on callback or other user interaction page (assumption being denied video access if they're doing other stuff on page)...

$("#tooltip").show();  navigator.webkitgetusermedia({"video":true}, function(stream) {     $("#tooltip").hide();     // thing. }); 

you put delay on showing tip it's shown if video stream callback doesn't happen specified period of time:

var tiptimeout = settimeout(function() {     $("#tooltip").show(); }, 1000);  navigator.webkitgetusermedia({"video":true}, function(stream) {     cleartimeout(tiptimeout);     $("#tooltip").hide();     // thing. }); 

hope helps!


Comments