wavesurfer.js 5.0.1 → 6.0.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.
Files changed (66) hide show
  1. package/CHANGES.md +48 -1
  2. package/README.md +10 -0
  3. package/dist/plugin/wavesurfer.cursor.js +53 -51
  4. package/dist/plugin/wavesurfer.cursor.js.map +1 -1
  5. package/dist/plugin/wavesurfer.cursor.min.js +2 -2
  6. package/dist/plugin/wavesurfer.cursor.min.js.map +1 -1
  7. package/dist/plugin/wavesurfer.elan.js +10 -7
  8. package/dist/plugin/wavesurfer.elan.js.map +1 -1
  9. package/dist/plugin/wavesurfer.elan.min.js +2 -2
  10. package/dist/plugin/wavesurfer.elan.min.js.map +1 -1
  11. package/dist/plugin/wavesurfer.markers.js +151 -25
  12. package/dist/plugin/wavesurfer.markers.js.map +1 -1
  13. package/dist/plugin/wavesurfer.markers.min.js +2 -2
  14. package/dist/plugin/wavesurfer.markers.min.js.map +1 -1
  15. package/dist/plugin/wavesurfer.mediasession.js +6 -6
  16. package/dist/plugin/wavesurfer.mediasession.js.map +1 -1
  17. package/dist/plugin/wavesurfer.mediasession.min.js +2 -2
  18. package/dist/plugin/wavesurfer.mediasession.min.js.map +1 -1
  19. package/dist/plugin/wavesurfer.microphone.js +5 -5
  20. package/dist/plugin/wavesurfer.microphone.js.map +1 -1
  21. package/dist/plugin/wavesurfer.microphone.min.js +2 -2
  22. package/dist/plugin/wavesurfer.microphone.min.js.map +1 -1
  23. package/dist/plugin/wavesurfer.minimap.js +26 -23
  24. package/dist/plugin/wavesurfer.minimap.js.map +1 -1
  25. package/dist/plugin/wavesurfer.minimap.min.js +2 -2
  26. package/dist/plugin/wavesurfer.minimap.min.js.map +1 -1
  27. package/dist/plugin/wavesurfer.playhead.js +5 -5
  28. package/dist/plugin/wavesurfer.playhead.js.map +1 -1
  29. package/dist/plugin/wavesurfer.playhead.min.js +2 -2
  30. package/dist/plugin/wavesurfer.playhead.min.js.map +1 -1
  31. package/dist/plugin/wavesurfer.regions.js +92 -23
  32. package/dist/plugin/wavesurfer.regions.js.map +1 -1
  33. package/dist/plugin/wavesurfer.regions.min.js +2 -2
  34. package/dist/plugin/wavesurfer.regions.min.js.map +1 -1
  35. package/dist/plugin/wavesurfer.spectrogram.js +104 -85
  36. package/dist/plugin/wavesurfer.spectrogram.js.map +1 -1
  37. package/dist/plugin/wavesurfer.spectrogram.min.js +2 -2
  38. package/dist/plugin/wavesurfer.spectrogram.min.js.map +1 -1
  39. package/dist/plugin/wavesurfer.timeline.js +67 -57
  40. package/dist/plugin/wavesurfer.timeline.js.map +1 -1
  41. package/dist/plugin/wavesurfer.timeline.min.js +2 -2
  42. package/dist/plugin/wavesurfer.timeline.min.js.map +1 -1
  43. package/dist/wavesurfer-html-init.js +6 -6
  44. package/dist/wavesurfer-html-init.js.map +1 -1
  45. package/dist/wavesurfer-html-init.min.js +2 -2
  46. package/dist/wavesurfer-html-init.min.js.map +1 -1
  47. package/dist/wavesurfer.js +299 -133
  48. package/dist/wavesurfer.js.map +1 -1
  49. package/dist/wavesurfer.min.js +2 -2
  50. package/dist/wavesurfer.min.js.map +1 -1
  51. package/package.json +24 -24
  52. package/src/drawer.canvasentry.js +30 -6
  53. package/src/drawer.js +1 -0
  54. package/src/drawer.multicanvas.js +19 -8
  55. package/src/mediaelement.js +1 -1
  56. package/src/plugin/cursor/index.js +68 -70
  57. package/src/plugin/markers/index.js +120 -23
  58. package/src/plugin/minimap/index.js +24 -21
  59. package/src/plugin/regions/index.js +30 -3
  60. package/src/plugin/regions/region.js +47 -10
  61. package/src/plugin/spectrogram/index.js +101 -82
  62. package/src/plugin/timeline/index.js +30 -19
  63. package/src/util/index.js +1 -0
  64. package/src/util/silence-mode.js +35 -0
  65. package/src/wavesurfer.js +54 -23
  66. package/src/webaudio.js +10 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wavesurfer.js 5.0.1 (2021-05-05)
2
+ * wavesurfer.js 6.0.1 (2022-02-14)
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
- })(this, function() {
15
+ })(self, function() {
16
16
  return /******/ (() => { // webpackBootstrap
17
17
  /******/ var __webpack_modules__ = ({
18
18
 
@@ -28,7 +28,7 @@ return /******/ (() => { // webpackBootstrap
28
28
  Object.defineProperty(exports, "__esModule", ({
29
29
  value: true
30
30
  }));
31
- exports.default = void 0;
31
+ exports["default"] = void 0;
32
32
 
33
33
  var _style = _interopRequireDefault(__webpack_require__(/*! ./util/style */ "./src/util/style.js"));
34
34
 
@@ -40,7 +40,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
40
40
 
41
41
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
42
42
 
43
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
43
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
44
44
 
45
45
  /**
46
46
  * The `CanvasEntry` class represents an element consisting of a wave `canvas`
@@ -182,20 +182,47 @@ var CanvasEntry = /*#__PURE__*/function () {
182
182
  }
183
183
  /**
184
184
  * Set the fill styles for wave and progress
185
- *
186
- * @param {string} waveColor Fill color for the wave canvas
187
- * @param {?string} progressColor Fill color for the progress canvas
185
+ * @param {string|string[]} waveColor Fill color for the wave canvas,
186
+ * or an array of colors to apply as a gradient
187
+ * @param {?string|string[]} progressColor Fill color for the progress canvas,
188
+ * or an array of colors to apply as a gradient
188
189
  */
189
190
 
190
191
  }, {
191
192
  key: "setFillStyles",
192
193
  value: function setFillStyles(waveColor, progressColor) {
193
- this.waveCtx.fillStyle = waveColor;
194
+ this.waveCtx.fillStyle = this.getFillStyle(this.waveCtx, waveColor);
194
195
 
195
196
  if (this.hasProgressCanvas) {
196
- this.progressCtx.fillStyle = progressColor;
197
+ this.progressCtx.fillStyle = this.getFillStyle(this.progressCtx, progressColor);
197
198
  }
198
199
  }
200
+ /**
201
+ * Utility function to handle wave color arguments
202
+ *
203
+ * When the color argument type is a string, it will be returned as is.
204
+ * Otherwise, it will be treated as an array, and a canvas gradient will
205
+ * be returned
206
+ *
207
+ * @since 6.0.0
208
+ * @param {CanvasRenderingContext2D} ctx Rendering context of target canvas
209
+ * @param {string|string[]} color Fill color for the wave canvas, or an array of colors to apply as a gradient
210
+ * @returns {string|CanvasGradient} Returns a string fillstyle value, or a canvas gradient
211
+ */
212
+
213
+ }, {
214
+ key: "getFillStyle",
215
+ value: function getFillStyle(ctx, color) {
216
+ if (typeof color == 'string') {
217
+ return color;
218
+ }
219
+
220
+ var waveGradient = ctx.createLinearGradient(0, 0, 0, ctx.canvas.height);
221
+ color.forEach(function (value, index) {
222
+ return waveGradient.addColorStop(index / color.length, value);
223
+ });
224
+ return waveGradient;
225
+ }
199
226
  /**
200
227
  * Set the canvas transforms for wave and progress
201
228
  *
@@ -421,7 +448,7 @@ var CanvasEntry = /*#__PURE__*/function () {
421
448
  return CanvasEntry;
422
449
  }();
423
450
 
424
- exports.default = CanvasEntry;
451
+ exports["default"] = CanvasEntry;
425
452
  module.exports = exports.default;
426
453
 
427
454
  /***/ }),
@@ -435,12 +462,12 @@ module.exports = exports.default;
435
462
  "use strict";
436
463
 
437
464
 
438
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
465
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
439
466
 
440
467
  Object.defineProperty(exports, "__esModule", ({
441
468
  value: true
442
469
  }));
443
- exports.default = void 0;
470
+ exports["default"] = void 0;
444
471
 
445
472
  var util = _interopRequireWildcard(__webpack_require__(/*! ./util */ "./src/util/index.js"));
446
473
 
@@ -452,15 +479,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
452
479
 
453
480
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
454
481
 
455
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
482
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
456
483
 
457
- 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); }
484
+ 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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
458
485
 
459
486
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
460
487
 
461
488
  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); }; }
462
489
 
463
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
490
+ 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); }
464
491
 
465
492
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
466
493
 
@@ -549,6 +576,7 @@ var Drawer = /*#__PURE__*/function (_util$Observer) {
549
576
  if (this.params.fillParent || this.params.scrollParent) {
550
577
  this.style(this.wrapper, {
551
578
  width: '100%',
579
+ cursor: this.params.hideCursor ? 'none' : 'auto',
552
580
  overflowX: this.params.hideScrollbar ? 'hidden' : 'auto',
553
581
  overflowY: 'hidden'
554
582
  });
@@ -915,7 +943,7 @@ var Drawer = /*#__PURE__*/function (_util$Observer) {
915
943
  return Drawer;
916
944
  }(util.Observer);
917
945
 
918
- exports.default = Drawer;
946
+ exports["default"] = Drawer;
919
947
  module.exports = exports.default;
920
948
 
921
949
  /***/ }),
@@ -929,12 +957,12 @@ module.exports = exports.default;
929
957
  "use strict";
930
958
 
931
959
 
932
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
960
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
933
961
 
934
962
  Object.defineProperty(exports, "__esModule", ({
935
963
  value: true
936
964
  }));
937
- exports.default = void 0;
965
+ exports["default"] = void 0;
938
966
 
939
967
  var _drawer = _interopRequireDefault(__webpack_require__(/*! ./drawer */ "./src/drawer.js"));
940
968
 
@@ -952,15 +980,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
952
980
 
953
981
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
954
982
 
955
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
983
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
956
984
 
957
- 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); }
985
+ 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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
958
986
 
959
987
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
960
988
 
961
989
  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); }; }
962
990
 
963
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
991
+ 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); }
964
992
 
965
993
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
966
994
 
@@ -1286,19 +1314,35 @@ var MultiCanvas = /*#__PURE__*/function (_Drawer) {
1286
1314
  var scale = length / _this4.width;
1287
1315
  var first = start;
1288
1316
  var last = end;
1289
- var i = first;
1317
+ var peakIndex = first;
1318
+
1319
+ for (peakIndex; peakIndex < last; peakIndex += step) {
1320
+ // search for the highest peak in the range this bar falls into
1321
+ var peak = 0;
1322
+ var peakIndexRange = Math.floor(peakIndex * scale) * peakIndexScale; // start index
1323
+
1324
+ var peakIndexEnd = Math.floor((peakIndex + step) * scale) * peakIndexScale;
1325
+
1326
+ do {
1327
+ // do..while makes sure at least one peak is always evaluated
1328
+ var newPeak = Math.abs(peaks[peakIndexRange]); // for arrays starting with negative values
1329
+
1330
+ if (newPeak > peak) {
1331
+ peak = newPeak; // higher
1332
+ }
1290
1333
 
1291
- for (i; i < last; i += step) {
1292
- var peak = peaks[Math.floor(i * scale * peakIndexScale)] || 0;
1293
- var h = Math.round(peak / absmax * halfH);
1294
- /* in case of silences, allow the user to specify that we
1295
- * always draw *something* (normally a 1px high bar) */
1334
+ peakIndexRange += peakIndexScale; // skip every other value for negatives
1335
+ } while (peakIndexRange < peakIndexEnd); // calculate the height of this bar according to the highest peak found
1336
+
1337
+
1338
+ var h = Math.round(peak / absmax * halfH); // in case of silences, allow the user to specify that we
1339
+ // always draw *something* (normally a 1px high bar)
1296
1340
 
1297
1341
  if (h == 0 && _this4.params.barMinHeight) {
1298
1342
  h = _this4.params.barMinHeight;
1299
1343
  }
1300
1344
 
1301
- _this4.fillRect(i + _this4.halfPixel, halfH - h + offsetY, bar + _this4.halfPixel, h * 2, _this4.barRadius, ch);
1345
+ _this4.fillRect(peakIndex + _this4.halfPixel, halfH - h + offsetY, bar + _this4.halfPixel, h * 2, _this4.barRadius, ch);
1302
1346
  }
1303
1347
  });
1304
1348
  }
@@ -1602,7 +1646,7 @@ var MultiCanvas = /*#__PURE__*/function (_Drawer) {
1602
1646
  return MultiCanvas;
1603
1647
  }(_drawer.default);
1604
1648
 
1605
- exports.default = MultiCanvas;
1649
+ exports["default"] = MultiCanvas;
1606
1650
  module.exports = exports.default;
1607
1651
 
1608
1652
  /***/ }),
@@ -1616,12 +1660,12 @@ module.exports = exports.default;
1616
1660
  "use strict";
1617
1661
 
1618
1662
 
1619
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1663
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1620
1664
 
1621
1665
  Object.defineProperty(exports, "__esModule", ({
1622
1666
  value: true
1623
1667
  }));
1624
- exports.default = void 0;
1668
+ exports["default"] = void 0;
1625
1669
 
1626
1670
  var _mediaelement = _interopRequireDefault(__webpack_require__(/*! ./mediaelement */ "./src/mediaelement.js"));
1627
1671
 
@@ -1631,19 +1675,19 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
1631
1675
 
1632
1676
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
1633
1677
 
1634
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
1678
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
1635
1679
 
1636
- function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
1680
+ function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
1637
1681
 
1638
1682
  function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
1639
1683
 
1640
- 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); }
1684
+ 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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
1641
1685
 
1642
1686
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1643
1687
 
1644
1688
  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); }; }
1645
1689
 
1646
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
1690
+ 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); }
1647
1691
 
1648
1692
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
1649
1693
 
@@ -1751,7 +1795,7 @@ var MediaElementWebAudio = /*#__PURE__*/function (_MediaElement) {
1751
1795
  return MediaElementWebAudio;
1752
1796
  }(_mediaelement.default);
1753
1797
 
1754
- exports.default = MediaElementWebAudio;
1798
+ exports["default"] = MediaElementWebAudio;
1755
1799
  module.exports = exports.default;
1756
1800
 
1757
1801
  /***/ }),
@@ -1765,12 +1809,12 @@ module.exports = exports.default;
1765
1809
  "use strict";
1766
1810
 
1767
1811
 
1768
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1812
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1769
1813
 
1770
1814
  Object.defineProperty(exports, "__esModule", ({
1771
1815
  value: true
1772
1816
  }));
1773
- exports.default = void 0;
1817
+ exports["default"] = void 0;
1774
1818
 
1775
1819
  var _webaudio = _interopRequireDefault(__webpack_require__(/*! ./webaudio */ "./src/webaudio.js"));
1776
1820
 
@@ -1786,19 +1830,19 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
1786
1830
 
1787
1831
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
1788
1832
 
1789
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
1833
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
1790
1834
 
1791
- function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
1835
+ function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
1792
1836
 
1793
1837
  function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
1794
1838
 
1795
- 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); }
1839
+ 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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
1796
1840
 
1797
1841
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1798
1842
 
1799
1843
  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); }; }
1800
1844
 
1801
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
1845
+ 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); }
1802
1846
 
1803
1847
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
1804
1848
 
@@ -2141,7 +2185,7 @@ var MediaElement = /*#__PURE__*/function (_WebAudio) {
2141
2185
  }, {
2142
2186
  key: "seekTo",
2143
2187
  value: function seekTo(start) {
2144
- if (start != null) {
2188
+ if (start != null && !isNaN(start)) {
2145
2189
  this.media.currentTime = start;
2146
2190
  }
2147
2191
 
@@ -2329,7 +2373,7 @@ var MediaElement = /*#__PURE__*/function (_WebAudio) {
2329
2373
  return MediaElement;
2330
2374
  }(_webaudio.default);
2331
2375
 
2332
- exports.default = MediaElement;
2376
+ exports["default"] = MediaElement;
2333
2377
  module.exports = exports.default;
2334
2378
 
2335
2379
  /***/ }),
@@ -2346,13 +2390,13 @@ module.exports = exports.default;
2346
2390
  Object.defineProperty(exports, "__esModule", ({
2347
2391
  value: true
2348
2392
  }));
2349
- exports.default = void 0;
2393
+ exports["default"] = void 0;
2350
2394
 
2351
2395
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2352
2396
 
2353
2397
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
2354
2398
 
2355
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
2399
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
2356
2400
 
2357
2401
  /**
2358
2402
  * Caches the decoded peaks data to improve rendering speed for large audio
@@ -2492,7 +2536,7 @@ var PeakCache = /*#__PURE__*/function () {
2492
2536
  return PeakCache;
2493
2537
  }();
2494
2538
 
2495
- exports.default = PeakCache;
2539
+ exports["default"] = PeakCache;
2496
2540
  module.exports = exports.default;
2497
2541
 
2498
2542
  /***/ }),
@@ -2509,7 +2553,7 @@ module.exports = exports.default;
2509
2553
  Object.defineProperty(exports, "__esModule", ({
2510
2554
  value: true
2511
2555
  }));
2512
- exports.default = absMax;
2556
+ exports["default"] = absMax;
2513
2557
 
2514
2558
  var _max = _interopRequireDefault(__webpack_require__(/*! ./max */ "./src/util/max.js"));
2515
2559
 
@@ -2547,7 +2591,7 @@ module.exports = exports.default;
2547
2591
  Object.defineProperty(exports, "__esModule", ({
2548
2592
  value: true
2549
2593
  }));
2550
- exports.default = clamp;
2594
+ exports["default"] = clamp;
2551
2595
 
2552
2596
  /**
2553
2597
  * Returns a number limited to the given range.
@@ -2577,7 +2621,7 @@ module.exports = exports.default;
2577
2621
  Object.defineProperty(exports, "__esModule", ({
2578
2622
  value: true
2579
2623
  }));
2580
- exports.default = fetchFile;
2624
+ exports["default"] = fetchFile;
2581
2625
 
2582
2626
  var _observer = _interopRequireDefault(__webpack_require__(/*! ./observer */ "./src/util/observer.js"));
2583
2627
 
@@ -2587,7 +2631,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
2587
2631
 
2588
2632
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
2589
2633
 
2590
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
2634
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
2591
2635
 
2592
2636
  var ProgressHandler = /*#__PURE__*/function () {
2593
2637
  /**
@@ -2827,7 +2871,7 @@ module.exports = exports.default;
2827
2871
  Object.defineProperty(exports, "__esModule", ({
2828
2872
  value: true
2829
2873
  }));
2830
- exports.default = frame;
2874
+ exports["default"] = frame;
2831
2875
 
2832
2876
  var _requestAnimationFrame = _interopRequireDefault(__webpack_require__(/*! ./request-animation-frame */ "./src/util/request-animation-frame.js"));
2833
2877
 
@@ -2869,7 +2913,7 @@ module.exports = exports.default;
2869
2913
  Object.defineProperty(exports, "__esModule", ({
2870
2914
  value: true
2871
2915
  }));
2872
- exports.default = getId;
2916
+ exports["default"] = getId;
2873
2917
 
2874
2918
  /**
2875
2919
  * Get a random prefixed ID
@@ -2906,58 +2950,64 @@ module.exports = exports.default;
2906
2950
  Object.defineProperty(exports, "__esModule", ({
2907
2951
  value: true
2908
2952
  }));
2909
- Object.defineProperty(exports, "getId", ({
2953
+ Object.defineProperty(exports, "Observer", ({
2910
2954
  enumerable: true,
2911
2955
  get: function get() {
2912
- return _getId.default;
2956
+ return _observer.default;
2913
2957
  }
2914
2958
  }));
2915
- Object.defineProperty(exports, "max", ({
2959
+ Object.defineProperty(exports, "absMax", ({
2916
2960
  enumerable: true,
2917
2961
  get: function get() {
2918
- return _max.default;
2962
+ return _absMax.default;
2919
2963
  }
2920
2964
  }));
2921
- Object.defineProperty(exports, "min", ({
2965
+ Object.defineProperty(exports, "clamp", ({
2922
2966
  enumerable: true,
2923
2967
  get: function get() {
2924
- return _min.default;
2968
+ return _clamp.default;
2925
2969
  }
2926
2970
  }));
2927
- Object.defineProperty(exports, "absMax", ({
2971
+ Object.defineProperty(exports, "debounce", ({
2928
2972
  enumerable: true,
2929
2973
  get: function get() {
2930
- return _absMax.default;
2974
+ return _debounce.default;
2931
2975
  }
2932
2976
  }));
2933
- Object.defineProperty(exports, "Observer", ({
2977
+ Object.defineProperty(exports, "fetchFile", ({
2934
2978
  enumerable: true,
2935
2979
  get: function get() {
2936
- return _observer.default;
2980
+ return _fetch.default;
2937
2981
  }
2938
2982
  }));
2939
- Object.defineProperty(exports, "style", ({
2983
+ Object.defineProperty(exports, "frame", ({
2940
2984
  enumerable: true,
2941
2985
  get: function get() {
2942
- return _style.default;
2986
+ return _frame.default;
2943
2987
  }
2944
2988
  }));
2945
- Object.defineProperty(exports, "requestAnimationFrame", ({
2989
+ Object.defineProperty(exports, "getId", ({
2946
2990
  enumerable: true,
2947
2991
  get: function get() {
2948
- return _requestAnimationFrame.default;
2992
+ return _getId.default;
2949
2993
  }
2950
2994
  }));
2951
- Object.defineProperty(exports, "frame", ({
2995
+ Object.defineProperty(exports, "ignoreSilenceMode", ({
2952
2996
  enumerable: true,
2953
2997
  get: function get() {
2954
- return _frame.default;
2998
+ return _silenceMode.default;
2955
2999
  }
2956
3000
  }));
2957
- Object.defineProperty(exports, "debounce", ({
3001
+ Object.defineProperty(exports, "max", ({
2958
3002
  enumerable: true,
2959
3003
  get: function get() {
2960
- return _debounce.default;
3004
+ return _max.default;
3005
+ }
3006
+ }));
3007
+ Object.defineProperty(exports, "min", ({
3008
+ enumerable: true,
3009
+ get: function get() {
3010
+ return _min.default;
2961
3011
  }
2962
3012
  }));
2963
3013
  Object.defineProperty(exports, "preventClick", ({
@@ -2966,16 +3016,16 @@ Object.defineProperty(exports, "preventClick", ({
2966
3016
  return _preventClick.default;
2967
3017
  }
2968
3018
  }));
2969
- Object.defineProperty(exports, "fetchFile", ({
3019
+ Object.defineProperty(exports, "requestAnimationFrame", ({
2970
3020
  enumerable: true,
2971
3021
  get: function get() {
2972
- return _fetch.default;
3022
+ return _requestAnimationFrame.default;
2973
3023
  }
2974
3024
  }));
2975
- Object.defineProperty(exports, "clamp", ({
3025
+ Object.defineProperty(exports, "style", ({
2976
3026
  enumerable: true,
2977
3027
  get: function get() {
2978
- return _clamp.default;
3028
+ return _style.default;
2979
3029
  }
2980
3030
  }));
2981
3031
  Object.defineProperty(exports, "withOrientation", ({
@@ -3011,6 +3061,8 @@ var _clamp = _interopRequireDefault(__webpack_require__(/*! ./clamp */ "./src/ut
3011
3061
 
3012
3062
  var _orientation = _interopRequireDefault(__webpack_require__(/*! ./orientation */ "./src/util/orientation.js"));
3013
3063
 
3064
+ var _silenceMode = _interopRequireDefault(__webpack_require__(/*! ./silence-mode */ "./src/util/silence-mode.js"));
3065
+
3014
3066
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3015
3067
 
3016
3068
  /***/ }),
@@ -3027,7 +3079,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
3027
3079
  Object.defineProperty(exports, "__esModule", ({
3028
3080
  value: true
3029
3081
  }));
3030
- exports.default = max;
3082
+ exports["default"] = max;
3031
3083
 
3032
3084
  /**
3033
3085
  * Get the largest value
@@ -3062,7 +3114,7 @@ module.exports = exports.default;
3062
3114
  Object.defineProperty(exports, "__esModule", ({
3063
3115
  value: true
3064
3116
  }));
3065
- exports.default = min;
3117
+ exports["default"] = min;
3066
3118
 
3067
3119
  /**
3068
3120
  * Get the smallest value
@@ -3097,13 +3149,13 @@ module.exports = exports.default;
3097
3149
  Object.defineProperty(exports, "__esModule", ({
3098
3150
  value: true
3099
3151
  }));
3100
- exports.default = void 0;
3152
+ exports["default"] = void 0;
3101
3153
 
3102
3154
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3103
3155
 
3104
3156
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
3105
3157
 
3106
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
3158
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
3107
3159
 
3108
3160
  /**
3109
3161
  * @typedef {Object} ListenerDescriptor
@@ -3287,7 +3339,7 @@ var Observer = /*#__PURE__*/function () {
3287
3339
  return Observer;
3288
3340
  }();
3289
3341
 
3290
- exports.default = Observer;
3342
+ exports["default"] = Observer;
3291
3343
  module.exports = exports.default;
3292
3344
 
3293
3345
  /***/ }),
@@ -3304,7 +3356,7 @@ module.exports = exports.default;
3304
3356
  Object.defineProperty(exports, "__esModule", ({
3305
3357
  value: true
3306
3358
  }));
3307
- exports.default = withOrientation;
3359
+ exports["default"] = withOrientation;
3308
3360
  var verticalPropMap = {
3309
3361
  width: 'height',
3310
3362
  height: 'width',
@@ -3411,7 +3463,7 @@ module.exports = exports.default;
3411
3463
  Object.defineProperty(exports, "__esModule", ({
3412
3464
  value: true
3413
3465
  }));
3414
- exports.default = preventClick;
3466
+ exports["default"] = preventClick;
3415
3467
 
3416
3468
  /**
3417
3469
  * Stops propagation of click event and removes event listener
@@ -3450,7 +3502,7 @@ module.exports = exports.default;
3450
3502
  Object.defineProperty(exports, "__esModule", ({
3451
3503
  value: true
3452
3504
  }));
3453
- exports.default = void 0;
3505
+ exports["default"] = void 0;
3454
3506
 
3455
3507
  /* eslint-disable valid-jsdoc */
3456
3508
 
@@ -3464,7 +3516,57 @@ var _default = (window.requestAnimationFrame || window.webkitRequestAnimationFra
3464
3516
  return setTimeout(callback, 1000 / 60);
3465
3517
  }).bind(window);
3466
3518
 
3467
- exports.default = _default;
3519
+ exports["default"] = _default;
3520
+ module.exports = exports.default;
3521
+
3522
+ /***/ }),
3523
+
3524
+ /***/ "./src/util/silence-mode.js":
3525
+ /*!**********************************!*\
3526
+ !*** ./src/util/silence-mode.js ***!
3527
+ \**********************************/
3528
+ /***/ ((module, exports) => {
3529
+
3530
+ "use strict";
3531
+
3532
+
3533
+ Object.defineProperty(exports, "__esModule", ({
3534
+ value: true
3535
+ }));
3536
+ exports["default"] = ignoreSilenceMode;
3537
+
3538
+ /**
3539
+ * Ignores device silence mode when using the `WebAudio` backend.
3540
+ *
3541
+ * Many mobile devices contain a hardware button to mute the ringtone for incoming
3542
+ * calls and messages. Unfortunately, on some platforms like iOS, this also mutes
3543
+ * wavesurfer's audio when using the `WebAudio` backend. This function creates a
3544
+ * temporary `<audio>` element that makes sure the WebAudio backend keeps playing
3545
+ * when muting the device ringer.
3546
+ *
3547
+ * @since 5.2.0
3548
+ */
3549
+ function ignoreSilenceMode() {
3550
+ // Set the src to a short bit of url encoded as a silent mp3
3551
+ // NOTE The silence MP3 must be high quality, when web audio sounds are played
3552
+ // in parallel the web audio sound is mixed to match the bitrate of the html sound
3553
+ // 0.01 seconds of silence VBR220-260 Joint Stereo 859B
3554
+ 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)
3555
+
3556
+ var tmp = document.createElement("div");
3557
+ tmp.innerHTML = '<audio x-webkit-airplay="deny"></audio>';
3558
+ var audioSilentMode = tmp.children.item(0);
3559
+ audioSilentMode.src = audioData;
3560
+ audioSilentMode.preload = "auto";
3561
+ audioSilentMode.type = "audio/mpeg";
3562
+ audioSilentMode.disableRemotePlayback = true; // play
3563
+
3564
+ audioSilentMode.play(); // cleanup
3565
+
3566
+ audioSilentMode.remove();
3567
+ tmp.remove();
3568
+ }
3569
+
3468
3570
  module.exports = exports.default;
3469
3571
 
3470
3572
  /***/ }),
@@ -3481,7 +3583,7 @@ module.exports = exports.default;
3481
3583
  Object.defineProperty(exports, "__esModule", ({
3482
3584
  value: true
3483
3585
  }));
3484
- exports.default = style;
3586
+ exports["default"] = style;
3485
3587
 
3486
3588
  /**
3487
3589
  * Apply a map of styles to an element
@@ -3513,12 +3615,12 @@ module.exports = exports.default;
3513
3615
  "use strict";
3514
3616
 
3515
3617
 
3516
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3618
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3517
3619
 
3518
3620
  Object.defineProperty(exports, "__esModule", ({
3519
3621
  value: true
3520
3622
  }));
3521
- exports.default = void 0;
3623
+ exports["default"] = void 0;
3522
3624
 
3523
3625
  var util = _interopRequireWildcard(__webpack_require__(/*! ./util */ "./src/util/index.js"));
3524
3626
 
@@ -3538,13 +3640,13 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
3538
3640
 
3539
3641
  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; }
3540
3642
 
3541
- 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); }
3643
+ 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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
3542
3644
 
3543
3645
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
3544
3646
 
3545
3647
  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); }; }
3546
3648
 
3547
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
3649
+ 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); }
3548
3650
 
3549
3651
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
3550
3652
 
@@ -3552,11 +3654,13 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
3552
3654
 
3553
3655
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
3554
3656
 
3657
+ 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; }
3658
+
3555
3659
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3556
3660
 
3557
3661
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
3558
3662
 
3559
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
3663
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
3560
3664
 
3561
3665
  /*
3562
3666
  * This work is licensed under a BSD-3-Clause License.
@@ -3628,6 +3732,10 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
3628
3732
  * pixels.
3629
3733
  * @property {boolean} hideScrollbar=false Whether to hide the horizontal
3630
3734
  * scrollbar when one would normally be shown.
3735
+ * @property {boolean} hideCursor=false Whether to hide the mouse cursor
3736
+ * when one would normally be shown by default.
3737
+ * @property {boolean} ignoreSilenceMode=false If true, ignores device silence mode
3738
+ * when using the `WebAudio` backend.
3631
3739
  * @property {boolean} interact=true Whether the mouse interaction will be
3632
3740
  * enabled at initialization. You can switch this parameter at any time later
3633
3741
  * on.
@@ -3837,7 +3945,7 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
3837
3945
  * @private
3838
3946
  */
3839
3947
 
3840
- _this.defaultParams = {
3948
+ _defineProperty(_assertThisInitialized(_this), "defaultParams", {
3841
3949
  audioContext: null,
3842
3950
  audioScriptProcessor: null,
3843
3951
  audioRate: 1,
@@ -3865,6 +3973,8 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
3865
3973
  forceDecode: false,
3866
3974
  height: 128,
3867
3975
  hideScrollbar: false,
3976
+ hideCursor: false,
3977
+ ignoreSilenceMode: false,
3868
3978
  interact: true,
3869
3979
  loopSelection: true,
3870
3980
  maxCanvasWidth: 4000,
@@ -3893,13 +4003,16 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
3893
4003
  vertical: false,
3894
4004
  waveColor: '#999',
3895
4005
  xhr: {}
3896
- };
3897
- _this.backends = {
4006
+ });
4007
+
4008
+ _defineProperty(_assertThisInitialized(_this), "backends", {
3898
4009
  MediaElement: _mediaelement.default,
3899
4010
  WebAudio: _webaudio.default,
3900
4011
  MediaElementWebAudio: _mediaelementWebaudio.default
3901
- };
3902
- _this.util = util;
4012
+ });
4013
+
4014
+ _defineProperty(_assertThisInitialized(_this), "util", util);
4015
+
3903
4016
  _this.params = Object.assign({}, _this.defaultParams, params);
3904
4017
  _this.params.splitChannelsOptions = Object.assign({}, _this.defaultParams.splitChannelsOptions, params.splitChannelsOptions);
3905
4018
  /** @private */
@@ -4383,6 +4496,11 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
4383
4496
  value: function play(start, end) {
4384
4497
  var _this7 = this;
4385
4498
 
4499
+ if (this.params.ignoreSilenceMode) {
4500
+ // ignores device hardware silence mode
4501
+ util.ignoreSilenceMode();
4502
+ }
4503
+
4386
4504
  this.fireEvent('interaction', function () {
4387
4505
  return _this7.play(start, end);
4388
4506
  });
@@ -4728,49 +4846,77 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
4728
4846
  /**
4729
4847
  * Get the fill color of the waveform after the cursor.
4730
4848
  *
4731
- * @return {string} A CSS color string.
4849
+ * @param {?number} channelIdx Optional index of the channel to get its wave color if splitChannels is true
4850
+ * @return {string|object} A CSS color string, or an array of CSS color strings.
4732
4851
  */
4733
4852
 
4734
4853
  }, {
4735
4854
  key: "getWaveColor",
4736
4855
  value: function getWaveColor() {
4856
+ var channelIdx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
4857
+
4858
+ if (this.params.splitChannelsOptions.channelColors[channelIdx]) {
4859
+ return this.params.splitChannelsOptions.channelColors[channelIdx].waveColor;
4860
+ }
4861
+
4737
4862
  return this.params.waveColor;
4738
4863
  }
4739
4864
  /**
4740
4865
  * Set the fill color of the waveform after the cursor.
4741
4866
  *
4742
- * @param {string} color A CSS color string.
4867
+ * @param {string|object} color A CSS color string, or an array of CSS color strings.
4868
+ * @param {?number} channelIdx Optional index of the channel to set its wave color if splitChannels is true
4743
4869
  * @example wavesurfer.setWaveColor('#ddd');
4744
4870
  */
4745
4871
 
4746
4872
  }, {
4747
4873
  key: "setWaveColor",
4748
4874
  value: function setWaveColor(color) {
4749
- this.params.waveColor = color;
4875
+ var channelIdx = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
4876
+
4877
+ if (this.params.splitChannelsOptions.channelColors[channelIdx]) {
4878
+ this.params.splitChannelsOptions.channelColors[channelIdx].waveColor = color;
4879
+ } else {
4880
+ this.params.waveColor = color;
4881
+ }
4882
+
4750
4883
  this.drawBuffer();
4751
4884
  }
4752
4885
  /**
4753
4886
  * Get the fill color of the waveform behind the cursor.
4754
4887
  *
4755
- * @return {string} A CSS color string.
4888
+ * @param {?number} channelIdx Optional index of the channel to get its progress color if splitChannels is true
4889
+ * @return {string|object} A CSS color string, or an array of CSS color strings.
4756
4890
  */
4757
4891
 
4758
4892
  }, {
4759
4893
  key: "getProgressColor",
4760
4894
  value: function getProgressColor() {
4895
+ var channelIdx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
4896
+
4897
+ if (this.params.splitChannelsOptions.channelColors[channelIdx]) {
4898
+ return this.params.splitChannelsOptions.channelColors[channelIdx].progressColor;
4899
+ }
4900
+
4761
4901
  return this.params.progressColor;
4762
4902
  }
4763
4903
  /**
4764
4904
  * Set the fill color of the waveform behind the cursor.
4765
4905
  *
4766
- * @param {string} color A CSS color string.
4906
+ * @param {string|object} color A CSS color string, or an array of CSS color strings.
4907
+ * @param {?number} channelIdx Optional index of the channel to set its progress color if splitChannels is true
4767
4908
  * @example wavesurfer.setProgressColor('#400');
4768
4909
  */
4769
4910
 
4770
4911
  }, {
4771
4912
  key: "setProgressColor",
4772
- value: function setProgressColor(color) {
4773
- this.params.progressColor = color;
4913
+ value: function setProgressColor(color, channelIdx) {
4914
+ if (this.params.splitChannelsOptions.channelColors[channelIdx]) {
4915
+ this.params.splitChannelsOptions.channelColors[channelIdx].progressColor = color;
4916
+ } else {
4917
+ this.params.progressColor = color;
4918
+ }
4919
+
4774
4920
  this.drawBuffer();
4775
4921
  }
4776
4922
  /**
@@ -5185,17 +5331,19 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
5185
5331
  value: function decodeArrayBuffer(arraybuffer, callback) {
5186
5332
  var _this13 = this;
5187
5333
 
5188
- this.arraybuffer = arraybuffer;
5189
- this.backend.decodeArrayBuffer(arraybuffer, function (data) {
5190
- // Only use the decoded data if we haven't been destroyed or
5191
- // another decode started in the meantime
5192
- if (!_this13.isDestroyed && _this13.arraybuffer == arraybuffer) {
5193
- callback(data);
5194
- _this13.arraybuffer = null;
5195
- }
5196
- }, function () {
5197
- return _this13.fireEvent('error', 'Error decoding audiobuffer');
5198
- });
5334
+ if (!this.isDestroyed) {
5335
+ this.arraybuffer = arraybuffer;
5336
+ this.backend.decodeArrayBuffer(arraybuffer, function (data) {
5337
+ // Only use the decoded data if we haven't been destroyed or
5338
+ // another decode started in the meantime
5339
+ if (!_this13.isDestroyed && _this13.arraybuffer == arraybuffer) {
5340
+ callback(data);
5341
+ _this13.arraybuffer = null;
5342
+ }
5343
+ }, function () {
5344
+ return _this13.fireEvent('error', 'Error decoding audiobuffer');
5345
+ });
5346
+ }
5199
5347
  }
5200
5348
  /**
5201
5349
  * Load an array buffer using fetch and pass the result to a callback
@@ -5444,9 +5592,12 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
5444
5592
  return WaveSurfer;
5445
5593
  }(util.Observer);
5446
5594
 
5447
- exports.default = WaveSurfer;
5448
- WaveSurfer.VERSION = "5.0.1";
5449
- WaveSurfer.util = util;
5595
+ exports["default"] = WaveSurfer;
5596
+
5597
+ _defineProperty(WaveSurfer, "VERSION", "6.0.1");
5598
+
5599
+ _defineProperty(WaveSurfer, "util", util);
5600
+
5450
5601
  module.exports = exports.default;
5451
5602
 
5452
5603
  /***/ }),
@@ -5460,12 +5611,12 @@ module.exports = exports.default;
5460
5611
  "use strict";
5461
5612
 
5462
5613
 
5463
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
5614
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
5464
5615
 
5465
5616
  Object.defineProperty(exports, "__esModule", ({
5466
5617
  value: true
5467
5618
  }));
5468
- exports.default = void 0;
5619
+ exports["default"] = void 0;
5469
5620
 
5470
5621
  var util = _interopRequireWildcard(__webpack_require__(/*! ./util */ "./src/util/index.js"));
5471
5622
 
@@ -5473,21 +5624,19 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
5473
5624
 
5474
5625
  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; }
5475
5626
 
5476
- 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; }
5477
-
5478
5627
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5479
5628
 
5480
5629
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
5481
5630
 
5482
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
5631
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5483
5632
 
5484
- 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); }
5633
+ 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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
5485
5634
 
5486
5635
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
5487
5636
 
5488
5637
  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); }; }
5489
5638
 
5490
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
5639
+ 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); }
5491
5640
 
5492
5641
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
5493
5642
 
@@ -5495,6 +5644,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
5495
5644
 
5496
5645
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
5497
5646
 
5647
+ 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; }
5648
+
5498
5649
  // using constants to prevent someone writing the string wrong
5499
5650
  var PLAYING = 'playing';
5500
5651
  var PAUSED = 'paused';
@@ -5516,7 +5667,7 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5516
5667
  * @param {WavesurferParams} params Wavesurfer parameters
5517
5668
  */
5518
5669
  function WebAudio(params) {
5519
- var _this$stateBehaviors, _this$states;
5670
+ var _defineProperty2, _this$states;
5520
5671
 
5521
5672
  var _this;
5522
5673
 
@@ -5525,9 +5676,11 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5525
5676
  _this = _super.call(this);
5526
5677
  /** @private */
5527
5678
 
5528
- _this.audioContext = null;
5529
- _this.offlineAudioContext = null;
5530
- _this.stateBehaviors = (_this$stateBehaviors = {}, _defineProperty(_this$stateBehaviors, PLAYING, {
5679
+ _defineProperty(_assertThisInitialized(_this), "audioContext", null);
5680
+
5681
+ _defineProperty(_assertThisInitialized(_this), "offlineAudioContext", null);
5682
+
5683
+ _defineProperty(_assertThisInitialized(_this), "stateBehaviors", (_defineProperty2 = {}, _defineProperty(_defineProperty2, PLAYING, {
5531
5684
  init: function init() {
5532
5685
  this.addOnAudioProcess();
5533
5686
  },
@@ -5538,7 +5691,7 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5538
5691
  getCurrentTime: function getCurrentTime() {
5539
5692
  return this.startPosition + this.getPlayedTime();
5540
5693
  }
5541
- }), _defineProperty(_this$stateBehaviors, PAUSED, {
5694
+ }), _defineProperty(_defineProperty2, PAUSED, {
5542
5695
  init: function init() {
5543
5696
  this.removeOnAudioProcess();
5544
5697
  },
@@ -5549,7 +5702,7 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5549
5702
  getCurrentTime: function getCurrentTime() {
5550
5703
  return this.startPosition;
5551
5704
  }
5552
- }), _defineProperty(_this$stateBehaviors, FINISHED, {
5705
+ }), _defineProperty(_defineProperty2, FINISHED, {
5553
5706
  init: function init() {
5554
5707
  this.removeOnAudioProcess();
5555
5708
  this.fireEvent('finish');
@@ -5560,7 +5713,8 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5560
5713
  getCurrentTime: function getCurrentTime() {
5561
5714
  return this.getDuration();
5562
5715
  }
5563
- }), _this$stateBehaviors);
5716
+ }), _defineProperty2));
5717
+
5564
5718
  _this.params = params;
5565
5719
  /** ac: Audio Context instance */
5566
5720
 
@@ -6281,7 +6435,17 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
6281
6435
  value: function pause() {
6282
6436
  this.scheduledPause = null;
6283
6437
  this.startPosition += this.getPlayedTime();
6284
- this.source && this.source.stop(0);
6438
+
6439
+ try {
6440
+ this.source && this.source.stop(0);
6441
+ } catch (err) {// Calling stop can throw the following 2 errors:
6442
+ // - RangeError (The value specified for when is negative.)
6443
+ // - InvalidStateNode (The node has not been started by calling start().)
6444
+ // We can safely ignore both errors, because:
6445
+ // - The range is surely correct
6446
+ // - The node might not have been started yet, in which case we just want to carry on without causing any trouble.
6447
+ }
6448
+
6285
6449
  this.setState(PAUSED);
6286
6450
  this.fireEvent('pause');
6287
6451
  }
@@ -6337,8 +6501,10 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
6337
6501
  return WebAudio;
6338
6502
  }(util.Observer);
6339
6503
 
6340
- exports.default = WebAudio;
6341
- WebAudio.scriptBufferSize = 256;
6504
+ exports["default"] = WebAudio;
6505
+
6506
+ _defineProperty(WebAudio, "scriptBufferSize", 256);
6507
+
6342
6508
  module.exports = exports.default;
6343
6509
 
6344
6510
  /***/ }),