wavesurfer.js 4.6.0 → 5.2.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 +41 -0
- package/README.md +6 -3
- package/dist/plugin/wavesurfer.cursor.js +9 -5
- 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 +5 -4
- 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 +31 -12
- package/dist/plugin/wavesurfer.markers.js.map +1 -1
- package/dist/plugin/wavesurfer.markers.min.js +2 -2
- package/dist/plugin/wavesurfer.markers.min.js.map +1 -1
- package/dist/plugin/wavesurfer.mediasession.js +5 -4
- 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 +5 -4
- 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 +5 -4
- 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 +141 -86
- 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 +70 -63
- 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 +32 -16
- 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 +5 -4
- 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 +326 -60
- 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 +22 -8
- package/src/plugin/playhead/index.js +226 -0
- package/src/plugin/regions/index.js +28 -11
- package/src/plugin/regions/region.js +116 -75
- package/src/plugin/spectrogram/index.js +65 -61
- package/src/plugin/timeline/index.js +30 -19
- package/src/util/index.js +2 -0
- package/src/util/orientation.js +98 -0
- package/src/util/silence-mode.js +35 -0
- package/src/wavesurfer.js +41 -22
- package/src/webaudio.js +11 -2
package/dist/wavesurfer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* wavesurfer.js
|
|
2
|
+
* wavesurfer.js 5.2.0 (2021-08-16)
|
|
3
3
|
* https://wavesurfer-js.org
|
|
4
4
|
* @license BSD-3-Clause
|
|
5
5
|
*/
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
exports["WaveSurfer"] = factory();
|
|
13
13
|
else
|
|
14
14
|
root["WaveSurfer"] = factory();
|
|
15
|
-
})(
|
|
15
|
+
})(self, function() {
|
|
16
16
|
return /******/ (() => { // webpackBootstrap
|
|
17
17
|
/******/ var __webpack_modules__ = ({
|
|
18
18
|
|
|
@@ -196,6 +196,24 @@ var CanvasEntry = /*#__PURE__*/function () {
|
|
|
196
196
|
this.progressCtx.fillStyle = progressColor;
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* Set the canvas transforms for wave and progress
|
|
201
|
+
*
|
|
202
|
+
* @param {boolean} vertical Whether to render vertically
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
}, {
|
|
206
|
+
key: "applyCanvasTransforms",
|
|
207
|
+
value: function applyCanvasTransforms(vertical) {
|
|
208
|
+
if (vertical) {
|
|
209
|
+
// Reflect the waveform across the line y = -x
|
|
210
|
+
this.waveCtx.setTransform(0, 1, 1, 0, 0, 0);
|
|
211
|
+
|
|
212
|
+
if (this.hasProgressCanvas) {
|
|
213
|
+
this.progressCtx.setTransform(0, 1, 1, 0, 0, 0);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
199
217
|
/**
|
|
200
218
|
* Draw a rectangle for wave and progress
|
|
201
219
|
*
|
|
@@ -426,9 +444,9 @@ exports.default = void 0;
|
|
|
426
444
|
|
|
427
445
|
var util = _interopRequireWildcard(__webpack_require__(/*! ./util */ "./src/util/index.js"));
|
|
428
446
|
|
|
429
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var
|
|
447
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
430
448
|
|
|
431
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
449
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
432
450
|
|
|
433
451
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
434
452
|
|
|
@@ -442,7 +460,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
|
|
|
442
460
|
|
|
443
461
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
444
462
|
|
|
445
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
463
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
446
464
|
|
|
447
465
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
448
466
|
|
|
@@ -470,7 +488,7 @@ var Drawer = /*#__PURE__*/function (_util$Observer) {
|
|
|
470
488
|
_classCallCheck(this, Drawer);
|
|
471
489
|
|
|
472
490
|
_this = _super.call(this);
|
|
473
|
-
_this.container = container;
|
|
491
|
+
_this.container = util.withOrientation(container, params.vertical);
|
|
474
492
|
/**
|
|
475
493
|
* @type {WavesurferParams}
|
|
476
494
|
*/
|
|
@@ -519,7 +537,7 @@ var Drawer = /*#__PURE__*/function (_util$Observer) {
|
|
|
519
537
|
}, {
|
|
520
538
|
key: "createWrapper",
|
|
521
539
|
value: function createWrapper() {
|
|
522
|
-
this.wrapper = this.container.appendChild(document.createElement('wave'));
|
|
540
|
+
this.wrapper = util.withOrientation(this.container.appendChild(document.createElement('wave')), this.params.vertical);
|
|
523
541
|
this.style(this.wrapper, {
|
|
524
542
|
display: 'block',
|
|
525
543
|
position: 'relative',
|
|
@@ -550,33 +568,44 @@ var Drawer = /*#__PURE__*/function (_util$Observer) {
|
|
|
550
568
|
key: "handleEvent",
|
|
551
569
|
value: function handleEvent(e, noPrevent) {
|
|
552
570
|
!noPrevent && e.preventDefault();
|
|
553
|
-
var clientX = e.targetTouches ? e.targetTouches[0]
|
|
571
|
+
var clientX = util.withOrientation(e.targetTouches ? e.targetTouches[0] : e, this.params.vertical).clientX;
|
|
554
572
|
var bbox = this.wrapper.getBoundingClientRect();
|
|
555
573
|
var nominalWidth = this.width;
|
|
556
574
|
var parentWidth = this.getWidth();
|
|
575
|
+
var progressPixels = this.getProgressPixels(bbox, clientX);
|
|
557
576
|
var progress;
|
|
558
577
|
|
|
559
578
|
if (!this.params.fillParent && nominalWidth < parentWidth) {
|
|
560
|
-
progress =
|
|
579
|
+
progress = progressPixels * (this.params.pixelRatio / nominalWidth) || 0;
|
|
561
580
|
} else {
|
|
562
|
-
progress = (
|
|
581
|
+
progress = (progressPixels + this.wrapper.scrollLeft) / this.wrapper.scrollWidth || 0;
|
|
563
582
|
}
|
|
564
583
|
|
|
565
584
|
return util.clamp(progress, 0, 1);
|
|
566
585
|
}
|
|
586
|
+
}, {
|
|
587
|
+
key: "getProgressPixels",
|
|
588
|
+
value: function getProgressPixels(wrapperBbox, clientX) {
|
|
589
|
+
if (this.params.rtl) {
|
|
590
|
+
return wrapperBbox.right - clientX;
|
|
591
|
+
} else {
|
|
592
|
+
return clientX - wrapperBbox.left;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
567
595
|
}, {
|
|
568
596
|
key: "setupWrapperEvents",
|
|
569
597
|
value: function setupWrapperEvents() {
|
|
570
598
|
var _this2 = this;
|
|
571
599
|
|
|
572
600
|
this.wrapper.addEventListener('click', function (e) {
|
|
601
|
+
var orientedEvent = util.withOrientation(e, _this2.params.vertical);
|
|
573
602
|
var scrollbarHeight = _this2.wrapper.offsetHeight - _this2.wrapper.clientHeight;
|
|
574
603
|
|
|
575
604
|
if (scrollbarHeight !== 0) {
|
|
576
605
|
// scrollbar is visible. Check if click was on it
|
|
577
606
|
var bbox = _this2.wrapper.getBoundingClientRect();
|
|
578
607
|
|
|
579
|
-
if (
|
|
608
|
+
if (orientedEvent.clientY >= bbox.bottom - scrollbarHeight) {
|
|
580
609
|
// ignore mousedown as it was on the scrollbar
|
|
581
610
|
return;
|
|
582
611
|
}
|
|
@@ -738,8 +767,9 @@ var Drawer = /*#__PURE__*/function (_util$Observer) {
|
|
|
738
767
|
width: ''
|
|
739
768
|
});
|
|
740
769
|
} else {
|
|
770
|
+
var newWidth = ~~(this.width / this.params.pixelRatio) + 'px';
|
|
741
771
|
this.style(this.wrapper, {
|
|
742
|
-
width:
|
|
772
|
+
width: newWidth
|
|
743
773
|
});
|
|
744
774
|
}
|
|
745
775
|
|
|
@@ -800,8 +830,8 @@ var Drawer = /*#__PURE__*/function (_util$Observer) {
|
|
|
800
830
|
this.unAll();
|
|
801
831
|
|
|
802
832
|
if (this.wrapper) {
|
|
803
|
-
if (this.wrapper.parentNode == this.container) {
|
|
804
|
-
this.container.removeChild(this.wrapper);
|
|
833
|
+
if (this.wrapper.parentNode == this.container.domElement) {
|
|
834
|
+
this.container.removeChild(this.wrapper.domElement);
|
|
805
835
|
}
|
|
806
836
|
|
|
807
837
|
this.wrapper = null;
|
|
@@ -912,9 +942,9 @@ var util = _interopRequireWildcard(__webpack_require__(/*! ./util */ "./src/util
|
|
|
912
942
|
|
|
913
943
|
var _drawer2 = _interopRequireDefault(__webpack_require__(/*! ./drawer.canvasentry */ "./src/drawer.canvasentry.js"));
|
|
914
944
|
|
|
915
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var
|
|
945
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
916
946
|
|
|
917
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
947
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
918
948
|
|
|
919
949
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
920
950
|
|
|
@@ -930,7 +960,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
|
|
|
930
960
|
|
|
931
961
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
932
962
|
|
|
933
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
963
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
934
964
|
|
|
935
965
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
936
966
|
|
|
@@ -1024,6 +1054,13 @@ var MultiCanvas = /*#__PURE__*/function (_Drawer) {
|
|
|
1024
1054
|
*/
|
|
1025
1055
|
|
|
1026
1056
|
_this.barRadius = params.barRadius || 0;
|
|
1057
|
+
/**
|
|
1058
|
+
* Whether to render the waveform vertically. Defaults to false.
|
|
1059
|
+
*
|
|
1060
|
+
* @type {boolean}
|
|
1061
|
+
*/
|
|
1062
|
+
|
|
1063
|
+
_this.vertical = params.vertical;
|
|
1027
1064
|
return _this;
|
|
1028
1065
|
}
|
|
1029
1066
|
/**
|
|
@@ -1045,7 +1082,8 @@ var MultiCanvas = /*#__PURE__*/function (_Drawer) {
|
|
|
1045
1082
|
}, {
|
|
1046
1083
|
key: "createElements",
|
|
1047
1084
|
value: function createElements() {
|
|
1048
|
-
this.progressWave = this.wrapper.appendChild(
|
|
1085
|
+
this.progressWave = util.withOrientation(this.wrapper.appendChild(document.createElement('wave')), this.params.vertical);
|
|
1086
|
+
this.style(this.progressWave, {
|
|
1049
1087
|
position: 'absolute',
|
|
1050
1088
|
zIndex: 3,
|
|
1051
1089
|
left: 0,
|
|
@@ -1057,7 +1095,7 @@ var MultiCanvas = /*#__PURE__*/function (_Drawer) {
|
|
|
1057
1095
|
boxSizing: 'border-box',
|
|
1058
1096
|
borderRightStyle: 'solid',
|
|
1059
1097
|
pointerEvents: 'none'
|
|
1060
|
-
})
|
|
1098
|
+
});
|
|
1061
1099
|
this.addCanvas();
|
|
1062
1100
|
this.updateCursor();
|
|
1063
1101
|
}
|
|
@@ -1120,7 +1158,8 @@ var MultiCanvas = /*#__PURE__*/function (_Drawer) {
|
|
|
1120
1158
|
entry.halfPixel = this.halfPixel;
|
|
1121
1159
|
var leftOffset = this.maxCanvasElementWidth * this.canvases.length; // wave
|
|
1122
1160
|
|
|
1123
|
-
|
|
1161
|
+
var wave = util.withOrientation(this.wrapper.appendChild(document.createElement('canvas')), this.params.vertical);
|
|
1162
|
+
this.style(wave, {
|
|
1124
1163
|
position: 'absolute',
|
|
1125
1164
|
zIndex: 2,
|
|
1126
1165
|
left: leftOffset + 'px',
|
|
@@ -1128,16 +1167,19 @@ var MultiCanvas = /*#__PURE__*/function (_Drawer) {
|
|
|
1128
1167
|
bottom: 0,
|
|
1129
1168
|
height: '100%',
|
|
1130
1169
|
pointerEvents: 'none'
|
|
1131
|
-
})
|
|
1170
|
+
});
|
|
1171
|
+
entry.initWave(wave); // progress
|
|
1132
1172
|
|
|
1133
1173
|
if (this.hasProgressCanvas) {
|
|
1134
|
-
|
|
1174
|
+
var progress = util.withOrientation(this.progressWave.appendChild(document.createElement('canvas')), this.params.vertical);
|
|
1175
|
+
this.style(progress, {
|
|
1135
1176
|
position: 'absolute',
|
|
1136
1177
|
left: leftOffset + 'px',
|
|
1137
1178
|
top: 0,
|
|
1138
1179
|
bottom: 0,
|
|
1139
1180
|
height: '100%'
|
|
1140
|
-
})
|
|
1181
|
+
});
|
|
1182
|
+
entry.initProgress(progress);
|
|
1141
1183
|
}
|
|
1142
1184
|
|
|
1143
1185
|
this.canvases.push(entry);
|
|
@@ -1152,10 +1194,10 @@ var MultiCanvas = /*#__PURE__*/function (_Drawer) {
|
|
|
1152
1194
|
value: function removeCanvas() {
|
|
1153
1195
|
var lastEntry = this.canvases[this.canvases.length - 1]; // wave
|
|
1154
1196
|
|
|
1155
|
-
lastEntry.wave.parentElement.removeChild(lastEntry.wave); // progress
|
|
1197
|
+
lastEntry.wave.parentElement.removeChild(lastEntry.wave.domElement); // progress
|
|
1156
1198
|
|
|
1157
1199
|
if (this.hasProgressCanvas) {
|
|
1158
|
-
lastEntry.progress.parentElement.removeChild(lastEntry.progress);
|
|
1200
|
+
lastEntry.progress.parentElement.removeChild(lastEntry.progress.domElement);
|
|
1159
1201
|
} // cleanup
|
|
1160
1202
|
|
|
1161
1203
|
|
|
@@ -1252,7 +1294,9 @@ var MultiCanvas = /*#__PURE__*/function (_Drawer) {
|
|
|
1252
1294
|
/* in case of silences, allow the user to specify that we
|
|
1253
1295
|
* always draw *something* (normally a 1px high bar) */
|
|
1254
1296
|
|
|
1255
|
-
if (h == 0 && _this4.params.barMinHeight)
|
|
1297
|
+
if (h == 0 && _this4.params.barMinHeight) {
|
|
1298
|
+
h = _this4.params.barMinHeight;
|
|
1299
|
+
}
|
|
1256
1300
|
|
|
1257
1301
|
_this4.fillRect(i + _this4.halfPixel, halfH - h + offsetY, bar + _this4.halfPixel, h * 2, _this4.barRadius, ch);
|
|
1258
1302
|
}
|
|
@@ -1335,6 +1379,8 @@ var MultiCanvas = /*#__PURE__*/function (_Drawer) {
|
|
|
1335
1379
|
this.canvases.forEach(function (entry, i) {
|
|
1336
1380
|
_this6.setFillStyles(entry, waveColor, progressColor);
|
|
1337
1381
|
|
|
1382
|
+
_this6.applyCanvasTransforms(entry, _this6.params.vertical);
|
|
1383
|
+
|
|
1338
1384
|
entry.drawLines(peaks, absmax, halfH, offsetY, start, end);
|
|
1339
1385
|
});
|
|
1340
1386
|
}
|
|
@@ -1372,6 +1418,7 @@ var MultiCanvas = /*#__PURE__*/function (_Drawer) {
|
|
|
1372
1418
|
progressColor = _ref4.progressColor;
|
|
1373
1419
|
|
|
1374
1420
|
this.setFillStyles(entry, waveColor, progressColor);
|
|
1421
|
+
this.applyCanvasTransforms(entry, this.params.vertical);
|
|
1375
1422
|
entry.fillRects(intersection.x1 - leftOffset, intersection.y1, intersection.x2 - intersection.x1, intersection.y2 - intersection.y1, radius);
|
|
1376
1423
|
}
|
|
1377
1424
|
}
|
|
@@ -1495,6 +1542,19 @@ var MultiCanvas = /*#__PURE__*/function (_Drawer) {
|
|
|
1495
1542
|
var progressColor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.params.progressColor;
|
|
1496
1543
|
entry.setFillStyles(waveColor, progressColor);
|
|
1497
1544
|
}
|
|
1545
|
+
/**
|
|
1546
|
+
* Set the canvas transforms for a certain entry (wave and progress)
|
|
1547
|
+
*
|
|
1548
|
+
* @param {CanvasEntry} entry Target entry
|
|
1549
|
+
* @param {boolean} vertical Whether to render the waveform vertically
|
|
1550
|
+
*/
|
|
1551
|
+
|
|
1552
|
+
}, {
|
|
1553
|
+
key: "applyCanvasTransforms",
|
|
1554
|
+
value: function applyCanvasTransforms(entry) {
|
|
1555
|
+
var vertical = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1556
|
+
entry.applyCanvasTransforms(vertical);
|
|
1557
|
+
}
|
|
1498
1558
|
/**
|
|
1499
1559
|
* Return image data of the multi-canvas
|
|
1500
1560
|
*
|
|
@@ -1583,7 +1643,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
|
|
|
1583
1643
|
|
|
1584
1644
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
1585
1645
|
|
|
1586
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
1646
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
1587
1647
|
|
|
1588
1648
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
1589
1649
|
|
|
@@ -1716,9 +1776,9 @@ var _webaudio = _interopRequireDefault(__webpack_require__(/*! ./webaudio */ "./
|
|
|
1716
1776
|
|
|
1717
1777
|
var util = _interopRequireWildcard(__webpack_require__(/*! ./util */ "./src/util/index.js"));
|
|
1718
1778
|
|
|
1719
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var
|
|
1779
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
1720
1780
|
|
|
1721
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
1781
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
1722
1782
|
|
|
1723
1783
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1724
1784
|
|
|
@@ -1738,7 +1798,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
|
|
|
1738
1798
|
|
|
1739
1799
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
1740
1800
|
|
|
1741
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
1801
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
1742
1802
|
|
|
1743
1803
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
1744
1804
|
|
|
@@ -2918,6 +2978,18 @@ Object.defineProperty(exports, "clamp", ({
|
|
|
2918
2978
|
return _clamp.default;
|
|
2919
2979
|
}
|
|
2920
2980
|
}));
|
|
2981
|
+
Object.defineProperty(exports, "withOrientation", ({
|
|
2982
|
+
enumerable: true,
|
|
2983
|
+
get: function get() {
|
|
2984
|
+
return _orientation.default;
|
|
2985
|
+
}
|
|
2986
|
+
}));
|
|
2987
|
+
Object.defineProperty(exports, "ignoreSilenceMode", ({
|
|
2988
|
+
enumerable: true,
|
|
2989
|
+
get: function get() {
|
|
2990
|
+
return _silenceMode.default;
|
|
2991
|
+
}
|
|
2992
|
+
}));
|
|
2921
2993
|
|
|
2922
2994
|
var _getId = _interopRequireDefault(__webpack_require__(/*! ./get-id */ "./src/util/get-id.js"));
|
|
2923
2995
|
|
|
@@ -2943,6 +3015,10 @@ var _fetch = _interopRequireDefault(__webpack_require__(/*! ./fetch */ "./src/ut
|
|
|
2943
3015
|
|
|
2944
3016
|
var _clamp = _interopRequireDefault(__webpack_require__(/*! ./clamp */ "./src/util/clamp.js"));
|
|
2945
3017
|
|
|
3018
|
+
var _orientation = _interopRequireDefault(__webpack_require__(/*! ./orientation */ "./src/util/orientation.js"));
|
|
3019
|
+
|
|
3020
|
+
var _silenceMode = _interopRequireDefault(__webpack_require__(/*! ./silence-mode */ "./src/util/silence-mode.js"));
|
|
3021
|
+
|
|
2946
3022
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2947
3023
|
|
|
2948
3024
|
/***/ }),
|
|
@@ -3224,6 +3300,113 @@ module.exports = exports.default;
|
|
|
3224
3300
|
|
|
3225
3301
|
/***/ }),
|
|
3226
3302
|
|
|
3303
|
+
/***/ "./src/util/orientation.js":
|
|
3304
|
+
/*!*********************************!*\
|
|
3305
|
+
!*** ./src/util/orientation.js ***!
|
|
3306
|
+
\*********************************/
|
|
3307
|
+
/***/ ((module, exports) => {
|
|
3308
|
+
|
|
3309
|
+
"use strict";
|
|
3310
|
+
|
|
3311
|
+
|
|
3312
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
3313
|
+
value: true
|
|
3314
|
+
}));
|
|
3315
|
+
exports.default = withOrientation;
|
|
3316
|
+
var verticalPropMap = {
|
|
3317
|
+
width: 'height',
|
|
3318
|
+
height: 'width',
|
|
3319
|
+
overflowX: 'overflowY',
|
|
3320
|
+
overflowY: 'overflowX',
|
|
3321
|
+
clientWidth: 'clientHeight',
|
|
3322
|
+
clientHeight: 'clientWidth',
|
|
3323
|
+
clientX: 'clientY',
|
|
3324
|
+
clientY: 'clientX',
|
|
3325
|
+
scrollWidth: 'scrollHeight',
|
|
3326
|
+
scrollLeft: 'scrollTop',
|
|
3327
|
+
offsetLeft: 'offsetTop',
|
|
3328
|
+
offsetTop: 'offsetLeft',
|
|
3329
|
+
offsetHeight: 'offsetWidth',
|
|
3330
|
+
offsetWidth: 'offsetHeight',
|
|
3331
|
+
left: 'top',
|
|
3332
|
+
right: 'bottom',
|
|
3333
|
+
top: 'left',
|
|
3334
|
+
bottom: 'right',
|
|
3335
|
+
borderRightStyle: 'borderBottomStyle',
|
|
3336
|
+
borderRightWidth: 'borderBottomWidth',
|
|
3337
|
+
borderRightColor: 'borderBottomColor'
|
|
3338
|
+
};
|
|
3339
|
+
/**
|
|
3340
|
+
* Convert a horizontally-oriented property name to a vertical one.
|
|
3341
|
+
*
|
|
3342
|
+
* @param {string} prop A property name
|
|
3343
|
+
* @param {bool} vertical Whether the element is oriented vertically
|
|
3344
|
+
* @returns {string} prop, converted appropriately
|
|
3345
|
+
*/
|
|
3346
|
+
|
|
3347
|
+
function mapProp(prop, vertical) {
|
|
3348
|
+
if (Object.prototype.hasOwnProperty.call(verticalPropMap, prop)) {
|
|
3349
|
+
return vertical ? verticalPropMap[prop] : prop;
|
|
3350
|
+
} else {
|
|
3351
|
+
return prop;
|
|
3352
|
+
}
|
|
3353
|
+
}
|
|
3354
|
+
|
|
3355
|
+
var isProxy = Symbol("isProxy");
|
|
3356
|
+
/**
|
|
3357
|
+
* Returns an appropriately oriented object based on vertical.
|
|
3358
|
+
* If vertical is true, attribute getting and setting will be mapped through
|
|
3359
|
+
* verticalPropMap, so that e.g. getting the object's .width will give its
|
|
3360
|
+
* .height instead.
|
|
3361
|
+
* Certain methods of an oriented object will return oriented objects as well.
|
|
3362
|
+
* Oriented objects can't be added to the DOM directly since they are Proxy objects
|
|
3363
|
+
* and thus fail typechecks. Use domElement to get the actual element for this.
|
|
3364
|
+
*
|
|
3365
|
+
* @param {object} target The object to be wrapped and oriented
|
|
3366
|
+
* @param {bool} vertical Whether the element is oriented vertically
|
|
3367
|
+
* @returns {Proxy} An oriented object with attr translation via verticalAttrMap
|
|
3368
|
+
* @since 5.0.0
|
|
3369
|
+
*/
|
|
3370
|
+
|
|
3371
|
+
function withOrientation(target, vertical) {
|
|
3372
|
+
if (target[isProxy]) {
|
|
3373
|
+
return target;
|
|
3374
|
+
} else {
|
|
3375
|
+
return new Proxy(target, {
|
|
3376
|
+
get: function get(obj, prop, receiver) {
|
|
3377
|
+
if (prop === isProxy) {
|
|
3378
|
+
return true;
|
|
3379
|
+
} else if (prop === 'domElement') {
|
|
3380
|
+
return obj;
|
|
3381
|
+
} else if (prop === 'style') {
|
|
3382
|
+
return withOrientation(obj.style, vertical);
|
|
3383
|
+
} else if (prop === 'canvas') {
|
|
3384
|
+
return withOrientation(obj.canvas, vertical);
|
|
3385
|
+
} else if (prop === 'getBoundingClientRect') {
|
|
3386
|
+
return function () {
|
|
3387
|
+
return withOrientation(obj.getBoundingClientRect.apply(obj, arguments), vertical);
|
|
3388
|
+
};
|
|
3389
|
+
} else if (prop === 'getContext') {
|
|
3390
|
+
return function () {
|
|
3391
|
+
return withOrientation(obj.getContext.apply(obj, arguments), vertical);
|
|
3392
|
+
};
|
|
3393
|
+
} else {
|
|
3394
|
+
var value = obj[mapProp(prop, vertical)];
|
|
3395
|
+
return typeof value == 'function' ? value.bind(obj) : value;
|
|
3396
|
+
}
|
|
3397
|
+
},
|
|
3398
|
+
set: function set(obj, prop, value) {
|
|
3399
|
+
obj[mapProp(prop, vertical)] = value;
|
|
3400
|
+
return true;
|
|
3401
|
+
}
|
|
3402
|
+
});
|
|
3403
|
+
}
|
|
3404
|
+
}
|
|
3405
|
+
|
|
3406
|
+
module.exports = exports.default;
|
|
3407
|
+
|
|
3408
|
+
/***/ }),
|
|
3409
|
+
|
|
3227
3410
|
/***/ "./src/util/prevent-click.js":
|
|
3228
3411
|
/*!***********************************!*\
|
|
3229
3412
|
!*** ./src/util/prevent-click.js ***!
|
|
@@ -3294,6 +3477,56 @@ module.exports = exports.default;
|
|
|
3294
3477
|
|
|
3295
3478
|
/***/ }),
|
|
3296
3479
|
|
|
3480
|
+
/***/ "./src/util/silence-mode.js":
|
|
3481
|
+
/*!**********************************!*\
|
|
3482
|
+
!*** ./src/util/silence-mode.js ***!
|
|
3483
|
+
\**********************************/
|
|
3484
|
+
/***/ ((module, exports) => {
|
|
3485
|
+
|
|
3486
|
+
"use strict";
|
|
3487
|
+
|
|
3488
|
+
|
|
3489
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
3490
|
+
value: true
|
|
3491
|
+
}));
|
|
3492
|
+
exports.default = ignoreSilenceMode;
|
|
3493
|
+
|
|
3494
|
+
/**
|
|
3495
|
+
* Ignores device silence mode when using the `WebAudio` backend.
|
|
3496
|
+
*
|
|
3497
|
+
* Many mobile devices contain a hardware button to mute the ringtone for incoming
|
|
3498
|
+
* calls and messages. Unfortunately, on some platforms like iOS, this also mutes
|
|
3499
|
+
* wavesurfer's audio when using the `WebAudio` backend. This function creates a
|
|
3500
|
+
* temporary `<audio>` element that makes sure the WebAudio backend keeps playing
|
|
3501
|
+
* when muting the device ringer.
|
|
3502
|
+
*
|
|
3503
|
+
* @since 5.2.0
|
|
3504
|
+
*/
|
|
3505
|
+
function ignoreSilenceMode() {
|
|
3506
|
+
// Set the src to a short bit of url encoded as a silent mp3
|
|
3507
|
+
// NOTE The silence MP3 must be high quality, when web audio sounds are played
|
|
3508
|
+
// in parallel the web audio sound is mixed to match the bitrate of the html sound
|
|
3509
|
+
// 0.01 seconds of silence VBR220-260 Joint Stereo 859B
|
|
3510
|
+
var audioData = "data:audio/mpeg;base64,//uQxAAAAAAAAAAAAAAAAAAAAAAAWGluZwAAAA8AAAACAAACcQCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA//////////////////////////////////////////////////////////////////8AAABhTEFNRTMuMTAwA8MAAAAAAAAAABQgJAUHQQAB9AAAAnGMHkkIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//sQxAADgnABGiAAQBCqgCRMAAgEAH///////////////7+n/9FTuQsQH//////2NG0jWUGlio5gLQTOtIoeR2WX////X4s9Atb/JRVCbBUpeRUq//////////////////9RUi0f2jn/+xDECgPCjAEQAABN4AAANIAAAAQVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVQ=="; // disable iOS Airplay (setting the attribute in js doesn't work)
|
|
3511
|
+
|
|
3512
|
+
var tmp = document.createElement("div");
|
|
3513
|
+
tmp.innerHTML = '<audio x-webkit-airplay="deny"></audio>';
|
|
3514
|
+
var audioSilentMode = tmp.children.item(0);
|
|
3515
|
+
audioSilentMode.src = audioData;
|
|
3516
|
+
audioSilentMode.preload = "auto";
|
|
3517
|
+
audioSilentMode.type = "audio/mpeg";
|
|
3518
|
+
audioSilentMode.disableRemotePlayback = true; // play
|
|
3519
|
+
|
|
3520
|
+
audioSilentMode.play(); // cleanup
|
|
3521
|
+
|
|
3522
|
+
audioSilentMode.remove();
|
|
3523
|
+
tmp.remove();
|
|
3524
|
+
}
|
|
3525
|
+
|
|
3526
|
+
module.exports = exports.default;
|
|
3527
|
+
|
|
3528
|
+
/***/ }),
|
|
3529
|
+
|
|
3297
3530
|
/***/ "./src/util/style.js":
|
|
3298
3531
|
/*!***************************!*\
|
|
3299
3532
|
!*** ./src/util/style.js ***!
|
|
@@ -3359,9 +3592,9 @@ var _mediaelementWebaudio = _interopRequireDefault(__webpack_require__(/*! ./med
|
|
|
3359
3592
|
|
|
3360
3593
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
3361
3594
|
|
|
3362
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var
|
|
3595
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
3363
3596
|
|
|
3364
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
3597
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
3365
3598
|
|
|
3366
3599
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
3367
3600
|
|
|
@@ -3369,7 +3602,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
|
|
|
3369
3602
|
|
|
3370
3603
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
3371
3604
|
|
|
3372
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
3605
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
3373
3606
|
|
|
3374
3607
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
3375
3608
|
|
|
@@ -3453,6 +3686,8 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
3453
3686
|
* pixels.
|
|
3454
3687
|
* @property {boolean} hideScrollbar=false Whether to hide the horizontal
|
|
3455
3688
|
* scrollbar when one would normally be shown.
|
|
3689
|
+
* @property {boolean} ignoreSilenceMode=false If true, ignores device silence mode
|
|
3690
|
+
* when using the `WebAudio` backend.
|
|
3456
3691
|
* @property {boolean} interact=true Whether the mouse interaction will be
|
|
3457
3692
|
* enabled at initialization. You can switch this parameter at any time later
|
|
3458
3693
|
* on.
|
|
@@ -3499,6 +3734,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
3499
3734
|
* @property {boolean} splitChannels=false Render with separate waveforms for
|
|
3500
3735
|
* the channels of the audio
|
|
3501
3736
|
* @property {SplitChannelOptions} splitChannelsOptions={} Options for splitChannel rendering
|
|
3737
|
+
* @property {boolean} vertical=false Render the waveform vertically instead of horizontally.
|
|
3502
3738
|
* @property {string} waveColor='#999' The fill color of the waveform after the
|
|
3503
3739
|
* cursor.
|
|
3504
3740
|
* @property {object} xhr={} XHR options. For example:
|
|
@@ -3689,6 +3925,7 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
|
|
|
3689
3925
|
forceDecode: false,
|
|
3690
3926
|
height: 128,
|
|
3691
3927
|
hideScrollbar: false,
|
|
3928
|
+
ignoreSilenceMode: false,
|
|
3692
3929
|
interact: true,
|
|
3693
3930
|
loopSelection: true,
|
|
3694
3931
|
maxCanvasWidth: 4000,
|
|
@@ -3714,6 +3951,7 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
|
|
|
3714
3951
|
filterChannels: [],
|
|
3715
3952
|
relativeNormalization: false
|
|
3716
3953
|
},
|
|
3954
|
+
vertical: false,
|
|
3717
3955
|
waveColor: '#999',
|
|
3718
3956
|
xhr: {}
|
|
3719
3957
|
};
|
|
@@ -3755,9 +3993,15 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
|
|
|
3755
3993
|
}
|
|
3756
3994
|
|
|
3757
3995
|
if (_this.params.rtl === true) {
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3996
|
+
if (_this.params.vertical === true) {
|
|
3997
|
+
util.style(_this.container, {
|
|
3998
|
+
transform: 'rotateX(180deg)'
|
|
3999
|
+
});
|
|
4000
|
+
} else {
|
|
4001
|
+
util.style(_this.container, {
|
|
4002
|
+
transform: 'rotateY(180deg)'
|
|
4003
|
+
});
|
|
4004
|
+
}
|
|
3761
4005
|
}
|
|
3762
4006
|
|
|
3763
4007
|
if (_this.params.backgroundColor) {
|
|
@@ -4200,6 +4444,11 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
|
|
|
4200
4444
|
value: function play(start, end) {
|
|
4201
4445
|
var _this7 = this;
|
|
4202
4446
|
|
|
4447
|
+
if (this.params.ignoreSilenceMode) {
|
|
4448
|
+
// ignores device hardware silence mode
|
|
4449
|
+
util.ignoreSilenceMode();
|
|
4450
|
+
}
|
|
4451
|
+
|
|
4203
4452
|
this.fireEvent('interaction', function () {
|
|
4204
4453
|
return _this7.play(start, end);
|
|
4205
4454
|
});
|
|
@@ -5002,17 +5251,19 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
|
|
|
5002
5251
|
value: function decodeArrayBuffer(arraybuffer, callback) {
|
|
5003
5252
|
var _this13 = this;
|
|
5004
5253
|
|
|
5005
|
-
this.
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5254
|
+
if (!this.isDestroyed) {
|
|
5255
|
+
this.arraybuffer = arraybuffer;
|
|
5256
|
+
this.backend.decodeArrayBuffer(arraybuffer, function (data) {
|
|
5257
|
+
// Only use the decoded data if we haven't been destroyed or
|
|
5258
|
+
// another decode started in the meantime
|
|
5259
|
+
if (!_this13.isDestroyed && _this13.arraybuffer == arraybuffer) {
|
|
5260
|
+
callback(data);
|
|
5261
|
+
_this13.arraybuffer = null;
|
|
5262
|
+
}
|
|
5263
|
+
}, function () {
|
|
5264
|
+
return _this13.fireEvent('error', 'Error decoding audiobuffer');
|
|
5265
|
+
});
|
|
5266
|
+
}
|
|
5016
5267
|
}
|
|
5017
5268
|
/**
|
|
5018
5269
|
* Load an array buffer using fetch and pass the result to a callback
|
|
@@ -5070,7 +5321,8 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
|
|
|
5070
5321
|
this.fireEvent('loading', Math.round(percentComplete * 100), e.target);
|
|
5071
5322
|
}
|
|
5072
5323
|
/**
|
|
5073
|
-
* Exports PCM data into a JSON array and opens in a new window
|
|
5324
|
+
* Exports PCM data into a JSON array and optionally opens in a new window
|
|
5325
|
+
* as valid JSON Blob instance.
|
|
5074
5326
|
*
|
|
5075
5327
|
* @param {number} length=1024 The scale in which to export the peaks
|
|
5076
5328
|
* @param {number} accuracy=10000
|
|
@@ -5093,13 +5345,16 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
|
|
|
5093
5345
|
return Math.round(val * accuracy) / accuracy;
|
|
5094
5346
|
});
|
|
5095
5347
|
return new Promise(function (resolve, reject) {
|
|
5096
|
-
var json = JSON.stringify(arr);
|
|
5097
|
-
|
|
5098
5348
|
if (!noWindow) {
|
|
5099
|
-
|
|
5349
|
+
var blobJSON = new Blob([JSON.stringify(arr)], {
|
|
5350
|
+
type: 'application/json;charset=utf-8'
|
|
5351
|
+
});
|
|
5352
|
+
var objURL = URL.createObjectURL(blobJSON);
|
|
5353
|
+
window.open(objURL);
|
|
5354
|
+
URL.revokeObjectURL(objURL);
|
|
5100
5355
|
}
|
|
5101
5356
|
|
|
5102
|
-
resolve(
|
|
5357
|
+
resolve(arr);
|
|
5103
5358
|
});
|
|
5104
5359
|
}
|
|
5105
5360
|
/**
|
|
@@ -5258,7 +5513,7 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
|
|
|
5258
5513
|
}(util.Observer);
|
|
5259
5514
|
|
|
5260
5515
|
exports.default = WaveSurfer;
|
|
5261
|
-
WaveSurfer.VERSION = "
|
|
5516
|
+
WaveSurfer.VERSION = "5.2.0";
|
|
5262
5517
|
WaveSurfer.util = util;
|
|
5263
5518
|
module.exports = exports.default;
|
|
5264
5519
|
|
|
@@ -5282,9 +5537,9 @@ exports.default = void 0;
|
|
|
5282
5537
|
|
|
5283
5538
|
var util = _interopRequireWildcard(__webpack_require__(/*! ./util */ "./src/util/index.js"));
|
|
5284
5539
|
|
|
5285
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var
|
|
5540
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
5286
5541
|
|
|
5287
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
5542
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
5288
5543
|
|
|
5289
5544
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5290
5545
|
|
|
@@ -5300,7 +5555,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
|
|
|
5300
5555
|
|
|
5301
5556
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
5302
5557
|
|
|
5303
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
5558
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
5304
5559
|
|
|
5305
5560
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
5306
5561
|
|
|
@@ -5614,7 +5869,7 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
|
|
|
5614
5869
|
}, {
|
|
5615
5870
|
key: "removeOnAudioProcess",
|
|
5616
5871
|
value: function removeOnAudioProcess() {
|
|
5617
|
-
this.scriptNode.onaudioprocess =
|
|
5872
|
+
this.scriptNode.onaudioprocess = null;
|
|
5618
5873
|
}
|
|
5619
5874
|
/** Create analyser node to perform audio analysis */
|
|
5620
5875
|
|
|
@@ -6094,7 +6349,17 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
|
|
|
6094
6349
|
value: function pause() {
|
|
6095
6350
|
this.scheduledPause = null;
|
|
6096
6351
|
this.startPosition += this.getPlayedTime();
|
|
6097
|
-
|
|
6352
|
+
|
|
6353
|
+
try {
|
|
6354
|
+
this.source && this.source.stop(0);
|
|
6355
|
+
} catch (err) {// Calling stop can throw the following 2 errors:
|
|
6356
|
+
// - RangeError (The value specified for when is negative.)
|
|
6357
|
+
// - InvalidStateNode (The node has not been started by calling start().)
|
|
6358
|
+
// We can safely ignore both errors, because:
|
|
6359
|
+
// - The range is surely correct
|
|
6360
|
+
// - The node might not have been started yet, in which case we just want to carry on without causing any trouble.
|
|
6361
|
+
}
|
|
6362
|
+
|
|
6098
6363
|
this.setState(PAUSED);
|
|
6099
6364
|
this.fireEvent('pause');
|
|
6100
6365
|
}
|
|
@@ -6244,8 +6509,9 @@ module.exports = debounce;
|
|
|
6244
6509
|
/******/ // The require function
|
|
6245
6510
|
/******/ function __webpack_require__(moduleId) {
|
|
6246
6511
|
/******/ // Check if module is in cache
|
|
6247
|
-
/******/
|
|
6248
|
-
/******/
|
|
6512
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
6513
|
+
/******/ if (cachedModule !== undefined) {
|
|
6514
|
+
/******/ return cachedModule.exports;
|
|
6249
6515
|
/******/ }
|
|
6250
6516
|
/******/ // Create a new module (and put it into the cache)
|
|
6251
6517
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|