How do I fix audio delay?

Get help using Construct 2

Post » Mon Apr 24, 2017 8:49 pm

Hi.

I'm having a little problem with playing audio in Firefox.
What I'm trying to do is simply play an explosion sound on collision. But the problem is, when collision is happening for the very first time, the explosion sound is played about two seconds after the collision but only for the first time. After the first time the sound is playing fine but never the first time. It is not a big deal but I just don't really like it and I would like to fix it if possible.

I was searching the forum and I tried all the suggestions I found:
-tried exporting the project but didn't solved the problem, I get the same result
-the sounds are preloaded in the first layout and I go to the next layout after all the sounds are preloaded
-the sounds are stored in the sound directory
-deleted the duplicated sound files created by the importer and left only a single sound file (.ogg)
-my browser is up to date
Nothing worked. The only thing I haven't tried yet is to upload the exported HTML5 game to a host such as itch.io...

If I preview in Google Chrome, it works, no problem there, the sound is playing as it should. I have this problem only in Firefox.
Is there anything else I can try to fix this or it is down to Firefox (and Construct 2) to provide better support and compatibility?

Thanks.
B
4
S
1
Posts: 28
Reputation: 406

Post » Mon Apr 24, 2017 10:58 pm

Sounds like a browser issue. If it only happens the first time, try playing the sound once (muted) on start of layout?
Mistakes were made.
B
54
S
28
G
115
Posts: 1,705
Reputation: 65,083

Post » Tue Apr 25, 2017 9:52 pm

try playing the sound once (muted) on start of layout

Thanks a lot, it worked :)
B
4
S
1
Posts: 28
Reputation: 406

Post » Tue Apr 25, 2017 10:55 pm

It could also be that you haven't preloaded that audio file. So playing it silently accomplishes that, but there's an event in the Audio plugin to pre-load specific audio files so they don't have to be loaded in on their first play.
B
103
S
38
G
19
Posts: 962
Reputation: 17,996

Post » Wed Apr 26, 2017 6:05 pm

there's an event in the Audio plugin to pre-load

Yes I tried that but it doesn't work. I even tried to preload the audio in the first layout and go to the next after all the audio is preloaded but still having the problem. The only thing helps (for some reason) if I play the sound once on start of layout.

But I have this problem only in Firefox and only if I play sound at object. If I just "play sound" that works.
It must be something with Firefox and the "play sound at object" action.
B
4
S
1
Posts: 28
Reputation: 406


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests