Closed jcblancomartinez closed 2 years ago
Hi @ryanheise ,
Thanks for your work on this plugin.
This is the only issue preventing me from onboarding this plugin.
Could you please let me know if this would be an easy fix?
Thanks.
Best regards.
Additionally, there is no way to catch the exception in Flutter code.
Your log shows "a stream error occurred" which indicates that it is being caught by Flutter.
If the error is still an issue for you, you may need to report it upstream with Google's exoplayer since that appears to be the actual behaviour of exoplayer. They may also be able to advise you on alternative audio encodings you can try since seeking behaviour is dependent on the encoding.
I notice that your example is based on MP3, and it is worth noting that that format is not suitable for seeking in general and especially for very long audio.
How would you catch the exception to show an error message and replace spinner with play button?
Thanks.
In terms of how to catch the exception, you already did that in your example which is what I pointed out in my first comment with your "A stream error occurred" printout. I would have thought it's a simple matter of replacing that one line of code that prints "A stream error occurred" with your own code to display whatever it is you want to display.
In any case this bug report is related to the seek behaviour, and I would say that catching the error doesn't actually solve the problem. To solve the problem, I suggest you look at the way upstream ExoPlayer behaves with long mp3 files and consider using a different encoding.
Regarding catching the error, sorry for the confusion brought.
You are right, the exception is being caught and printed here.
Thanks.
The following configuration solved my issue:
AudioPlayer( audioLoadConfiguration: AudioLoadConfiguration( androidLoadControl: AndroidLoadControl( prioritizeTimeOverSizeThresholds: true )))
Thanks.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with just_audio.
Which API doesn't behave as documented, and how does it misbehave? Seek API. When calling seek on big audio file on Android, it fails with ExoPlaybackException. Additionally, there is no way to catch the exception in Flutter code. I tried the following but 'Failed' doesn't get printed upon ExoPlaybackException.
_player.seek(duration).then( (value) => print('Succeeded'), onError: (dynamic error, StackTrace? stackTrace) => print('Failed'))
Minimal reproduction project Please, find here the modified repo.
To Reproduce (i.e. user steps, not code) Steps to reproduce the behavior:
Error messages
Expected behavior I would expect the audio to start playing in that position.
Screenshots After the exception is thrown, a spinner gets shown instead of the play button.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Flutter SDK version
Additional context
This issue happens with 1-hour long audio files too but it is easy to reproduce with this 12-hour long audio file.
Thanks.