Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimap doesn't render if it's added to a wavesurfer that is already 'ready' #3566

Closed
jagthedrummer opened this issue Feb 26, 2024 · 0 comments · Fixed by #3617
Closed

Minimap doesn't render if it's added to a wavesurfer that is already 'ready' #3566

jagthedrummer opened this issue Feb 26, 2024 · 0 comments · Fixed by #3617
Labels

Comments

@jagthedrummer
Copy link
Collaborator

Bug description

I'm trying to create a Minimap after the main wavesurfer has already rendered. When I do that the minimap never shows up. I can see it in the DOM, but it doesn't render a waveform or anything.

Environment

  • Browser: Firefox, Chrome, Safari

Minimal code snippet

Altering the minimap example slightly will demonstrate the problem. Instead of passing the minimap in the plugins array when the wavesurfer is created, I'm trying to register is after the ready event has fired.

import WaveSurfer from 'wavesurfer.js'
import Minimap from 'wavesurfer.js/dist/plugins/minimap.esm.js'

// Create an instance of WaveSurfer
const ws = WaveSurfer.create({
  container: '#waveform',
  waveColor: 'rgb(200, 0, 200)',
  progressColor: 'rgb(100, 0, 100)',
  url: '/examples/audio/audio.wav',
  minPxPerSec: 100,
  hideScrollbar: true,
  autoCenter: false
})

ws.once('ready', () => {
  let map = Minimap.create({
      height: 20,
      waveColor: '#ddd',
      progressColor: '#999',
    })
  console.log('trying to register minimap', map);
  ws.registerPlugin(map);
})

Expected result

I'd expect the minimap to render just the same as if it had been pre-constructed.

Obtained result

A div is added to the DOM that seems intended to hold the minimap, but the map itself is never rendered.

Screenshots

Expected:

CleanShot 2024-02-26 at 12 05 47

Actual:

CleanShot 2024-02-26 at 12 05 07

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant