-
Notifications
You must be signed in to change notification settings - Fork 853
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
MediaPlayer throws (sometimes) IllegalStateException when playing sound #1331
Comments
Thank you for your detailed report! Unfortunately I don't have the time to try until the error is thrown. FYI: #1322 |
Yeah, I know that with no steps, this is like looking for a needle in a haystack. Will follow the other issue, as seems to be the same problem. I do not know how I did not find out that issue without opening this one. Thanks! |
This error will be triggered when playing audio with play () for several times in a short time. |
This is most probably exactly the same issue I experienced here |
In the rare case, that an media player error occurs (like when playing unsupported media sources), the player still is in the "prepared" state, although the internal MediaPlayer state isn't anymore. Then it could keep calling methods, which lead to an illegal MediaPlayer state. By resetting this variable on a media error, this should not make the library crash anymore, but still emit the error. Fixes #1260 Fixes #1331
Checklist
Sometimes, at the time of playing a sound, a Platform exception regarding
MediaPlayer
is raised.Current bug behaviour
At the time of playing a sound, following exception is thrown:
The stack trace was this:
As it was reported by our remote crash reporting tool, we do not know whether the sound is actually played.
Expected behaviour
No exception should be thrown. Sound should play.
Steps to reproduce
Unfortunately, we have not been able to reproduce the issue at the office. From the metrics we get from our crash reporting tool, the issue is quite rare compared to the number of sounds played with no problems. I've attached the code of our real service in charge of playing the sound.
Code sample
Logs
Full Logs
Flutter doctor:
Environment information
^1.1.1
Platform 1: android
release
The text was updated successfully, but these errors were encountered: