I'm attempting to use AudioContext() in the latest version of Chrome (34.0.1847.114) on a Samsung Galaxy SII 4G, but for some reason AudioContext() does not exist, nor does webkitAudioContext. The exact same code functions perfectly fine on a Nexus 5 and an older phone like a Galaxy Nexus, but not the SII. Is HTML5 audio not supported on some devices? If not can anyone explain why or point me to some documentation about AudioContext support?
Exact code I'm using:
window.AudioContext = window.AudioContext || window.webkitAudioContext;
context = new AudioContext();
Again, this works perfectly fine on other Android phones. On the S2 I get "Uncaught TypeError: undefined is not a function".
Webaudio API is still a working draft. See here for a support list.
Apparently not all Android devices are ready for it ... yet. See here for an example. As with any of those new (exciting) features you need to test support before using them on a device:
var contextClass = (window.AudioContext ||
window.webkitAudioContext ||
window.mozAudioContext ||
window.oAudioContext ||
window.msAudioContext);
if (contextClass) {
// Web Audio API is available.
var context = new contextClass();
} else {
// Web Audio API is not available. Fallback
}
Reference
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With