Last active
December 8, 2020 14:04
-
-
Save quimbs/564c57dba361d41edcd0 to your computer and use it in GitHub Desktop.
Check if AudioContext is supported and instance it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var isAudioContextSupported = function () { | |
// This feature is still prefixed in Safari | |
window.AudioContext = window.AudioContext || window.webkitAudioContext; | |
if(window.AudioContext){ | |
return true; | |
} | |
else { | |
return false; | |
} | |
}; | |
var audioContext; | |
if(isAudioContextSupported()) { | |
audioContext = new window.AudioContext(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment