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

Support for Markers? #20

Closed
sujitsagar opened this issue Jun 16, 2021 · 4 comments
Closed

Support for Markers? #20

sujitsagar opened this issue Jun 16, 2021 · 4 comments

Comments

@sujitsagar
Copy link

No description provided.

@ShiiRochi
Copy link
Owner

Any description about the matter or a link?

@sujitsagar
Copy link
Author

sujitsagar commented Jun 16, 2021

Sorry for not adding this earlier.

Wavesurfer now has Markers support in the waveform. Can you add wrapper to it?

https://wavesurfer-js.org/example/markers/index.html

@ShiiRochi
Copy link
Owner

ShiiRochi commented Jun 16, 2021

@sujitsagar, as far as I can see, WaveSurfer.markers part is passed into plugins field, thus, consider it as an internal plugin of WaveSurfer. Try to pass it into wavesurfer-react's plugins field like so:

const plugins = [
  {
    plugin: WaveSurfer.markers,
    options: {
      markers: [
        {
          time: 5.5,
          label: "V1",
          color: '#ff990a'
        },
        {
          time: 10,
          label: "V2",
          color: '#00ffcc',
          position: 'top'
        }
      ]
    }
  },
  // some other stuff
];

Inside WaveSurfer container this plugin will be created in the following way (this is a simplified example) plugin[0].create(plugin[0].options), i.e. it is the same as WaveSurfer.markers.create(options).

Please, reply after trying out. If it works, then this issue can be closed.

@sujitsagar
Copy link
Author

That's awesome. It worked, ShiiRochi.

Thank you so much. Closing this issue.

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

No branches or pull requests

2 participants