wavesurfer.js 6.5.1 → 7.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +24 -0
- package/.prettierrc +8 -0
- package/README.md +26 -117
- package/dist/base-plugin.d.ts +10 -0
- package/dist/base-plugin.js +13 -0
- package/dist/decoder.d.ts +10 -0
- package/dist/decoder.js +43 -0
- package/dist/event-emitter.d.ts +11 -0
- package/dist/event-emitter.js +21 -0
- package/dist/fetcher.d.ts +4 -0
- package/dist/fetcher.js +17 -0
- package/dist/index.d.ts +92 -0
- package/dist/index.js +166 -0
- package/dist/player-webaudio.d.ts +8 -0
- package/dist/player-webaudio.js +31 -0
- package/dist/player.d.ts +16 -0
- package/dist/player.js +40 -0
- package/dist/plugins/regions.d.ts +48 -0
- package/dist/plugins/regions.js +183 -0
- package/dist/renderer.d.ts +34 -0
- package/dist/renderer.js +193 -0
- package/dist/timer.d.ts +10 -0
- package/dist/timer.js +17 -0
- package/examples/audio.ogg +0 -0
- package/examples/bars.js +19 -0
- package/examples/basic.js +8 -0
- package/examples/gradient.js +28 -0
- package/examples/regions.js +63 -0
- package/examples/video.js +19 -0
- package/examples/webaudio.js +14 -0
- package/package.json +19 -99
- package/src/base-plugin.ts +20 -0
- package/src/decoder.ts +41 -0
- package/src/event-emitter.ts +35 -0
- package/src/fetcher.ts +7 -0
- package/src/index.ts +252 -0
- package/src/player-webaudio.ts +34 -0
- package/src/player.ts +50 -0
- package/src/plugins/regions.ts +240 -0
- package/src/renderer.ts +250 -0
- package/src/timer.ts +27 -0
- package/tsconfig.json +105 -0
- package/tutorial/index.html +47 -0
- package/tutorial/src/editor.js +70 -0
- package/tutorial/src/init.js +66 -0
- package/tutorial/src/url.js +25 -0
- package/tutorial/style.css +211 -0
- package/yarn-error.log +1049 -0
- package/LICENSE +0 -29
- package/dist/plugin/wavesurfer.cursor.js +0 -418
- package/dist/plugin/wavesurfer.cursor.js.map +0 -1
- package/dist/plugin/wavesurfer.cursor.min.js +0 -7
- package/dist/plugin/wavesurfer.cursor.min.js.map +0 -1
- package/dist/plugin/wavesurfer.elan.js +0 -381
- package/dist/plugin/wavesurfer.elan.js.map +0 -1
- package/dist/plugin/wavesurfer.elan.min.js +0 -7
- package/dist/plugin/wavesurfer.elan.min.js.map +0 -1
- package/dist/plugin/wavesurfer.markers.js +0 -520
- package/dist/plugin/wavesurfer.markers.js.map +0 -1
- package/dist/plugin/wavesurfer.markers.min.js +0 -7
- package/dist/plugin/wavesurfer.markers.min.js.map +0 -1
- package/dist/plugin/wavesurfer.mediasession.js +0 -181
- package/dist/plugin/wavesurfer.mediasession.js.map +0 -1
- package/dist/plugin/wavesurfer.mediasession.min.js +0 -7
- package/dist/plugin/wavesurfer.mediasession.min.js.map +0 -1
- package/dist/plugin/wavesurfer.microphone.js +0 -466
- package/dist/plugin/wavesurfer.microphone.js.map +0 -1
- package/dist/plugin/wavesurfer.microphone.min.js +0 -7
- package/dist/plugin/wavesurfer.microphone.min.js.map +0 -1
- package/dist/plugin/wavesurfer.minimap.js +0 -440
- package/dist/plugin/wavesurfer.minimap.js.map +0 -1
- package/dist/plugin/wavesurfer.minimap.min.js +0 -7
- package/dist/plugin/wavesurfer.minimap.min.js.map +0 -1
- package/dist/plugin/wavesurfer.playhead.js +0 -300
- package/dist/plugin/wavesurfer.playhead.js.map +0 -1
- package/dist/plugin/wavesurfer.playhead.min.js +0 -7
- package/dist/plugin/wavesurfer.playhead.min.js.map +0 -1
- package/dist/plugin/wavesurfer.regions.js +0 -1335
- package/dist/plugin/wavesurfer.regions.js.map +0 -1
- package/dist/plugin/wavesurfer.regions.min.js +0 -7
- package/dist/plugin/wavesurfer.regions.min.js.map +0 -1
- package/dist/plugin/wavesurfer.spectrogram.js +0 -736
- package/dist/plugin/wavesurfer.spectrogram.js.map +0 -1
- package/dist/plugin/wavesurfer.spectrogram.min.js +0 -7
- package/dist/plugin/wavesurfer.spectrogram.min.js.map +0 -1
- package/dist/plugin/wavesurfer.timeline.js +0 -649
- package/dist/plugin/wavesurfer.timeline.js.map +0 -1
- package/dist/plugin/wavesurfer.timeline.min.js +0 -7
- package/dist/plugin/wavesurfer.timeline.min.js.map +0 -1
- package/dist/wavesurfer-html-init.js +0 -381
- package/dist/wavesurfer-html-init.js.map +0 -1
- package/dist/wavesurfer-html-init.min.js +0 -7
- package/dist/wavesurfer-html-init.min.js.map +0 -1
- package/dist/wavesurfer.js +0 -6145
- package/dist/wavesurfer.js.map +0 -1
- package/dist/wavesurfer.min.js +0 -7
- package/dist/wavesurfer.min.js.map +0 -1
- package/src/drawer.canvasentry.js +0 -427
- package/src/drawer.js +0 -413
- package/src/drawer.multicanvas.js +0 -617
- package/src/html-init.js +0 -241
- package/src/mediaelement-webaudio.js +0 -77
- package/src/mediaelement.js +0 -443
- package/src/peakcache.js +0 -127
- package/src/plugin/cursor/index.js +0 -350
- package/src/plugin/elan/index.js +0 -307
- package/src/plugin/markers/index.js +0 -436
- package/src/plugin/mediasession/index.js +0 -94
- package/src/plugin/microphone/index.js +0 -415
- package/src/plugin/minimap/index.js +0 -403
- package/src/plugin/playhead/index.js +0 -226
- package/src/plugin/regions/index.js +0 -478
- package/src/plugin/regions/region.js +0 -875
- package/src/plugin/spectrogram/fft.js +0 -222
- package/src/plugin/spectrogram/index.js +0 -522
- package/src/plugin/timeline/index.js +0 -600
- package/src/util/absMax.js +0 -16
- package/src/util/clamp.js +0 -11
- package/src/util/fetch.js +0 -222
- package/src/util/frame.js +0 -13
- package/src/util/get-id.js +0 -22
- package/src/util/index.js +0 -14
- package/src/util/max.js +0 -16
- package/src/util/min.js +0 -16
- package/src/util/observer.js +0 -144
- package/src/util/orientation.js +0 -98
- package/src/util/prevent-click.js +0 -19
- package/src/util/request-animation-frame.js +0 -15
- package/src/util/silence-mode.js +0 -42
- package/src/util/style.js +0 -16
- package/src/wavesurfer.js +0 -1797
- package/src/webaudio.js +0 -779
package/src/drawer.js
DELETED
|
@@ -1,413 +0,0 @@
|
|
|
1
|
-
import * as util from './util';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Parent class for renderers
|
|
5
|
-
*
|
|
6
|
-
* @extends {Observer}
|
|
7
|
-
*/
|
|
8
|
-
export default class Drawer extends util.Observer {
|
|
9
|
-
/**
|
|
10
|
-
* @param {HTMLElement} container The container node of the wavesurfer instance
|
|
11
|
-
* @param {WavesurferParams} params The wavesurfer initialisation options
|
|
12
|
-
*/
|
|
13
|
-
constructor(container, params) {
|
|
14
|
-
super();
|
|
15
|
-
|
|
16
|
-
this.container = util.withOrientation(container, params.vertical);
|
|
17
|
-
/**
|
|
18
|
-
* @type {WavesurferParams}
|
|
19
|
-
*/
|
|
20
|
-
this.params = params;
|
|
21
|
-
/**
|
|
22
|
-
* The width of the renderer
|
|
23
|
-
* @type {number}
|
|
24
|
-
*/
|
|
25
|
-
this.width = 0;
|
|
26
|
-
/**
|
|
27
|
-
* The height of the renderer
|
|
28
|
-
* @type {number}
|
|
29
|
-
*/
|
|
30
|
-
this.height = params.height * this.params.pixelRatio;
|
|
31
|
-
|
|
32
|
-
this.lastPos = 0;
|
|
33
|
-
/**
|
|
34
|
-
* The `<wave>` element which is added to the container
|
|
35
|
-
* @type {HTMLElement}
|
|
36
|
-
*/
|
|
37
|
-
this.wrapper = null;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Alias of `util.style`
|
|
42
|
-
*
|
|
43
|
-
* @param {HTMLElement} el The element that the styles will be applied to
|
|
44
|
-
* @param {Object} styles The map of propName: attribute, both are used as-is
|
|
45
|
-
* @return {HTMLElement} el
|
|
46
|
-
*/
|
|
47
|
-
style(el, styles) {
|
|
48
|
-
return util.style(el, styles);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Create the wrapper `<wave>` element, style it and set up the events for
|
|
53
|
-
* interaction
|
|
54
|
-
*/
|
|
55
|
-
createWrapper() {
|
|
56
|
-
this.wrapper = util.withOrientation(
|
|
57
|
-
this.container.appendChild(document.createElement('wave')),
|
|
58
|
-
this.params.vertical
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
this.style(this.wrapper, {
|
|
62
|
-
display: 'block',
|
|
63
|
-
position: 'relative',
|
|
64
|
-
userSelect: 'none',
|
|
65
|
-
webkitUserSelect: 'none',
|
|
66
|
-
height: this.params.height + 'px'
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
if (this.params.fillParent || this.params.scrollParent) {
|
|
70
|
-
this.style(this.wrapper, {
|
|
71
|
-
width: '100%',
|
|
72
|
-
cursor: this.params.hideCursor ? 'none' : 'auto',
|
|
73
|
-
overflowX: this.params.hideScrollbar ? 'hidden' : 'auto',
|
|
74
|
-
overflowY: 'hidden'
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
this.setupWrapperEvents();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Handle click event
|
|
83
|
-
*
|
|
84
|
-
* @param {Event} e Click event
|
|
85
|
-
* @param {?boolean} noPrevent Set to true to not call `e.preventDefault()`
|
|
86
|
-
* @return {number} Playback position from 0 to 1
|
|
87
|
-
*/
|
|
88
|
-
handleEvent(e, noPrevent) {
|
|
89
|
-
!noPrevent && e.preventDefault();
|
|
90
|
-
|
|
91
|
-
const clientX = util.withOrientation(
|
|
92
|
-
e.targetTouches ? e.targetTouches[0] : e,
|
|
93
|
-
this.params.vertical
|
|
94
|
-
).clientX;
|
|
95
|
-
const bbox = this.wrapper.getBoundingClientRect();
|
|
96
|
-
|
|
97
|
-
const nominalWidth = this.width;
|
|
98
|
-
const parentWidth = this.getWidth();
|
|
99
|
-
const progressPixels = this.getProgressPixels(bbox, clientX);
|
|
100
|
-
|
|
101
|
-
let progress;
|
|
102
|
-
if (!this.params.fillParent && nominalWidth < parentWidth) {
|
|
103
|
-
progress = progressPixels *
|
|
104
|
-
(this.params.pixelRatio / nominalWidth) || 0;
|
|
105
|
-
} else {
|
|
106
|
-
progress = (progressPixels + this.wrapper.scrollLeft) /
|
|
107
|
-
this.wrapper.scrollWidth || 0;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return util.clamp(progress, 0, 1);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
getProgressPixels(wrapperBbox, clientX) {
|
|
114
|
-
if (this.params.rtl) {
|
|
115
|
-
return wrapperBbox.right - clientX;
|
|
116
|
-
} else {
|
|
117
|
-
return clientX - wrapperBbox.left;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
setupWrapperEvents() {
|
|
122
|
-
this.wrapper.addEventListener('click', e => {
|
|
123
|
-
const orientedEvent = util.withOrientation(e, this.params.vertical);
|
|
124
|
-
const scrollbarHeight = this.wrapper.offsetHeight -
|
|
125
|
-
this.wrapper.clientHeight;
|
|
126
|
-
|
|
127
|
-
if (scrollbarHeight !== 0) {
|
|
128
|
-
// scrollbar is visible. Check if click was on it
|
|
129
|
-
const bbox = this.wrapper.getBoundingClientRect();
|
|
130
|
-
if (orientedEvent.clientY >= bbox.bottom - scrollbarHeight) {
|
|
131
|
-
// ignore mousedown as it was on the scrollbar
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (this.params.interact) {
|
|
137
|
-
this.fireEvent('click', e, this.handleEvent(e));
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
this.wrapper.addEventListener('dblclick', e => {
|
|
142
|
-
if (this.params.interact) {
|
|
143
|
-
this.fireEvent('dblclick', e, this.handleEvent(e));
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
this.wrapper.addEventListener('scroll', e =>
|
|
148
|
-
this.fireEvent('scroll', e)
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Draw peaks on the canvas
|
|
154
|
-
*
|
|
155
|
-
* @param {number[]|Number.<Array[]>} peaks Can also be an array of arrays
|
|
156
|
-
* for split channel rendering
|
|
157
|
-
* @param {number} length The width of the area that should be drawn
|
|
158
|
-
* @param {number} start The x-offset of the beginning of the area that
|
|
159
|
-
* should be rendered
|
|
160
|
-
* @param {number} end The x-offset of the end of the area that should be
|
|
161
|
-
* rendered
|
|
162
|
-
*/
|
|
163
|
-
drawPeaks(peaks, length, start, end) {
|
|
164
|
-
if (!this.setWidth(length)) {
|
|
165
|
-
this.clearWave();
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
this.params.barWidth
|
|
169
|
-
? this.drawBars(peaks, 0, start, end)
|
|
170
|
-
: this.drawWave(peaks, 0, start, end);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Scroll to the beginning
|
|
175
|
-
*/
|
|
176
|
-
resetScroll() {
|
|
177
|
-
if (this.wrapper !== null) {
|
|
178
|
-
this.wrapper.scrollLeft = 0;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Recenter the view-port at a certain percent of the waveform
|
|
184
|
-
*
|
|
185
|
-
* @param {number} percent Value from 0 to 1 on the waveform
|
|
186
|
-
*/
|
|
187
|
-
recenter(percent) {
|
|
188
|
-
const position = this.wrapper.scrollWidth * percent;
|
|
189
|
-
this.recenterOnPosition(position, true);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Recenter the view-port on a position, either scroll there immediately or
|
|
194
|
-
* in steps of 5 pixels
|
|
195
|
-
*
|
|
196
|
-
* @param {number} position X-offset in pixels
|
|
197
|
-
* @param {boolean} immediate Set to true to immediately scroll somewhere
|
|
198
|
-
*/
|
|
199
|
-
recenterOnPosition(position, immediate) {
|
|
200
|
-
const scrollLeft = this.wrapper.scrollLeft;
|
|
201
|
-
const half = ~~(this.wrapper.clientWidth / 2);
|
|
202
|
-
const maxScroll = this.wrapper.scrollWidth - this.wrapper.clientWidth;
|
|
203
|
-
let target = position - half;
|
|
204
|
-
let offset = target - scrollLeft;
|
|
205
|
-
|
|
206
|
-
if (maxScroll == 0) {
|
|
207
|
-
// no need to continue if scrollbar is not there
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// if the cursor is currently visible...
|
|
212
|
-
if (!immediate && -half <= offset && offset < half) {
|
|
213
|
-
// set rate at which waveform is centered
|
|
214
|
-
let rate = this.params.autoCenterRate;
|
|
215
|
-
|
|
216
|
-
// make rate depend on width of view and length of waveform
|
|
217
|
-
rate /= half;
|
|
218
|
-
rate *= maxScroll;
|
|
219
|
-
|
|
220
|
-
offset = Math.max(-rate, Math.min(rate, offset));
|
|
221
|
-
target = scrollLeft + offset;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// limit target to valid range (0 to maxScroll)
|
|
225
|
-
target = Math.max(0, Math.min(maxScroll, target));
|
|
226
|
-
// no use attempting to scroll if we're not moving
|
|
227
|
-
if (target != scrollLeft) {
|
|
228
|
-
this.wrapper.scrollLeft = target;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Get the current scroll position in pixels
|
|
234
|
-
*
|
|
235
|
-
* @return {number} Horizontal scroll position in pixels
|
|
236
|
-
*/
|
|
237
|
-
getScrollX() {
|
|
238
|
-
let x = 0;
|
|
239
|
-
if (this.wrapper) {
|
|
240
|
-
const pixelRatio = this.params.pixelRatio;
|
|
241
|
-
x = Math.round(this.wrapper.scrollLeft * pixelRatio);
|
|
242
|
-
|
|
243
|
-
// In cases of elastic scroll (safari with mouse wheel) you can
|
|
244
|
-
// scroll beyond the limits of the container
|
|
245
|
-
// Calculate and floor the scrollable extent to make sure an out
|
|
246
|
-
// of bounds value is not returned
|
|
247
|
-
// Ticket #1312
|
|
248
|
-
if (this.params.scrollParent) {
|
|
249
|
-
const maxScroll = ~~(
|
|
250
|
-
this.wrapper.scrollWidth * pixelRatio -
|
|
251
|
-
this.getWidth()
|
|
252
|
-
);
|
|
253
|
-
x = Math.min(maxScroll, Math.max(0, x));
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
return x;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Get the width of the container
|
|
261
|
-
*
|
|
262
|
-
* @return {number} The width of the container
|
|
263
|
-
*/
|
|
264
|
-
getWidth() {
|
|
265
|
-
return Math.round(this.container.clientWidth * this.params.pixelRatio);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Set the width of the container
|
|
270
|
-
*
|
|
271
|
-
* @param {number} width The new width of the container
|
|
272
|
-
* @return {boolean} Whether the width of the container was updated or not
|
|
273
|
-
*/
|
|
274
|
-
setWidth(width) {
|
|
275
|
-
if (this.width == width) {
|
|
276
|
-
return false;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
this.width = width;
|
|
280
|
-
|
|
281
|
-
if (this.params.fillParent || this.params.scrollParent) {
|
|
282
|
-
this.style(this.wrapper, {
|
|
283
|
-
width: ''
|
|
284
|
-
});
|
|
285
|
-
} else {
|
|
286
|
-
const newWidth = ~~(this.width / this.params.pixelRatio) + 'px';
|
|
287
|
-
this.style(this.wrapper, {
|
|
288
|
-
width: newWidth
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
this.updateSize();
|
|
293
|
-
return true;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Set the height of the container
|
|
298
|
-
*
|
|
299
|
-
* @param {number} height The new height of the container.
|
|
300
|
-
* @return {boolean} Whether the height of the container was updated or not
|
|
301
|
-
*/
|
|
302
|
-
setHeight(height) {
|
|
303
|
-
if (height == this.height) {
|
|
304
|
-
return false;
|
|
305
|
-
}
|
|
306
|
-
this.height = height;
|
|
307
|
-
|
|
308
|
-
this.style(this.wrapper, {
|
|
309
|
-
height: ~~(this.height / this.params.pixelRatio) + 'px'
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
this.updateSize();
|
|
313
|
-
return true;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* Called by wavesurfer when progress should be rendered
|
|
318
|
-
*
|
|
319
|
-
* @param {number} progress From 0 to 1
|
|
320
|
-
*/
|
|
321
|
-
progress(progress) {
|
|
322
|
-
const minPxDelta = 1 / this.params.pixelRatio;
|
|
323
|
-
const pos = Math.round(progress * this.width) * minPxDelta;
|
|
324
|
-
|
|
325
|
-
if (pos < this.lastPos || pos - this.lastPos >= minPxDelta) {
|
|
326
|
-
this.lastPos = pos;
|
|
327
|
-
|
|
328
|
-
if (this.params.scrollParent && this.params.autoCenter) {
|
|
329
|
-
const newPos = ~~(this.wrapper.scrollWidth * progress);
|
|
330
|
-
this.recenterOnPosition(
|
|
331
|
-
newPos,
|
|
332
|
-
this.params.autoCenterImmediately
|
|
333
|
-
);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
this.updateProgress(pos);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* This is called when wavesurfer is destroyed
|
|
342
|
-
*/
|
|
343
|
-
destroy() {
|
|
344
|
-
this.unAll();
|
|
345
|
-
if (this.wrapper) {
|
|
346
|
-
if (this.wrapper.parentNode == this.container.domElement) {
|
|
347
|
-
this.container.removeChild(this.wrapper.domElement);
|
|
348
|
-
}
|
|
349
|
-
this.wrapper = null;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
/* Renderer-specific methods */
|
|
354
|
-
|
|
355
|
-
/**
|
|
356
|
-
* Called after cursor related params have changed.
|
|
357
|
-
*
|
|
358
|
-
* @abstract
|
|
359
|
-
*/
|
|
360
|
-
updateCursor() {}
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Called when the size of the container changes so the renderer can adjust
|
|
364
|
-
*
|
|
365
|
-
* @abstract
|
|
366
|
-
*/
|
|
367
|
-
updateSize() {}
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
* Draw a waveform with bars
|
|
371
|
-
*
|
|
372
|
-
* @abstract
|
|
373
|
-
* @param {number[]|Number.<Array[]>} peaks Can also be an array of arrays for split channel
|
|
374
|
-
* rendering
|
|
375
|
-
* @param {number} channelIndex The index of the current channel. Normally
|
|
376
|
-
* should be 0
|
|
377
|
-
* @param {number} start The x-offset of the beginning of the area that
|
|
378
|
-
* should be rendered
|
|
379
|
-
* @param {number} end The x-offset of the end of the area that should be
|
|
380
|
-
* rendered
|
|
381
|
-
*/
|
|
382
|
-
drawBars(peaks, channelIndex, start, end) {}
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* Draw a waveform
|
|
386
|
-
*
|
|
387
|
-
* @abstract
|
|
388
|
-
* @param {number[]|Number.<Array[]>} peaks Can also be an array of arrays for split channel
|
|
389
|
-
* rendering
|
|
390
|
-
* @param {number} channelIndex The index of the current channel. Normally
|
|
391
|
-
* should be 0
|
|
392
|
-
* @param {number} start The x-offset of the beginning of the area that
|
|
393
|
-
* should be rendered
|
|
394
|
-
* @param {number} end The x-offset of the end of the area that should be
|
|
395
|
-
* rendered
|
|
396
|
-
*/
|
|
397
|
-
drawWave(peaks, channelIndex, start, end) {}
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* Clear the waveform
|
|
401
|
-
*
|
|
402
|
-
* @abstract
|
|
403
|
-
*/
|
|
404
|
-
clearWave() {}
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* Render the new progress
|
|
408
|
-
*
|
|
409
|
-
* @abstract
|
|
410
|
-
* @param {number} position X-Offset of progress position in pixels
|
|
411
|
-
*/
|
|
412
|
-
updateProgress(position) {}
|
|
413
|
-
}
|