Audio not working in Android

Bugs will be moved here once resolved.

Post » Thu Aug 28, 2014 2:47 pm

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)
Last edited by H4RB4R0 on Sun Aug 31, 2014 4:33 pm, edited 3 times in total.
B
3
Posts: 4
Reputation: 183

Post » Thu Aug 28, 2014 2:58 pm

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.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
137
S
31
G
87
Posts: 5,555
Reputation: 60,454

Post » Thu Aug 28, 2014 3:06 pm

Buy a license and use the latest version.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
296
S
119
G
96
Posts: 7,332
Reputation: 71,306

Post » Fri Aug 29, 2014 8:32 pm

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.
B
3
Posts: 4
Reputation: 183

Post » Fri Aug 29, 2014 8:36 pm

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.
B
35
S
9
G
3
Posts: 493
Reputation: 4,092

Post » Fri Aug 29, 2014 10:50 pm

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.
B
3
Posts: 4
Reputation: 183

Post » Sun Aug 31, 2014 4:32 pm

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!
B
3
Posts: 4
Reputation: 183


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 2 guests