-
-
Notifications
You must be signed in to change notification settings - Fork 616
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
This plugin doesn't have events complete & error #4
Comments
Hi @cnttechio The If a method fails, it should throw an exception, although this has so far been implemented only on the Android side. The iOS side does not yet handle the error cases. Let me know if the above works for you on the Android side, and I will do more work on the iOS side. |
Hi @ryanheise . So cool, i got it, it working fine on the Android side. I will wait for you do more work on the iOS side. Many thanks |
@ryanheise How if we want to do some action after |
@ariefwijaya , almost all errors can be caught on the initial load (during You should not expect |
@ryanheise Okay, Thankyou for detail explanation. So, we can determine the play event will be failed or not in setUrl callback, |
@ryanheise I currently have also trouble to catch errors. Currently just testing on android. How do I catch asynchronous errors? For example, if I play an url audio file and turn off the internet connection and do a seek after that, I only get the following in the console:
But I don't know how to catch it in my code. Could you give an advice, please? I cannot find an error attribute in any streams or methods. Edit: Just tested further, |
Hi @Sauceee The Dart tutorial on streams may be helpful with regards to error handling: https://dart.dev/tutorials/language/streams
Updating the playing state and also having |
@ryanheise Thank you, that helped! |
@Sauceee , Did you find any solution? Unfortunately, I have the same problem |
@nsilina If you you're just playing a simple audio file, not a stream, you can do this: try {
await audioPlayer.setUrl(....);
} catch (e) {
...
} If you're playing a stream, errors can occur at any time after the initial loading, so you need to listen to errors on the stream (see the link I provided above if you need to learn more about streams). |
@nsilina Yes, with the link provided by @ryanheise I came up with the following implementation:
|
@Sauceee , thank you |
Just to update on the iOS side of things, catching errors on the As for handling asynchronous errors on the stream, this is also now implemented on the media-source branch. Issues on this branch are being tracked on #131 so if you discover any issues, please report there. Note that #131 bundles a significant number of features and therefore needs some testing. There is also a planned API change to watch out for in which I intend to make just_audio's state model more closely align with audio_service in terms of buffering. I will close this issue, and will use #131 for tracking any bugs related to the media-source branch. |
@ryanheise @Sauceee when I try this |
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. |
I just implement this plugin but i don't see function to catch event complete & error when playing audio.
Can you add features to this plugin ?
The text was updated successfully, but these errors were encountered: