-
-
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
Unhandled exception when LockCachingAudioSource
receives an HTTP response without Content-Length
header
#570
Comments
Sorry this one has been taking a bit longer to fix. LockCachingAudioSource only works if the original server supports range requests, and actually I thought this would be a safe assumption these days considering that Apple's OSs also expect this. But looking at the code, there is a way I can make this caching strategy work without range range requests, and I have been working on that. Is the server under your control? At the moment, I'm getting server errors trying to access the URL you provided in your example so fixing efforts have stopped for the moment. |
No worries, I am very grateful for The server in the example repro is not under my control, but it seems to be working fine for me at the moment. The server I originally found the issue with is a Polaris server (I'm the maintainer of that), which does support range requests. From what I can tell in the HTTP spec, the presence of the I'll try to find other servers in the wild that have the same behavior (although I haven't had much luck so far). Alternatively, you could run a Polaris server locally but I would understand if that was too big of a hassle. |
I just found another example in the wild, using this URL: http://soundbible.com/grab.php?id=2219&type=mp3 |
Hi @agersant I've just pushed my work so far to address this on the I haven't actually tested whether this works on your example yet, but please feel free to try it and let me know how it goes. It's not something I want to rush into merging since I don't want to break the cases where range requests are typically supported. |
Thank you for the quick fix! ✔ I tested it on my original use-case (the Polaris server) and it worked great: played audio and did cache it as intended. The ✔ I also tested the |
Glad to know it's working so far 👍
Thanks for pointing this out. Hopefully your comment will help either me or someone else to create a pull request in the future once someone runs into the issue. |
This fix is now released in 0.9.17. I'll close this issue as resolved even though there is another edge case I haven't dealt with, but it will be easier to deal with it once someone runs into the issue and creates a new issue with the details. |
Thank you! |
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?
AudioPlayer.play()
can result in an unhandled exception when attempting to play aLockCachingAudioSource
- if the remote host serving audio does not respond with acontent-length
header.Minimal reproduction project
https://github.com/agersant/just_audio/tree/just-audio-issue-570
To Reproduce (i.e. user steps, not code)
just_audio_background/example
directory!
icon in the middle of the screenError messages
Error message:
Bad end position: -1
Call stack(s):
Expected behavior
There are no errors and the audio source can be heard.
Screenshots
N/A
Desktop (please complete the following information):
Smartphone (please complete the following information):
Flutter SDK version
Additional context
Originally mentioned as a follow-up to #569
The text was updated successfully, but these errors were encountered: