Audio not working in Android

0 favourites
  • 7 posts
From the Asset Store
100+ Musical High Quality Sound Effects for your game!
  • Problem Description

    Hi guys! I have a problem with a game project that I've been performing with Construct 2 since a few months. I'm testing a demo, it runs perfect on Chrome, Firefox, etc... But when I'm tried export it to PhoneGap to test it in Android, problems begun.

    Of course the .apk file generated with the PhoneGap Build on the cloud service doesn't work, so I tried to create the native app manually, exporting the files to an Apache Cordova project, and testing it with the Android SDK. It runs fine, good fps working, but sound doesn't work.

    I also tried to export the project using CocoonJS. In that case, sound works, but the fps are painful (around 5 ) and sound also has low latency. So I discarted CocoonJS for now, because the sprites of my demo move using the Simulate Control of the Platform Behavior, so I can't use the "*dt" expression to fix low latency.

    So finally I think that I need some solution to fix the sound in Apache Cordova. Can anyone help me? Anyone knows about any way to fix that with Construct, or using JavaScript or something? Thanks!

    Description of Capx

    Demo for a game project. Designed for testing enemy AI behavior, that's the reason because the player character is only a blue box from the scrolling platform template.

    Every 1.5 seconds enemies spawn from the sides of the layout, with random appareance and speed, and shoot to their enemies using LOS.

    Steps to Reproduce Bug

    • Export to PhoneGap to test it on Android.

    Observed Result

    Sound doesn't work

    Expected Result

    I need to find a solution to fix the problem with sound.

    Affected Platforms

    • Android

    Operating System and Service Pack

    Developed on Windows 7 Ultimate 64 bits

    Tested on Android 4.3 (Huawei Ascend G630)

    Construct 2 Version ID

    Release 146 (64 bits)

  • You need to follow the posting guidelines and include a minimal .capx and precise instructions.

    I would also recommend updating C2 to the latest build - r178, link in footer - if you are really still using 146, as many changes have happened since that build.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Buy a license and use the latest version.

  • I just purchase a r178 license, and sound still not working in PhoneGap and even not in Crosswalk. I attach the .capx file to the post. I hope anyone can find a solution. Thanks.

  • Your description is too vague. It could be so many things, to be honest. There is a right way and many wrong ways to do it. Provide more details and I'll try to help. I've been through this lately, so it's pretty fresh in my memory.

  • OK, I'll try to explain it again by the best way I can.

    There are two invisible sprites (each one in a corner of the layout). Every 1.5 seconds. The invisible sprite spawns an enemy sprite, with random speed and appareance. Those enemy sprites include the LOS behavior. When a sprite has LOS with his enemy, that sprite spawn bullet sprites, the bullets collide with the enemy and the enemy dies. That's simple, the demo consists in a "no-stop" battle between two fictional factions.

    Each of those enemy sprites reproduce two different sounds: when they spawn bullets, and when they're destroyed. Each sound file has .m4a and .ogg versions previously imported to the project. I hope you can see all of this well if you take a look of the .capx file.

    The point is, this demo works great on web browsers (Chrome, Firefox, Opera...), but, when I try to export it to Android, sound doesn't work. I'm going to put a list of different ways that I tried, all of them failed:

    • Export to PhoneGap and generate .apk file with PhoneGap Build -> Result: Android isn't able to read de .apk file
    • Export to PhoneGap, generate an Apache Cordova project manually and import it to Android Developer Tools SDK -> The .apk file works, good fps, but audio is not workig.
    • Export to CocoonJS -> Audio works, but the demo runs at 5 fps. Painful xD
    • Export to Crosswalk using Intel XDK -> .apk file doesn't work.

    I'm definitely desperate. Anyway, thanks for your interest, guys. But I can't find a solution, I'm thinking on start to learn Unity and start the project from the beginning.

  • Ok guys, problem solved! It seems like the "play at object" action of the Audio object doesn't work on Android, but "Play" action works nicely, and good performance with the fps using PhoneGap! Thanks for your help!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)