Replies: 1 comment
-
You can destroy the plugin every time you need to re-render it like this: const wavesurfer = WaveSurfer.create({
...
})
const createTimeline = (options) => {
return wavesurfer.registerPlugin(TimelinePlugin.create(options))
}
let timeline = createTimeline()
wavesurfer.on('zoom', (minPxPerSec) => {
timeline.destroy()
timeline = createTimeline({
timeInterval: getTimeInterval(minPxPerSec)
})
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm currently upgrading from 6 to 7 and I have a couple of questions about the Timeline plugin:
Is there a recommended approach for updating tick intervals when the user zooms? In previous versions,
timeInterval
could be a function which tookpxPerSec
, which meant it was easy to set different intervals depending on the zoom. Unless I'm missing something it looks like it must be a number now, so this is no longer possible.How do you recommended handling major changes to the timeline in response to user interactions and state changes, such as the user selecting a different unit? With Wavesurfer 6 I approached this by destroying and re-creating the timeline plugin. However, as far as I can tell there is no longer a clear API for removing & destroying a specific plugin, so I'm wondering if that's still the way to go.
Thanks for the great work!
Beta Was this translation helpful? Give feedback.
All reactions