Internet Explorer and Audio
superherogeek

Hi,

Sorry to bother.  I have my game workign in FireFox, Chrome and Safari, but in IE (version 11), I have to remove all of the audio files completely before the file will play. Otherwise I get the error "the WebAudio API is not supported in this environment. Audio functionality will be limited".  For IE 10, I get an error "unable to get property of 'uniforms' of undefined or null reference in wade.js.  Opera has an issue too, but I'm much less worried about that.  Is there something I should be doing specific to IE 10 and 11 to make things work smoothly?

Thanks

All 3 Comments
Gio

Hi

On older browsers, and specifically internet explorer, audio is very poorly supported (it's a general problem, not specifically WADE's problem) and you have 3 options:

1. The easy / lazy way: click the "WebAudio Only" option in your scene's properties and audio will only load where WebAudio is supported. In other words, you will get no audio in IE but it will work in browsers that support WebAudio, including Microsoft Edge.

2. Do not add your audio files to the scene. Instead, in app.js, add a load function to your App where you do something along these lines:

this.load = function()
{
    wade.preloadAudio('myAudioFile.ogg');
};

You can then use playAudio() normally, but this approach will not guarantee that your files will be loaded before starting the game. If you call playAudio() on a file that hasn't finished loading, it will not play.

3. Call wade.isWebAudioSupported() and based on the result call either wade.loadAudio or wade.preloadAudio in your load function:

this.load = function()
{
    var loadAudioFunction = wade.isWebAudioSupported()? 'loadAudio' : 'preloadAudio';
    wade[loadAudioFunction]('myAudioFile.ogg');
};

Regarding your other problem with IE 10, could you be a bit more specific? It sounds like it could be a bug and I'd like to fix it, what do I need to do to replicate it? If you want to share your project files I can have a look.

superherogeek

Sure.  my project files are attached and here is a video showing the error.  The audio code all had the same effect, but I'm sure I did something wrong with that, so I show you in the vidoe where I put that code as well.

https://youtu.be/nE8quFzegac

Gio

Hi, I just had a quick look. Also thanks for taking the time to do the video, it did help. Just a couple of quick observations:

1. You don't need to call wade.preloadAudio for both .ogg and .acc - just do it for one type (say ".ogg") and WADE will replace it with .aac automatically depending on which browser is being used.
2. The load function to preload the audio only needs to be in apps.js, not in card.js
3. Unrelated, but when images are used by sprites in the scene, you don't need to add those images in the scene properties - WADE will know that they are used and load them before the game starts

Having said that, when calling preloadAudio from the load function in app.js, it should theoretically work in IE 9+ - with the caveat that calls to playAudio() before the file has finished loading will silently fail.

Is it possible that the particular .aac format that you are using isn't supported by Internet Explorer? There are sadly several varieties of .aac and only a few work with IE. In my personal experience, converting a file from iTunes generates an .aac that works both in IE and Safari, other tools such as Audacity fail to create files that IE would like.

Regarding the problem with IE10, that's definitely something that we can fix, in fact I've fixed it locally and we'll try to roll out a new version with this fix early next week.

Post a reply
Add Attachment
Submit Reply
Login to Reply