Software Archive
Read-only legacy content
17061 Discussions

soundjs not working on android phone

Bigfanx__
Beginner
576 Views

   
Hi, I developed a html5 game using the createjs library including easeljs, preloadjs and soundjs in intel xdk environment. I tested it on intel xdk emulator and everything works fine. Then, I built the apk file using the classical android option in intel xdk and exported it to my android mobile which has android 4.4 version. Unfortunately, the sound I added to the game using soundjs doesn't work. However, if I build the apk file using the android crosswalk option and test it on my mobile, the sound works fine. However, the side effect of this option is the apk file size becomes much bigger (more than 20mb, the original file is less than 3mb). I googled it a bit and found this approach (http://www.createjs.com/tutorials/Mobile%20Safe%20Approach/). I tested this approach both on intel xdk emulator and my mobile as well. It works fine on intel xdk but doesn't work on my mobile. It seems that only the crosswalk option works on android mobile but the others. The code I wrote using soundjs is added below. Does anybody know the reason why soundjs doesn't work on the android native browser. Thanks a lot in advance.

function preloadBgSound(){
var queue = new createjs.LoadQueue();
createjs.Sound.alternateExtensions = ["mp3"];
queue.installPlugin(createjs.Sound);
queue.addEventListener("fileload", playBgSound);
queue.loadFile({id:"bgSound", src:"asset/happy_adventure.ogg"});
}

function playBgSound(){
createjs.Sound.play("bgSound", {loop:-1});
}   

 

0 Kudos
2 Replies
PaulF_IntelCorp
Employee
576 Views

The Android native webviews are highly variable, in terms of functionality and behavior. Despite the increased size of your app, we HIGHLY RECOMMEND that you use Crosswalk, since it will behave consistently across Android 4.0+ devices. See this blog for more details: http://blogs.intel.com/evangelists/2014/09/02/html5-web-app-webview-app/

0 Kudos
Bigfanx__
Beginner
576 Views

Hi Paul, thanks a lot for your reply. Maybe we have to wait many years to get the android native browser to have a decent support for html5 apps. It is a pity. I am going to publish my game using crosswork now.

0 Kudos
Reply