kittykatattack / hexi

Make games the fun way!
MIT License
551 stars 83 forks source link

Sounds on Android #10

Open artyprog opened 8 years ago

artyprog commented 8 years ago

Hy,

When I execute an hexi game on Android I got the following Error:

Script Error: Failed to execute decodeAudioDataon AudioContext: parameter 1 is not of type ArrayBuffer

Regards

kittykatattack commented 8 years ago

Thanks for reporting that! Only Chrome 50+ for Android support the WebAudio API, which Hexi uses for its sound module

http://caniuse.com/#feat=audio-api

Which Android browser version are you testing?

artyprog commented 8 years ago

I have forgotten to tell you that I have created an apk package with DroidScript. So the html is rendered in Android Webview.

kittykatattack commented 8 years ago

Interesting! 😄 These are not technologies that I'm familiar with. Do you know whether the Android Webview is compatible with the WebAudio API? My reading of this document implies that it isn't:

https://developer.chrome.com/multidevice/webview/overview

If this is correct, it means Android WebView is running Chrome v30, which doesn't support the WebAudio API.

Is this a deal-breaker? If so, I recommend a workaround by using the Howler.js library to handle playing your game sounds:

https://github.com/goldfire/howler.js/

It has a fallback on HTML5 audio.

artyprog commented 8 years ago

Howler is awesome , I will adopt it Thank you very much

kittykatattack commented 8 years ago

Great, hope that helps!