Laggy Audio on Multiple Plays


#1

Hello, I am having a situation where I need to produce a sound whenever the user clicks on a certain component, I used the audio API and it’s working pretty well except that after a while when the user clicks too much, the sounds start to become too laggy and only heard few seconds after the click, I thought maybe each time an audio is loaded it needs to be cleaned up, so I used audio.unloadAsync but to no avail, I think unloadAsync did not remove the object from memory but it only changed its status to unloaded. any ideas?


#2

Hi @alialaa17, sorry for the troubles here. It may be faster when running in prod mode, but the async nature of it is not ideal. We recognize the difficulty and may have fixes to this in the future.


#3

I share the same sentiments at alialaa17 – this problem needs to be addressed.


#4

Hi - instead of repeatedly loading the same audio asset, it might help to reset its playback position to zero and then play the same asset again.


#5

We’re trying to load ~ 14 small audio files simultaneously and only occasionally does Android successfully load all of them. We need immediate playback, which is why we’re loading all of them initially, rather than lazily (but even lazily doesn’t work).

Are there any plans from the expo team to address the many issues that people are having with the Audio module for Android? The issues on Android are big enough that perhaps you should throw a disclaimer on the Audio documentation. We can’t hold more than 14 small sound objects simultaneously. We’re going to have to leave expo soon if this is the case, and would have loved to know about these issues earlier.


#6

I’m really sorry to hear you’re having these issues and want to help you get to a good place with your app. We’re not actively working on the Expo.Audio API so for the time being you might want to eject or perhaps use the WebView React Native API to play sound clips.

Longer term we are looking to make the native code much less of a hidden detail in an “uncanny valley” and more exposed, so that you can more easily write your own Obj-C and Java to address these issues, ultimately giving you more control and agency for your priorities.


closed #7

This topic was automatically closed after 14 days. New replies are no longer allowed.