Prevent dispose from hanging

This commit is contained in:
Ryan Heise 2020-08-08 18:42:51 +10:00
parent 858c6c01f9
commit fc9e6e0cd5
2 changed files with 3 additions and 3 deletions

View File

@ -674,6 +674,9 @@ public class AudioPlayer implements MethodCallHandler, Player.EventListener, Met
player = null;
transition(ProcessingState.none);
}
if (eventSink != null) {
eventSink.endOfStream();
}
onDispose.run();
}

View File

@ -567,14 +567,11 @@ class AudioPlayer {
_proxy?.stop();
await _durationSubject.close();
await _eventChannelStreamSubscription.cancel();
await _playbackEventSubject.close();
await _loopModeSubject.close();
await _shuffleModeEnabledSubject.close();
await _playingSubject.close();
await _volumeSubject.close();
await _speedSubject.close();
await _playerStateSubject.drain();
await _playerStateSubject.close();
if (_positionSubject != null) {
await _positionSubject.close();
}