Skip to content

Commit e472fd7

Browse files
committed
Fix playback subscriber callback binding
1 parent a3df9bd commit e472fd7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/apps/stable/features/playback/utils/playbackSubscriber.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export interface PlaybackSubscriber {
3939
}
4040

4141
export abstract class PlaybackSubscriber {
42-
private player: Plugin | undefined;
42+
protected player: Plugin | undefined;
4343

4444
private readonly playbackManagerEvents = {
4545
[PlaybackManagerEvent.PlaybackCancelled]: this.onPlaybackCancelled,
@@ -87,15 +87,15 @@ export abstract class PlaybackSubscriber {
8787

8888
if (this.player) {
8989
Object.entries(this.playerEvents).forEach(([event, handler]) => {
90-
if (handler) Events.off(this.player, event, handler);
90+
if (handler) Events.off(this.player, event, handler.bind(this));
9191
});
9292
}
9393

9494
this.player = newPlayer;
9595
if (!this.player) return;
9696

9797
Object.entries(this.playerEvents).forEach(([event, handler]) => {
98-
if (handler) Events.on(this.player, event, handler);
98+
if (handler) Events.on(this.player, event, handler.bind(this));
9999
});
100100
}
101101
}

0 commit comments

Comments
 (0)