From c3f18791899d2acac003c984c71283bf60219c16 Mon Sep 17 00:00:00 2001 From: R Midhun Suresh Date: Mon, 11 Aug 2025 11:01:32 +0530 Subject: [PATCH] Fix audio player vm --- src/viewmodels/audio/AudioPlayerViewModel.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/viewmodels/audio/AudioPlayerViewModel.ts b/src/viewmodels/audio/AudioPlayerViewModel.ts index 208cd7e907..e028ba7860 100644 --- a/src/viewmodels/audio/AudioPlayerViewModel.ts +++ b/src/viewmodels/audio/AudioPlayerViewModel.ts @@ -77,6 +77,9 @@ export class AudioPlayerViewModel public constructor(props: Props) { super(props, AudioPlayerViewModel.computeSnapshot(props.playback, props.mediaName)); + this.disposables.trackListener(props.playback, UPDATE_EVENT, this.setSnapshot); + // There is no unsubscribe method in SimpleObservable + this.props.playback.clockInfo.liveData.onUpdate(this.setSnapshot); // Don't wait for the promise to complete - it will emit a progress update when it // is done, and it's not meant to take long anyhow. @@ -97,15 +100,6 @@ export class AudioPlayerViewModel } } - protected addDownstreamSubscription(): void { - this.props.playback.on(UPDATE_EVENT, this.setSnapshot); - // There is no unsubscribe method in SimpleObservable - this.props.playback.clockInfo.liveData.onUpdate(this.setSnapshot); - } - protected removeDownstreamSubscription(): void { - this.props.playback.off(UPDATE_EVENT, this.setSnapshot); - } - /** * Sets the snapshot and emits an update to subscribers. */