No sound for the offline dinosaur game on iOS |
||||||||
Issue descriptionThe sound is not available for the offline dinosaur game on iOS. This may be caused by the audio context used by iOS for decoding the mp3 files. Every other platform is using AudioContext where we have to use webkitAudioContext on iOS. The webkitAudioContext on iOS cannot decode the mp3 files: the this.audioContext.decodeAudioData(buffer) function fails. One possible fix could be to change the mp3 files so they can be played on iOS.
,
Jul 18 2016
This is a known problem but I couldn't find an acceptable workaround. Do you know why webkitAudioContext can't decode the audio files when they are base 64 encoded? I haven't done any more tests on this recently, so don't know if anything has changed since moving to WKWebView and if this works now.
,
Jul 19 2016
It is not about decoding base 64 files. This example http://html5doctor.com/taking-web-audio-offline-in-ios-6-safari/ works and it is base 64 encoding. I think it might be caused by something like this: http://stackoverflow.com/questions/10365335/decodeaudiodata-returning-a-null-error (the problem could be due to the mp3 file itself) but the fix proposed in this post does not work.
,
Jul 19 2016
Thanks, yes the decoding seems to fail, I'll have a look at this again, trying alternate MP3 files.
,
Jul 20 2016
This is happening because the loadSounds function is wrapped in a "if (!IS_IOS)" condition. Removing this throws an exception, however, as AudioContext() cannot be found. It looks like iOS requires using the "webkit" prefix for this class, so I did a quick attempt at enabling that code on iOS and initializing the audio context using "new webkitAudioContext". With this change, no exceptions are thrown (i.e. iOS found webkitAudioContext), but the sounds are still not playing...
,
Jul 20 2016
Yes, I mentioned that in #0. The error comes from this.audioContext.decodeAudioData(buffer) (using webkitAudioContext). The error returned by this function (by adding a 3 argument) is null.
,
Jul 20 2016
re #5: This was done because there wasn't a suitable work around at the time. Am looking at generating the sound files a different way.
,
Apr 13 2017
,
Apr 20 2017
,
Oct 26
,
Oct 26
,
Oct 30
|
||||||||
►
Sign in to add a comment |
||||||||
Comment 1 by baxley@chromium.org
, Jul 14 2016Status: Available (was: Untriaged)