Skip to content

Commit

Permalink
safari: navigator.permissions doesn't exist yet, so don't try to use it
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffkaufman committed Feb 14, 2021
1 parent aea2358 commit 16fe3b6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions html/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ export class MicEnumerator {

async wait_for_mic_permissions() {
// First, check if we already have permission, without needing to do anything.
var perm_status = await navigator.permissions.query({name: "microphone"}).catch(() => ({}));
if (perm_status.state == "granted" || perm_status.state == "denied") {
// Denied means we will fail, but also there's nothing more we can do about it.
return;
if (navigator.permissions) {
var perm_status = await navigator.permissions.query({name: "microphone"}).catch(() => ({}));
if (perm_status.state == "granted" || perm_status.state == "denied") {
// Denied means we will fail, but also there's nothing more we can do about it.
return;
}
}
// This can't fail, but eat errors just to be sure, because we don't care.
return this.force_permission_prompt().catch(() => {});
Expand Down

0 comments on commit 16fe3b6

Please sign in to comment.