-
Notifications
You must be signed in to change notification settings - Fork 823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resource leak? #56
Comments
Hi, @Eneum Each time the cache plays a new audio, if using the default configurations, it will create a new AudioPlayer and load the resource, but on RELEASE mode, meaning that as soon as it finishes playing, the player is released. That is, however, just on Android. On iOS, the release function does nothing, as I believed there was no need to release the media player for iOS. Maybe that's a problem with that? To test this theory, you could set the fixedPlayer property on the audiocache and now every call to play will use the same player (you won't be able to play simultaneously, though). The best way to handle this if you have possible overlapping sound is to use the AudioPool class provided by Flame. In fact, if you are building a game-like app, I'd suggest taking a look at Flame to help you out, it provides lots of goodies to help with games. The AudioPool class can be found here; it creates a pool of pre-loaded audioplayers (you control min and max) to have one always ready for quick firing sounds but also don't overload the heap with tons of players. The parameters are:
Please let me know if this helps you out! |
Closing this due inactivity, if you still have problems, feel free to open a new issue. |
Using AudioCache player to repeatedly play a sound effect in a game-like app. on iOS, after a large number of plays, the sound disappears, and the whole app comes to a screeching halt, and then crashes. Looks like some sort of resource leak that gets accumulated over time.
The text was updated successfully, but these errors were encountered: