Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cancelling a getUserMedia request

I have a modal dialog box in my application which uses getUserMedia to display a video from the user's camera. This causes a "Deny/Allow" bar to appear. Let's say that the user closes the dialog before clicking "Deny" or "Allow". The bar remains, even though the elements that would be using it have disappeared.

Is there a way to notify the browser that it can hide the permission request even though the user never interacted with it?

like image 260
Viper Bailey Avatar asked Jan 24 '13 01:01

Viper Bailey


1 Answers

When the user closes your dialog box, reload the page to clear the permission request with:

  location.reload();

I've tested this in Firefox and Chrome 41 (Canary) and it works there.

Caveat: Chrome 39 (the current version as of this writing) appears to have a bug where this doesn't work so well. The first time I navigate to the page it wont work, but after refreshing the page manually once, it starts working.

I realize this answer may not be immediately useful, but once Chrome 41 ships it should work.

There's currently no way to clear the permission prompt without reloading the page.

like image 65
jib Avatar answered Oct 22 '22 00:10

jib