We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
master
On Safari (Mac and iOS), if the microphone is being opened without user interactions, Safari will block the access.
To detect whether Safari block or not:
async function canOpenMicrophone() { const audioContext = new AudioContext(); try { if (audioContext.state === 'suspended') { return await Promise.race([ audioContext.resume().then(() => true), new Promise(resolve => setImmediate(resolve)).then(() => false) ]); } return true; } finally { await audioContext.close(); } }
Note: the result of this call is asynchronous and code executed after the result will fail user interaction requirement.
Steps to reproduce the behavior:
The microphone will open. Or on Safari, it should never open.
Actual, the microphone is being opened, but Safari blocked access and suspended our code.
[Bug]
The text was updated successfully, but these errors were encountered:
The check function is not reliable across platforms.
This is because on Firefox, it will always be "suspended" even resumed, until the user clicked agree on the microphone consent dialog.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Version
master
Describe the bug
On Safari (Mac and iOS), if the microphone is being opened without user interactions, Safari will block the access.
Technical details
To detect whether Safari block or not:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The microphone will open. Or on Safari, it should never open.
Actual, the microphone is being opened, but Safari blocked access and suspended our code.
[Bug]
The text was updated successfully, but these errors were encountered: