Open sh4msi opened 3 years ago
I need to know the minimal reproduction project to test these steps on. If the example exhibits the bug, please write "the example" under that section as per the instructions.
I run and checked the official example (example_playlist.dart)
Run code on the device
Playlist play
Internet disconnection
Wait like until the end of the playback of the buffer and auto go to the next song
Wait for it to try to load the next music
See error in console, no listener reaction to error
I can not ask this question and suggestion here or in separate issues Or in Stack Overflow
Now, by default, when the Internet is down or there is a problem loading the file (404, invalid url ...), it is automatically redirected to the next song, and this process continues until the last playlist item. Of course, after fixing the reported bug, it can be controlled by handling error But I wanted to know if there is a parameter to control this at the moment? Or is it not better to add such a feature? (Two parameters, 1. was separate for disconnecting the Internet, 2. Other cases)
Hmm, I just tried to reproduce this on a Pixel 3a, Android 11, Flutter 2.5, but it was working correctly for me:
E/ExoPlayerImplInternal(20390): Playback error
E/ExoPlayerImplInternal(20390): UnknownHostException (no network)
E/AudioPlayer(20390): TYPE_SOURCE: java.net.UnknownHostException: Unable to resolve host "s3.amazonaws.com": No address associated with hostname
I/flutter (20390): A stream error occurred: PlatformException(0, Source error, null, null)
Just to confirm, are you testing the latest version in git?
But wait, according to your screenshot, it's also working correctly for you too. The error is being caught by Flutter and is being printed out.
Yes, as I wrote in the description, it will be printed on the console, but it will not show any reaction in playbackEventStream, so I can not control it.
I want to be able to handle this error when it occurs
You wrote in the description:
In this case, I do not receive any errors by listening to playbackEventStream for error handling, while I receive UnknownHostException on the console.
But that's not true according to both my test and your screenshot.
But I think it's true and playbackEventStream shows no reaction to UnknownHostException
Was it different for you? Do you get an error about UnknownHostException or disconnected internet by listening to playbackEventStream?
I can not ask this question and suggestion here or in separate issues Or in Stack Overflow
Now, by default, when the Internet is down or there is a problem loading the file (404, invalid url ...), it is automatically redirected to the next song, and this process continues until the last playlist item. Of course, after fixing the reported bug, it can be controlled by handling error But I wanted to know if there is a parameter to control this at the moment? Or is it not better to add such a feature? (Two parameters, 1. was separate for disconnecting the Internet, 2. Other cases)
Is there a solution to this issue?
It seems like we're dealing with two issues here. One is the original bug report, and another is a feature request. Let's deal here with the bug report.
But I think it's true and playbackEventStream shows no reaction to UnknownHostException
Was it different for you?
Yes, as I already showed you with my logs:
E/ExoPlayerImplInternal(20390): Playback error
E/ExoPlayerImplInternal(20390): UnknownHostException (no network)
E/AudioPlayer(20390): TYPE_SOURCE: java.net.UnknownHostException: Unable to resolve host "s3.amazonaws.com": No address associated with hostname
I/flutter (20390): A stream error occurred: PlatformException(0, Source error, null, null)
Notice that the last line is printed by the onError
handler.
But it also seems that your own screenshot shows the exact same correct behaviour:
I run and checked the official example (example_playlist.dart)
Run code on the device Playlist play Internet disconnection Wait like until the end of the playback of the buffer and auto go to the next song Wait for it to try to load the next music See error in console, no listener reaction to error
Since you're posting screenshots rather than text, it's a bit hard for me to point to you which specific line proves that it's working, but you see the part in blue that you've highlighted/selected, the next line after that bit is printed out by your onError
handler proving that it does reach your Flutter code.
If you have found in another app that onError
isn't being called please submit a minimal reproduction project for that. And if you want to make a feature request, you are welcome to open a separate issue (but please check if the feature has already been requested by searching past issues.)
Hi @ryanheise, I am very grateful for the time you left and answered
I just realized where the problem is!
If you pay attention, the first image also has an error, but it is not printed by playbackEventStream and can not be handled (just_audio_background + just_audio)
But in the second image, the error is printed by playbackEventStream and can be handled (just_audio)
This problem occurs when we use just_audio_background And I'm using it too What is the solution?
To start with, please fix your bug report. Skipping on the minimal reproduction project, and then later providing an incorrect claim that the just_audio example exhibits the bug, may seem initially to save you time, but it actually wastes my time, and then indirectly ends up wasting your time too.
The next step for you is either:
hi. is there any fix for this issue even if its a work around, i just finished a project i'am working that uses just_audio_background and i didn't discover this issue until i finish the project so @ryanheise please will this be fixed soon.
on ios devices u can also find this issue if you play a concatenating audio source and turn of internet connection, the audio player becomes unresponsive at this point seekToNext(), seekToPrevious() and all methods wont work after this, the only way that it will work is if you stop the player and start again.
so please a work around will be greatly appreciated even if it's not fixed
As per my previous comment:
The next step for you is either:
- Wait for it to be fixed.
- Fix it yourself and submit a PR.
- Use audio_service directly where you'll be in full control of everything within your own app.
Hello, Any update on this? For me, it is a big issue! I can't catch an exception
Hello @ryanheise!
There has been some great work by @matecode, who has probably found the source of the issue here: https://github.com/ryanheise/just_audio/issues/870#issuecomment-1325076495. If it's fine for you, I'll prepare a fix, that redirects errors from the mentioned catchError
to _playbackEventSubject
error. If anyone else has other ideas regarding the cause, feel free to share them, so I can test them. I'll also try to prepare a minimal reproducible example on my fork. I'm really commited to fix this issue (receiving errors in playbackEventStream
when using just_audio
+ just_audio_background
), as it heavily affects my app.
Which API doesn't behave as documented, and how does it misbehave? This happened when I disconnected from the Internet and waited for the buffer to finish playing and try to play the next song. In this case, I do not receive any errors by listening to playbackEventStream for error handling, while I receive UnknownHostException on the console.
Minimal reproduction project The example (just_audio_background + just_audio)
To Reproduce (i.e. user steps, not code) Steps to reproduce the behavior:
Error messages
Expected behavior Listen to all errors
Screenshots
Desktop (please complete the following information):
Smartphone (please complete the following information):
Flutter SDK version