From ff952847e6a594e2a5dfc8e2c69ba66ab695e08d Mon Sep 17 00:00:00 2001 From: katspaugh Date: Wed, 8 Nov 2023 08:01:55 +0100 Subject: [PATCH] Fix: [Timeline] render on initial redraw --- src/plugins/timeline.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/plugins/timeline.ts b/src/plugins/timeline.ts index 2481db829..858671cb4 100644 --- a/src/plugins/timeline.ts +++ b/src/plugins/timeline.ts @@ -87,14 +87,10 @@ class TimelinePlugin extends BasePlugin { - this.initTimeline(this.wavesurfer?.getDuration() || 0) - }), - ) + this.subscriptions.push(this.wavesurfer.on('redraw', () => this.initTimeline())) + + if (this.wavesurfer?.getDuration() || this.options.duration) { + this.initTimeline() } } @@ -146,7 +142,8 @@ class TimelinePlugin extends BasePlugin