Delayed sound on Android devices?

Discussion and feedback on Construct 2

Post » Sun Apr 20, 2014 1:22 am

EDIT:
The sounds are delayed on my Samsung Galaxy S4, even on web projects like the Scirra audio effects test. This problem carries over to CocoonJS.

ORIGINAL POST:
In my project I have included .m4a, .wav, and .ogg files for each sound, and they are all pre-loaded. I exported my C2 project to CocoonJS, compiled it, and installed it on my Samsung Galaxy S4.

The sounds are horribly delayed, up to a second, though the graphical performance is a smooth 60 fps. Any ideas on what's going on with the audio?
Last edited by Dalal on Thu May 01, 2014 3:54 am, edited 2 times in total.
Image
B
10
S
3
G
2
Posts: 196
Reputation: 2,053

Post » Sun Apr 20, 2014 1:51 am

Try pre-loading the sounds at the start of the layout. That should help.
A big fan of JavaScript.
B
76
S
20
G
76
Posts: 2,285
Reputation: 47,554

Post » Sun Apr 20, 2014 2:13 am

I forgot to mention that they are pre-loaded. It doesn't seem to make a difference.
Image
B
10
S
3
G
2
Posts: 196
Reputation: 2,053

Post » Sun Apr 20, 2014 2:17 am

Ah yes - I see you even mentioned that in your first sentence....!! (edit - or was that the edit?)

Dumb questions then - I presume that there is no delay when you play in on your computer/laptop and that this delay of up to 1 second only happens in cjs on your mobile? What about if you preview over LAN onto your phone using chrome for android, does that make a difference? The S4 should be able to take it and it could, of course, be a bug in cocoonjs.
A big fan of JavaScript.
B
76
S
20
G
76
Posts: 2,285
Reputation: 47,554

Post » Sun Apr 20, 2014 2:40 am

Hehe, that was the edit :)

There isn't any delay on my computer but surprisingly, over LAN I get the same delay as on CocoonJS! That's very disappointing. What could be going on?
Image
B
10
S
3
G
2
Posts: 196
Reputation: 2,053

Post » Sun Apr 20, 2014 3:10 am

Could you try on a different mobile perhaps? Could be your handset... If you don't want to post a capx, could you image an event set where the sound is played - I can't imagine what might be causing it but it's possible there could be a delay caused by the way the sounds are played in the events. With it playing correctly on your computer my suspicions are looking at your phone at the moment...

Edit - although it's an S4 - so maybe it's something in the events that is causing the sound trigger to delay on mobile only...
A big fan of JavaScript.
B
76
S
20
G
76
Posts: 2,285
Reputation: 47,554

Post » Sun Apr 20, 2014 3:51 am

I appreciate your help man. Just had a friend test it on his Galaxy Note which is a couple years old - he didn't say which version. But the sound was apparently delayed on there too, using both Chrome and Firefox. Weird! These things are a bit frustrating :x

My events are structured as follows:
Code: Select all
On Collision with 'Wall' --> Audio: Play Bounce not looping at volume 0 db (tag "")

It's similar for every time I play the audio. Nothing seems to be particularly wrong with the way I've coded this.
Image
B
10
S
3
G
2
Posts: 196
Reputation: 2,053

Post » Sun Apr 20, 2014 4:13 am

Just had a thought - if you're using physics, that might be the cause of the problem - box2d physics in HTML5 (in my opinion) is rather slow and clumsy on collisions whith current tech, so any sound delay might be caused by the high workload associated with a collision in physics (if using physics, does the game stutter ever so slightly then as well at that time?). If the physics appears ok but the sound delay is a pain, maybe you could create different non-physics families and test for a collision between them instead for the trigger? I've tried adding invisible collision objects to sprites in the past to pre-warn the event system that a collision is imminent, so sprite/sound creation doesn't get delayed too much by a collision (I gave up because I thought physics was too hesitant anyway). You could also try asm.js physics and plan to export using crosswalk, if that proves to be better in chrome?

If you're not using a physics then I'm at a loss...
A big fan of JavaScript.
B
76
S
20
G
76
Posts: 2,285
Reputation: 47,554

Post » Sun Apr 20, 2014 4:19 am

Thanks for all the insight. Unfortunately, I'm not using physics and the sound delay also occurs on this: http://www.scirra.com/labs/audioeffects/

It works fine on the computer, but on Chrome on my Samsung Galaxy S4 the sounds are delayed by half a second or more. What a bummer.
Image
B
10
S
3
G
2
Posts: 196
Reputation: 2,053

Post » Sun Apr 20, 2014 4:47 am

Maybe submit a bug report to Ashley, that seems to be the fastest/surest way to get stuff fixed in this engine -

I remember my first bug report wasn't filled out that great, but my next few actually got a lot of stuff fixed for me. Ashley is usually really good about fixing stuff if you give him a good bug report.
B
82
S
32
G
7
Posts: 281
Reputation: 10,695

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 3 guests