Skip to content
New issue

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

AudioContext dies (silently) in IOS14 Safari on iPad #25

Open
nmcgann opened this issue Feb 3, 2021 · 0 comments
Open

AudioContext dies (silently) in IOS14 Safari on iPad #25

nmcgann opened this issue Feb 3, 2021 · 0 comments

Comments

@nmcgann
Copy link

nmcgann commented Feb 3, 2021

If the tab with the metronome app is made inactive the AudioContext is 'suspended' / 'interrupted' and has to be manually re-started with audioContext.resume(); in the play() function once the tab is made active again. (see https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/state)

This works on Chrome, but not in Safari. AudioContext is apparently re-started and running in Safari, but the audio clock is frozen leaving the application dead. The only workround I have found is to detect the 'suspended' or 'interrupted' state and then close the AudioContext and make a new one (plus any associated nodes like gain).

This then works in both Safari and Chrome. (see https://github.com/nmcgann/metronome for this fix and various other added features)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant