File size: 741 Bytes
57604a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c174364
57604a5
 
 
 
 
 
 
 
 
 
 
 
 
 
c174364
57604a5
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<script type="module">
import WaveSurfer from 'https://unpkg.com/wavesurfer.js@7/dist/wavesurfer.esm.js'
import RegionsPlugin from 'https://unpkg.com/wavesurfer.js@7/dist/plugins/regions.esm.js'


var labels=[];
const wavesurfer = WaveSurfer.create({
	container: '#waveform',
	barGap: 2,
	barHeight: 3,		
 	barWidth: 3,
	barRadius: 2,
});

const regions = wavesurfer.registerPlugin(RegionsPlugin.create())

wavesurfer.load('BASE64');
wavesurfer.on('ready', function () {
	wavesurfer.play(); 
});

wavesurfer.on('decode', function () {

	REGIONS

	wavesurfer.play();

});

wavesurfer.on('click', () => {
	play();
});


function play(){
	wavesurfer.isPlaying() ? wavesurfer.pause() : wavesurfer.play();
}

</script>
<div id="waveform"></div>