Skip to content Skip to sidebar Skip to footer

Why Does This Code Work In Safari But Not Chrome? Arrrgh

Chrome v6, Safari v7 (works in v6) if('AudioContext' in window) { var myAudioContext = new AudioContext(); const PATH = 'Sounds/', SOUNDS = ['Tock

Solution 1:

Chrome still uses an older webkitAudioContext. This is how I set up context in SoundJS, and it works everywhere:

if (window.webkitAudioContext) {
    s.context = new webkitAudioContext();
} else if (window.AudioContext) {
    s.context = new AudioContext();
}

Hope that helps.


Post a Comment for "Why Does This Code Work In Safari But Not Chrome? Arrrgh"