You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which API doesn't behave as documented, and how does it misbehave?
Set audio source to LockCachingAudioSource type, preload to false, get Unhandled Exception after calling player.load method.
Minimal reproduction project
The example
try {
final source = LockCachingAudioSource(Uri.parse(
"https://no-exist-url.test-host/test.mp3"));
await _player.setAudioSource(source, preload: false);
// Calling the load method at other times
await _player.load();
} catch (e) {
print("Error loading audio source: $e");
}
To Reproduce (i.e. user steps, not code)
Steps to reproduce the behavior:
Set audio source to LockCachingAudioSource type, preload to false.
Expected behavior
An Unhandled Exception is thrown.
Screenshots
N/A
Desktop (please complete the following information):
Not running on Desktop / Web
Smartphone (please complete the following information):
Device: iPhone8
OS: iOS16.1
Flutter SDK version
Flutter 3.3.3
Additional context The code that threw the exception:
In LockCachingAudioSource.request(), Future error is thrown when fetch fails, but cannot be handled.
// Line: 3120
_response ??=
_fetch().catchError((dynamic error, StackTrace? stackTrace) async {
_response = null;
for (final req in _requests) {
req.fail(error, stackTrace);
}
// Return a Future Error, which cannot be handled by outer.
return Future<HttpClientResponse>.error(error as Object, stackTrace);
});
Bug Fix Suggestion:
I think it's unnecessary to cache the fetch Future object, but rather use an isFetching variable to preserve the state.
Since there isn't currently any retry logic, the fetch result is actually ignore.
Even if retry logic is added later, call the fetch method directly and does not require the last failed Future object.
Which API doesn't behave as documented, and how does it misbehave?
Set audio source to LockCachingAudioSource type, preload to false, get Unhandled Exception after calling player.load method.
Minimal reproduction project
The example
To Reproduce (i.e. user steps, not code)
Steps to reproduce the behavior:
Error messages
Expected behavior
An Unhandled Exception is thrown.
Screenshots
N/A
Desktop (please complete the following information):
Not running on Desktop / Web
Smartphone (please complete the following information):
Flutter SDK version
Additional context
The code that threw the exception:
In LockCachingAudioSource.request(), Future error is thrown when fetch fails, but cannot be handled.
Bug Fix Suggestion:
I think it's unnecessary to cache the fetch Future object, but rather use an isFetching variable to preserve the state.
Since there isn't currently any retry logic, the fetch result is actually ignore.
Even if retry logic is added later, call the fetch method directly and does not require the last failed Future object.
The text was updated successfully, but these errors were encountered: