Skip to content

Commit 6bbda45

Browse files
committed
fix: pause on switching tracks
Fixes #32
1 parent d2589b9 commit 6bbda45

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/services/playback/playback_service.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class PlaybackService extends ChangeNotifier {
199199
try {
200200
source.preload(ref);
201201
// wait for audio file to download and play it
202-
source.setOnPlayer(PlaybackService.player);
202+
await source.setOnPlayer(PlaybackService.player);
203203
if (setSourceOnly) {
204204
loadedAndPaused = true;
205205
} else {
@@ -368,6 +368,7 @@ class PlaybackService extends ChangeNotifier {
368368
final playing = this.playing;
369369
final nowPlayingIndex = playingIndex;
370370
if (nowPlayingIndex != index || reload) {
371+
await player.pause();
371372
playing?.dispose();
372373
this.playing = PlayingTrack(queue[index], ref);
373374
}

0 commit comments

Comments
 (0)