Skip to content Skip to sidebar Skip to footer

HTML5 How To Replace WebAudio API For Internet Explorer For Javascript Games?

I'm new with audio in html. I found some nice examples for little javascript games. Want I try to load the games in Internet Explorer, I got : 'Web api audio is not supported in

Solution 1:

My question, is there is a way to detect if the browser support WebApiAudio and offering a fallback if is not supported ?


"use strict"



function audioContextCheck() {
    if (typeof AudioContext !== "undefined") {
        return new AudioContext();
    } else if (typeof webkitAudioContext !== "undefined") {
        return new webkitAudioContext();
    } else if (typeof mozAudioContext !== "undefined") {
        return new mozAudioContext();
    } else {

       // Do stuff with soundmanager or something else if Web Audio API is not supported




    }
}
var audioContext = audioContextCheck();

Post a Comment for "HTML5 How To Replace WebAudio API For Internet Explorer For Javascript Games?"