Skip to content

Commit

Permalink
fix stop without playing bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Fitz committed Feb 14, 2020
1 parent 4ff33c4 commit 03cd2f7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,13 @@ class _PlaybackButtonState extends State<PlaybackButtons> {

@override
void dispose() {
// TODO cleanly clean things up. Since _cleanup is async, sometimes the _playerSubscription listener calls setState after dispose but before it's canceled.
_cleanup();
super.dispose();
}

void _cleanup() async {
await _sound.stopPlayer();
if (_sound.audioState == t_AUDIO_STATE.IS_PLAYING)
await _sound.stopPlayer();
_playerSubscription.cancel();
}

Expand Down

0 comments on commit 03cd2f7

Please sign in to comment.