Open cqueen opened 3 years ago
I'm experiencing the same issue.
I having the same inconvenient right now.
What about now? Doesn't fixed? I have the same issue. This topic is stated from 2 Sep 2021.
Can you recheck with audioplayers: ^1.1.0
? We do not have the time to fix all errors. Please contribute with a PR then!
@cqueen @brannendl @sircontreras @EvGeniyLell I think this issue does not appear in the same form since AP 1.x.x
as AudioCache doesn't have the play method anymore. If you have a similar issue with the current lib, feel free to reopen. I'll mark this as stale.
We are happy for any contribution to fix this issue.
Overview On iOS, repeated calls to the audioCache.play method will eventually exhibit a delay between the method call and the playback of the sound. Continuing to call play() will slowly introduce a longer and longer delay until the application crashes.
Full Description I first noticed this issue when testing my application sounds on an iOS device. As I continued to play, the sound playback started playing the sound later and later after the time the play() was called. If I stopped pressing and activating sounds, the sounds would eventually come back in a flurry (stacked on top of one another). Note that 95% the sounds in my application are through user interaction (button presses), so it did happen in a standard use case.
In order to isolate the issue, I used the default Flutter app to continually play a mp3 asset over and over again, incrementing the counter as it goes. I noticed the delay creeps in after repeated use, and eventually leads to a crash in the application. In the default Flutter app on my setup, it can play the mp3 about 1000 times (or much sooner on physical device) before the crash happens. It does not appear that the delay between sounds that I introduce (line 40) has much effect on the issue. If I set the delay between play calls at 50ms, 500ms or even 2000ms, it will still crash around the 1000 mark on my iOS Simulator.
Code to Reproduce
Log Errors (Partial - from the last error before crash. Can include more if needed.)
Files/URLs/Sources No special files needed - I used my own as well as two of the mp3s from the example project (https://github.com/luanpotter/audioplayers/tree/master/packages/audioplayers/example/assets/messenger.mp3). Note that a shorter file may take more plays to exhibit the issue.
Platforms
Issue Experienced on:
Platform 1 OS: iOS Version: 14.5 Device: Simulator - iPhone 12 Pro Max Flutter Version: Channel dev, 2.6.0-0.0.pre Audioplayers version: 0.19.1 Build: Debug
Platform 2 OS: iOS Version: 14.7.1 Device: Physical - iPhone 12 Pro Flutter Version: Channel dev, 2.6.0-0.0.pre Audioplayers version: 0.19.1 Build: Release Peculiarities: The physical device seems to hit the limit MUCH faster before the sounds stop playing and the app eventually crashes.
Issue NOT experienced on:
Platform 3 OS: Android Version: 11 Device: Simulator - Pixel 3 API R Flutter Version: Channel dev, 2.6.0-0.0.pre Audioplayers version: 0.19.1 Build: Debug
Platform 4 OS: Android Version: 10 Device: Physical - Pixel 3a Flutter Version: Channel dev, 2.6.0-0.0.pre Audioplayers version: 0.19.1 Build: Release
This is a great and super useful library, thank you for putting it together! Please let me know if there is anything else I can do to help solve this issue.