Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pavle-goloskokovic/240129b79467d4e2be4530f280ec203f to your computer and use it in GitHub Desktop.
Save pavle-goloskokovic/240129b79467d4e2be4530f280ec203f to your computer and use it in GitHub Desktop.
Then right after we create an audio context we should check its state property
if (context.state === 'suspended')
{
// Unlock it
}
@pavle-goloskokovic
Copy link
Author

I’ve created an npm package called web-audio-touch-unlock
that exposes this method and makes it easy to use in your own projects.
Just pass your AudioContext instance to it and you’re good to go!

You can try it out yourself here.

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment