Fix crash in dispose when using positionStream.

This commit is contained in:
Ryan Heise 2020-09-13 20:11:59 +10:00
parent de7da29ed6
commit c48bf4c2b0
1 changed files with 1 additions and 3 deletions

View File

@ -406,6 +406,7 @@ class AudioPlayer {
timer.cancel(); timer.cancel();
durationSubscription?.cancel(); durationSubscription?.cancel();
playbackEventSubscription?.cancel(); playbackEventSubscription?.cancel();
// This will in turn close _positionSubject.
controller.close(); controller.close();
return; return;
} }
@ -677,9 +678,6 @@ class AudioPlayer {
await _volumeSubject.close(); await _volumeSubject.close();
await _speedSubject.close(); await _speedSubject.close();
await _sequenceSubject.close(); await _sequenceSubject.close();
if (_positionSubject != null) {
await _positionSubject.close();
}
} }
Future<dynamic> _invokeMethod(String method, [dynamic args]) async => Future<dynamic> _invokeMethod(String method, [dynamic args]) async =>