From ed4bd593573a069150135cbb09e0be0370dc1456 Mon Sep 17 00:00:00 2001 From: Ryan Heise Date: Thu, 26 Sep 2024 14:26:29 +1000 Subject: [PATCH] Fix stop() to cause play() to return on iOS. --- just_audio/CHANGELOG.md | 4 ++++ just_audio/darwin/Classes/AudioPlayer.m | 9 +++++++++ just_audio/pubspec.yaml | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/just_audio/CHANGELOG.md b/just_audio/CHANGELOG.md index 394865daf..09f36b93c 100644 --- a/just_audio/CHANGELOG.md +++ b/just_audio/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.9.41 + +* Fix stop() to cause play() to return on iOS. + ## 0.9.40 * Fix JDK 21 compile error. diff --git a/just_audio/darwin/Classes/AudioPlayer.m b/just_audio/darwin/Classes/AudioPlayer.m index d22719d01..0214563b3 100644 --- a/just_audio/darwin/Classes/AudioPlayer.m +++ b/just_audio/darwin/Classes/AudioPlayer.m @@ -1330,6 +1330,15 @@ - (void)dispose { if (!_player) return; if (_processingState != none) { [_player pause]; + + [self updatePosition]; + [self broadcastPlaybackEvent]; + if (_playResult) { + //NSLog(@"PLAY FINISHED DUE TO STOP"); + _playResult(@{}); + _playResult = nil; + } + _processingState = none; // If used just before destroying the current FlutterEngine, this will result in: // NSInternalInconsistencyException: 'Sending a message before the FlutterEngine has been run.' diff --git a/just_audio/pubspec.yaml b/just_audio/pubspec.yaml index 517110717..bc8987a81 100644 --- a/just_audio/pubspec.yaml +++ b/just_audio/pubspec.yaml @@ -1,6 +1,6 @@ name: just_audio description: A feature-rich audio player for Flutter. Loop, clip and concatenate any sound from any source (asset/file/URL/stream) in a variety of audio formats with gapless playback. -version: 0.9.40 +version: 0.9.41 repository: https://github.com/ryanheise/just_audio/tree/minor/just_audio issue_tracker: https://github.com/ryanheise/just_audio/issues topics: