Skip to content

Commit 2892bca

Browse files
committed
Merge branch 'fix/unhandled_exception' into minor
2 parents 65c1429 + e1c1587 commit 2892bca

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

just_audio/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.10.1
2+
3+
* Fix unhandled PlayerInterruptedException.
4+
15
## 0.10.0
26

37
* New playlist API.

just_audio/lib/just_audio.dart

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ class AudioPlayer {
969969
void checkInterruption() {
970970
if (_activationCount != activationNumber) {
971971
// the platform has changed since we started loading, so abort.
972-
throw PlatformException(code: 'abort', message: 'Loading interrupted');
972+
throw PlayerInterruptedException('Loading interrupted');
973973
}
974974
}
975975

@@ -992,7 +992,7 @@ class AudioPlayer {
992992
checkInterruption();
993993
if (platform != _platformValue) {
994994
// the platform has changed since we started loading, so abort.
995-
throw PlatformException(code: 'abort', message: 'Loading interrupted');
995+
throw PlayerInterruptedException('Loading interrupted');
996996
}
997997
// Wait for loading state to pass.
998998
await processingStateStream
@@ -1464,10 +1464,7 @@ class AudioPlayer {
14641464
// An interruption that we can ignore
14651465
if (!active) return true;
14661466
// An interruption that should throw
1467-
final e =
1468-
PlatformException(code: 'abort', message: 'Loading interrupted');
1469-
durationCompleter.completeError(e);
1470-
throw e;
1467+
throw PlayerInterruptedException('Loading interrupted');
14711468
}
14721469

14731470
// This method updates _active and _platform before yielding to the next
@@ -1708,7 +1705,7 @@ class AudioPlayer {
17081705
}
17091706

17101707
_platform = setPlatform();
1711-
return durationCompleter.future;
1708+
return _platform.then((_) => durationCompleter.future);
17121709
}
17131710

17141711
/// Disposes of the given platform.

just_audio/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: just_audio
22
description: A feature-rich audio player for Flutter. Loop, clip and sequence any sound from any source (asset/file/URL/stream) in gapless playlists.
3-
version: 0.10.0
3+
version: 0.10.1
44
repository: https://github.com/ryanheise/just_audio/tree/minor/just_audio
55
issue_tracker: https://github.com/ryanheise/just_audio/issues
66
topics:

0 commit comments

Comments
 (0)