Wavesurfer.js: Feature request: optional text-labels for regions

Created on 16 Jul 2016  路  4Comments  路  Source: katspaugh/wavesurfer.js

Hi,
as the title says, I would be really happy if you could implement text-labels for regions. Once implemented , one could add those labels via the region options object. The text label should be style able via CSS (to setup font-size, color etc.) and maybe have a flag if it should be displayed at the top or at the bottom of the region to reduce the risk of overlapping.

What do you think?

wavesurfer-region-names

Most helpful comment

Regions already have a custom attributes parameter which can be used to display a label.

Here's an example:

wavesurfer.addRegion({
  start: 1,
  end: 3,
  attributes: {
    label: 'Region Name1'
  }
});

In CSS:

region.wavesurfer-region:before {
    content: attr(data-region-label);
    position: absolute;
    top: 0;
}

See here as well: https://github.com/katspaugh/wavesurfer.js/blob/master/example/annotation/app.css#L1-L3

All 4 comments

Regions already have a custom attributes parameter which can be used to display a label.

Here's an example:

wavesurfer.addRegion({
  start: 1,
  end: 3,
  attributes: {
    label: 'Region Name1'
  }
});

In CSS:

region.wavesurfer-region:before {
    content: attr(data-region-label);
    position: absolute;
    top: 0;
}

See here as well: https://github.com/katspaugh/wavesurfer.js/blob/master/example/annotation/app.css#L1-L3

Ah sorry, didn't know that!
Maybe you should mention that this exists on the regions-plugin page:
http://wavesurfer-js.org/plugins/regions.html

I will, thanks!

It's awesome
workes for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  6Comments

thijstriemstra picture thijstriemstra  路  5Comments

Mamadou99 picture Mamadou99  路  3Comments

gitdisrupt picture gitdisrupt  路  6Comments

joshsmith picture joshsmith  路  3Comments