Skip to content

Commit c678bda

Browse files
committed
make sure animation frame is cancelled
1 parent a5a3a50 commit c678bda

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/library/core.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,6 +1232,13 @@ export class PlayerCore {
12321232

12331233
public async disconnect(): Promise<void> {
12341234

1235+
// adding another check here to cancel animation frame because:
1236+
// a player can be disconnect while song is paused or playing
1237+
// which means the cancelAnimationFrame in _stop would never get triggered
1238+
if (this._playingProgressRequestId !== null) {
1239+
cancelAnimationFrame(this._playingProgressRequestId);
1240+
}
1241+
12351242
await this._playerAudio.shutDown(this._queue);
12361243

12371244
}

0 commit comments

Comments
 (0)