[Request] Preload audio and fonts


#1

GDevelop does not preload audio and fonts.
The result is that, when we use a font for the very first time in our game, it may not be applied on the text in the scene but only after we reload the scene. And audios also may play with a slight delay when we play them for the very first time in our game which combined with this bug can be very inconvenient:
https://forum.gdevelop-app.com/t/bug-sound-music-on-channel-is-stopped-condition-return-true-before-it-is-begin-to-play
Or when you use a timer instead and the audio is not finished playing by the time the timer kicks off because of the delay.

The problem is worst and more noticeable on slow devices.

It would be nice if GD would preload audio and fonts for us before loading a scene to avoid these problems.

Thanks.


Music takes time to play
#2

I think it warns already for sounds and music to load them all by displaying a loading screen, making global volume 0, start the sound and the Music, stop them all, restore the value of the volume and hiding the loading screen.


#3

Yes, this is what I did eventually but displaying 2 loading screens one after the other is does not look very polished or to have just a blank screen for a few seconds either. If you have lots of audio to preload, it could take 4-5 seconds to completely preload them all on a slow device. I would prefer to wait this much longer on the initial loading screen instead of making a second one, but thank you for the tip. :+1:


#4

Hate to bump an old thread, however:
Once a sound is loaded into memory, is it only loaded for that specific channel?

e.g. If I preload a sound on channel 100, but then decide to play it on channel 1, will it not count as preloaded?


#5

It looks like the sound and music cache in the sound manager is global, so maybe yes, but then maybe howler doesn’t.


#6

Actually, music is already preloaded (see https://github.com/4ian/GDevelop/blob/99312c71e0e7ec9385400901ff209196834cedd4/GDJS/Runtime/runtimegame.js#L367) they are in memory, but Howler didn’t process them already


#7

Hmm… This feels like it’d be super important to figure out why it doesn’t load correctly.

Also, are we talking Music AND sounds? or just the (somewhat buggy) play music event?


#8

We are talking about both


Add a Preload Sounds Feature