Expo-AV not playing audio after a while, and how to fix it
08/28/2024 08:36, 1 year ago
Recently, I was working on my game AI Against Humanity, where I encountered a bug in Expo-AV.
Namely, I was trying to play sounds.
And while it at first worked fine, after playing sounds for a few minutes, eventually I would run into this issue:
This was due to a memory leak in my application.
When you load sounds with await Audio.Sound.createAsync(source), it doesn't automatically unload it.
So I just wrote a custom hook, useSoundEffect, that you can use out of the box in your Expo app as well.
Here it is:
It's supposed to be used like this:
That's about it for now, I'll see you soon
With love from wituz
1
1
Write a reply (0/3500)
Replies
0
(1/1) 11/07/2025 17:36, anonymous user wrote
if someone lands here trying to debug your mp3 not working in expo, my problem was that the file was .MP3 and not .mp3 thanks for your guide !