Fix extreme delay in audio and video?

i wanted to program so that an enemy would play different audios depending on how close he was to the character, and also decided to put a game over audio as well as a video that would play if you won the game, but the enemy audio seem to only play after i already won the game, the game over audio plays after you already restarted, and i dont even know if the video loads at all, i tried to load the audio files at the beggining of the game, but that didnt work




Hello, engineer22

I can no longer find it on the Gdevelop wiki, but before there was information that in new projects we should use the actions “Play a sound” instead of “play a music”. Try changing it and see if it works.

About the video, Gdevelop Wiki says:
“Before a video can be played, you have to ensure that the player interacted first with your game (a simple click/touch on the screen is ok to allow to play videos). If you just add the condition “At the beginning of the scene” nothing will work.”

So, I think it will not starts in the beginning of the scene. Player must interact first. Maybe you could put something like a text saying “Press to continue…” and an event for when the player presses any key starts the video.

well, i tried the play a sound but the only thing that changes is that the background music seems to be delayed even further and that the enemy sounds are extremely loud even on volume 5, though the video thing did work, so thanks

Maybe to background music not be delayed you need to go to resources and active the option for Preload as sound:

Why the volume is so high I don’t know… I tested here with volume 5 and the result is a very low sound :thinking:

When enemy sounds start playing they overlap each other?

About your problem with enemy audio only starting when you win the game, I don’t know why it’s happening just by looking at your screenshots. Is there any other important event that you didn’t show? :eyes:

so uh, i kinda solved it, i preloaded all of the sounds, and even the volume problem was fixed with it, so thanks! though the sounds still overlap, so maybe if you are willing to help me find a way to either cut one sound before playing another, or programing a better way to make the character play the sounds in a certain or random order?

You could play sound on channel and simply when new/different sound should be played triggered by event
First action you should have in that event should be stop sound on said channel
Then either next action or as sub event action play another sound on that channel with different volume or whatever you want

Also idk if they are faster or better or whatever but i remember it was better to use AAC files instead of MP3
Or maybe it was just supported by more devices?
Anyway won’t hurt to convert

so i finished the game if you want to play, though the sound still didnt work (i dont think the background music will play) allilia | Play on gd.games

If you are using the action to play music you can use “preload music” instead “preload sound”.

About your game I found it too short, hehe. Perhaps it would be interesting if it was possible to use a weapon, jump, dodge other enemies…