wavesurfer.js 4.5.0 → 5.1.0
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/CHANGES.md +36 -1
- package/README.md +6 -3
- package/dist/plugin/wavesurfer.cursor.js +39 -34
- package/dist/plugin/wavesurfer.cursor.js.map +1 -1
- package/dist/plugin/wavesurfer.cursor.min.js +2 -2
- package/dist/plugin/wavesurfer.cursor.min.js.map +1 -1
- package/dist/plugin/wavesurfer.elan.js +29 -27
- package/dist/plugin/wavesurfer.elan.js.map +1 -1
- package/dist/plugin/wavesurfer.elan.min.js +2 -2
- package/dist/plugin/wavesurfer.elan.min.js.map +1 -1
- package/dist/plugin/wavesurfer.markers.js +381 -0
- package/dist/plugin/wavesurfer.markers.js.map +1 -0
- package/dist/plugin/wavesurfer.markers.min.js +7 -0
- package/dist/plugin/wavesurfer.markers.min.js.map +1 -0
- package/dist/plugin/wavesurfer.mediasession.js +29 -27
- package/dist/plugin/wavesurfer.mediasession.js.map +1 -1
- package/dist/plugin/wavesurfer.mediasession.min.js +2 -2
- package/dist/plugin/wavesurfer.mediasession.min.js.map +1 -1
- package/dist/plugin/wavesurfer.microphone.js +29 -27
- package/dist/plugin/wavesurfer.microphone.js.map +1 -1
- package/dist/plugin/wavesurfer.microphone.min.js +2 -2
- package/dist/plugin/wavesurfer.microphone.min.js.map +1 -1
- package/dist/plugin/wavesurfer.minimap.js +30 -28
- package/dist/plugin/wavesurfer.minimap.js.map +1 -1
- package/dist/plugin/wavesurfer.minimap.min.js +2 -2
- package/dist/plugin/wavesurfer.minimap.min.js.map +1 -1
- package/dist/plugin/wavesurfer.playhead.js +324 -0
- package/dist/plugin/wavesurfer.playhead.js.map +1 -0
- package/dist/plugin/wavesurfer.playhead.min.js +7 -0
- package/dist/plugin/wavesurfer.playhead.min.js.map +1 -0
- package/dist/plugin/wavesurfer.regions.js +152 -126
- package/dist/plugin/wavesurfer.regions.js.map +1 -1
- package/dist/plugin/wavesurfer.regions.min.js +2 -2
- package/dist/plugin/wavesurfer.regions.min.js.map +1 -1
- package/dist/plugin/wavesurfer.spectrogram.js +97 -89
- package/dist/plugin/wavesurfer.spectrogram.js.map +1 -1
- package/dist/plugin/wavesurfer.spectrogram.min.js +2 -2
- package/dist/plugin/wavesurfer.spectrogram.min.js.map +1 -1
- package/dist/plugin/wavesurfer.timeline.js +46 -32
- package/dist/plugin/wavesurfer.timeline.js.map +1 -1
- package/dist/plugin/wavesurfer.timeline.min.js +2 -2
- package/dist/plugin/wavesurfer.timeline.min.js.map +1 -1
- package/dist/wavesurfer-html-init.js +9 -5
- package/dist/wavesurfer-html-init.js.map +1 -1
- package/dist/wavesurfer-html-init.min.js +2 -2
- package/dist/wavesurfer-html-init.min.js.map +1 -1
- package/dist/wavesurfer.js +350 -166
- package/dist/wavesurfer.js.map +1 -1
- package/dist/wavesurfer.min.js +2 -2
- package/dist/wavesurfer.min.js.map +1 -1
- package/package.json +19 -16
- package/src/drawer.canvasentry.js +16 -0
- package/src/drawer.js +30 -21
- package/src/drawer.multicanvas.js +63 -39
- package/src/plugin/cursor/index.js +3 -1
- package/src/plugin/markers/index.js +282 -0
- package/src/plugin/playhead/index.js +226 -0
- package/src/plugin/regions/index.js +28 -11
- package/src/plugin/regions/region.js +83 -70
- package/src/plugin/spectrogram/index.js +65 -61
- package/src/plugin/timeline/index.js +20 -11
- package/src/util/index.js +1 -0
- package/src/util/orientation.js +98 -0
- package/src/wavesurfer.js +18 -9
- package/src/webaudio.js +10 -9
package/src/wavesurfer.js
CHANGED
|
@@ -115,6 +115,7 @@ import MediaElementWebAudio from './mediaelement-webaudio';
|
|
|
115
115
|
* @property {boolean} splitChannels=false Render with separate waveforms for
|
|
116
116
|
* the channels of the audio
|
|
117
117
|
* @property {SplitChannelOptions} splitChannelsOptions={} Options for splitChannel rendering
|
|
118
|
+
* @property {boolean} vertical=false Render the waveform vertically instead of horizontally.
|
|
118
119
|
* @property {string} waveColor='#999' The fill color of the waveform after the
|
|
119
120
|
* cursor.
|
|
120
121
|
* @property {object} xhr={} XHR options. For example:
|
|
@@ -293,6 +294,7 @@ export default class WaveSurfer extends util.Observer {
|
|
|
293
294
|
filterChannels: [],
|
|
294
295
|
relativeNormalization: false
|
|
295
296
|
},
|
|
297
|
+
vertical: false,
|
|
296
298
|
waveColor: '#999',
|
|
297
299
|
xhr: {}
|
|
298
300
|
};
|
|
@@ -401,7 +403,11 @@ export default class WaveSurfer extends util.Observer {
|
|
|
401
403
|
}
|
|
402
404
|
|
|
403
405
|
if (this.params.rtl === true) {
|
|
404
|
-
|
|
406
|
+
if (this.params.vertical === true) {
|
|
407
|
+
util.style(this.container, { transform: 'rotateX(180deg)' });
|
|
408
|
+
} else {
|
|
409
|
+
util.style(this.container, { transform: 'rotateY(180deg)' });
|
|
410
|
+
}
|
|
405
411
|
}
|
|
406
412
|
|
|
407
413
|
if (this.params.backgroundColor) {
|
|
@@ -1604,7 +1610,8 @@ export default class WaveSurfer extends util.Observer {
|
|
|
1604
1610
|
}
|
|
1605
1611
|
|
|
1606
1612
|
/**
|
|
1607
|
-
* Exports PCM data into a JSON array and opens in a new window
|
|
1613
|
+
* Exports PCM data into a JSON array and optionally opens in a new window
|
|
1614
|
+
* as valid JSON Blob instance.
|
|
1608
1615
|
*
|
|
1609
1616
|
* @param {number} length=1024 The scale in which to export the peaks
|
|
1610
1617
|
* @param {number} accuracy=10000
|
|
@@ -1624,16 +1631,18 @@ export default class WaveSurfer extends util.Observer {
|
|
|
1624
1631
|
peaks,
|
|
1625
1632
|
val => Math.round(val * accuracy) / accuracy
|
|
1626
1633
|
);
|
|
1627
|
-
return new Promise((resolve, reject) => {
|
|
1628
|
-
const json = JSON.stringify(arr);
|
|
1629
1634
|
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1635
|
+
return new Promise((resolve, reject) => {
|
|
1636
|
+
if (!noWindow){
|
|
1637
|
+
const blobJSON = new Blob(
|
|
1638
|
+
[JSON.stringify(arr)],
|
|
1639
|
+
{type: 'application/json;charset=utf-8'}
|
|
1634
1640
|
);
|
|
1641
|
+
const objURL = URL.createObjectURL(blobJSON);
|
|
1642
|
+
window.open(objURL);
|
|
1643
|
+
URL.revokeObjectURL(objURL);
|
|
1635
1644
|
}
|
|
1636
|
-
resolve(
|
|
1645
|
+
resolve(arr);
|
|
1637
1646
|
});
|
|
1638
1647
|
}
|
|
1639
1648
|
|
package/src/webaudio.js
CHANGED
|
@@ -261,7 +261,7 @@ export default class WebAudio extends util.Observer {
|
|
|
261
261
|
|
|
262
262
|
/** @private */
|
|
263
263
|
removeOnAudioProcess() {
|
|
264
|
-
this.scriptNode.onaudioprocess =
|
|
264
|
+
this.scriptNode.onaudioprocess = null;
|
|
265
265
|
}
|
|
266
266
|
/** Create analyser node to perform audio analysis */
|
|
267
267
|
createAnalyserNode() {
|
|
@@ -348,19 +348,20 @@ export default class WebAudio extends util.Observer {
|
|
|
348
348
|
this.ac && this.ac.sampleRate ? this.ac.sampleRate : 44100
|
|
349
349
|
);
|
|
350
350
|
}
|
|
351
|
-
if ('
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
).catch(
|
|
355
|
-
(err) => errback(err)
|
|
356
|
-
);
|
|
357
|
-
} else {
|
|
358
|
-
// Safari: no support for Promise-based decodeAudioData yet
|
|
351
|
+
if ('webkitAudioContext' in window) {
|
|
352
|
+
// Safari: no support for Promise-based decodeAudioData enabled
|
|
353
|
+
// Enable it in Safari using the Experimental Features > Modern WebAudio API option
|
|
359
354
|
this.offlineAc.decodeAudioData(
|
|
360
355
|
arraybuffer,
|
|
361
356
|
data => callback(data),
|
|
362
357
|
errback
|
|
363
358
|
);
|
|
359
|
+
} else {
|
|
360
|
+
this.offlineAc.decodeAudioData(arraybuffer).then(
|
|
361
|
+
(data) => callback(data)
|
|
362
|
+
).catch(
|
|
363
|
+
(err) => errback(err)
|
|
364
|
+
);
|
|
364
365
|
}
|
|
365
366
|
}
|
|
366
367
|
|