wavesurfer.js 5.1.0 → 6.0.2

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 +47 -0
  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 +142 -26
  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 +88 -21
  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 +71 -58
  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 +52 -54
  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 +302 -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 +23 -23
  52. package/src/drawer.canvasentry.js +33 -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 +112 -23
  58. package/src/plugin/minimap/index.js +24 -21
  59. package/src/plugin/regions/index.js +31 -4
  60. package/src/plugin/regions/region.js +45 -8
  61. package/src/plugin/spectrogram/index.js +65 -50
  62. package/src/plugin/timeline/index.js +11 -9
  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.1.0 (2021-06-20)
2
+ * wavesurfer.js 6.0.2 (2022-02-20)
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,50 @@ 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 or CanvasGradient instance,
204
+ * it will be returned as is. Otherwise, it will be treated as an array,
205
+ * and a new CanvasGradient will be returned
206
+ *
207
+ * @since 6.0.0
208
+ * @param {CanvasRenderingContext2D} ctx Rendering context of target canvas
209
+ * @param {string|string[]|CanvasGradient} color Either a single fill color
210
+ * for the wave canvas, an existing CanvasGradient instance, or an array
211
+ * of colors to apply as a gradient
212
+ * @returns {string|CanvasGradient} Returns a string fillstyle value, or a
213
+ * canvas gradient
214
+ */
215
+
216
+ }, {
217
+ key: "getFillStyle",
218
+ value: function getFillStyle(ctx, color) {
219
+ if (typeof color == 'string' || color instanceof CanvasGradient) {
220
+ return color;
221
+ }
222
+
223
+ var waveGradient = ctx.createLinearGradient(0, 0, 0, ctx.canvas.height);
224
+ color.forEach(function (value, index) {
225
+ return waveGradient.addColorStop(index / color.length, value);
226
+ });
227
+ return waveGradient;
228
+ }
199
229
  /**
200
230
  * Set the canvas transforms for wave and progress
201
231
  *
@@ -421,7 +451,7 @@ var CanvasEntry = /*#__PURE__*/function () {
421
451
  return CanvasEntry;
422
452
  }();
423
453
 
424
- exports.default = CanvasEntry;
454
+ exports["default"] = CanvasEntry;
425
455
  module.exports = exports.default;
426
456
 
427
457
  /***/ }),
@@ -435,12 +465,12 @@ module.exports = exports.default;
435
465
  "use strict";
436
466
 
437
467
 
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); }
468
+ 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
469
 
440
470
  Object.defineProperty(exports, "__esModule", ({
441
471
  value: true
442
472
  }));
443
- exports.default = void 0;
473
+ exports["default"] = void 0;
444
474
 
445
475
  var util = _interopRequireWildcard(__webpack_require__(/*! ./util */ "./src/util/index.js"));
446
476
 
@@ -452,15 +482,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
452
482
 
453
483
  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
484
 
455
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
485
+ 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
486
 
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); }
487
+ 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
488
 
459
489
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
460
490
 
461
491
  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
492
 
463
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
493
+ 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
494
 
465
495
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
466
496
 
@@ -549,6 +579,7 @@ var Drawer = /*#__PURE__*/function (_util$Observer) {
549
579
  if (this.params.fillParent || this.params.scrollParent) {
550
580
  this.style(this.wrapper, {
551
581
  width: '100%',
582
+ cursor: this.params.hideCursor ? 'none' : 'auto',
552
583
  overflowX: this.params.hideScrollbar ? 'hidden' : 'auto',
553
584
  overflowY: 'hidden'
554
585
  });
@@ -915,7 +946,7 @@ var Drawer = /*#__PURE__*/function (_util$Observer) {
915
946
  return Drawer;
916
947
  }(util.Observer);
917
948
 
918
- exports.default = Drawer;
949
+ exports["default"] = Drawer;
919
950
  module.exports = exports.default;
920
951
 
921
952
  /***/ }),
@@ -929,12 +960,12 @@ module.exports = exports.default;
929
960
  "use strict";
930
961
 
931
962
 
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); }
963
+ 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
964
 
934
965
  Object.defineProperty(exports, "__esModule", ({
935
966
  value: true
936
967
  }));
937
- exports.default = void 0;
968
+ exports["default"] = void 0;
938
969
 
939
970
  var _drawer = _interopRequireDefault(__webpack_require__(/*! ./drawer */ "./src/drawer.js"));
940
971
 
@@ -952,15 +983,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
952
983
 
953
984
  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
985
 
955
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
986
+ 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
987
 
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); }
988
+ 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
989
 
959
990
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
960
991
 
961
992
  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
993
 
963
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
994
+ 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
995
 
965
996
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
966
997
 
@@ -1286,19 +1317,35 @@ var MultiCanvas = /*#__PURE__*/function (_Drawer) {
1286
1317
  var scale = length / _this4.width;
1287
1318
  var first = start;
1288
1319
  var last = end;
1289
- var i = first;
1320
+ var peakIndex = first;
1321
+
1322
+ for (peakIndex; peakIndex < last; peakIndex += step) {
1323
+ // search for the highest peak in the range this bar falls into
1324
+ var peak = 0;
1325
+ var peakIndexRange = Math.floor(peakIndex * scale) * peakIndexScale; // start index
1326
+
1327
+ var peakIndexEnd = Math.floor((peakIndex + step) * scale) * peakIndexScale;
1328
+
1329
+ do {
1330
+ // do..while makes sure at least one peak is always evaluated
1331
+ var newPeak = Math.abs(peaks[peakIndexRange]); // for arrays starting with negative values
1332
+
1333
+ if (newPeak > peak) {
1334
+ peak = newPeak; // higher
1335
+ }
1290
1336
 
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) */
1337
+ peakIndexRange += peakIndexScale; // skip every other value for negatives
1338
+ } while (peakIndexRange < peakIndexEnd); // calculate the height of this bar according to the highest peak found
1339
+
1340
+
1341
+ var h = Math.round(peak / absmax * halfH); // in case of silences, allow the user to specify that we
1342
+ // always draw *something* (normally a 1px high bar)
1296
1343
 
1297
1344
  if (h == 0 && _this4.params.barMinHeight) {
1298
1345
  h = _this4.params.barMinHeight;
1299
1346
  }
1300
1347
 
1301
- _this4.fillRect(i + _this4.halfPixel, halfH - h + offsetY, bar + _this4.halfPixel, h * 2, _this4.barRadius, ch);
1348
+ _this4.fillRect(peakIndex + _this4.halfPixel, halfH - h + offsetY, bar + _this4.halfPixel, h * 2, _this4.barRadius, ch);
1302
1349
  }
1303
1350
  });
1304
1351
  }
@@ -1602,7 +1649,7 @@ var MultiCanvas = /*#__PURE__*/function (_Drawer) {
1602
1649
  return MultiCanvas;
1603
1650
  }(_drawer.default);
1604
1651
 
1605
- exports.default = MultiCanvas;
1652
+ exports["default"] = MultiCanvas;
1606
1653
  module.exports = exports.default;
1607
1654
 
1608
1655
  /***/ }),
@@ -1616,12 +1663,12 @@ module.exports = exports.default;
1616
1663
  "use strict";
1617
1664
 
1618
1665
 
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); }
1666
+ 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
1667
 
1621
1668
  Object.defineProperty(exports, "__esModule", ({
1622
1669
  value: true
1623
1670
  }));
1624
- exports.default = void 0;
1671
+ exports["default"] = void 0;
1625
1672
 
1626
1673
  var _mediaelement = _interopRequireDefault(__webpack_require__(/*! ./mediaelement */ "./src/mediaelement.js"));
1627
1674
 
@@ -1631,19 +1678,19 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
1631
1678
 
1632
1679
  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
1680
 
1634
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
1681
+ 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
1682
 
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); }
1683
+ 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
1684
 
1638
1685
  function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
1639
1686
 
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); }
1687
+ 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
1688
 
1642
1689
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1643
1690
 
1644
1691
  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
1692
 
1646
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
1693
+ 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
1694
 
1648
1695
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
1649
1696
 
@@ -1751,7 +1798,7 @@ var MediaElementWebAudio = /*#__PURE__*/function (_MediaElement) {
1751
1798
  return MediaElementWebAudio;
1752
1799
  }(_mediaelement.default);
1753
1800
 
1754
- exports.default = MediaElementWebAudio;
1801
+ exports["default"] = MediaElementWebAudio;
1755
1802
  module.exports = exports.default;
1756
1803
 
1757
1804
  /***/ }),
@@ -1765,12 +1812,12 @@ module.exports = exports.default;
1765
1812
  "use strict";
1766
1813
 
1767
1814
 
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); }
1815
+ 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
1816
 
1770
1817
  Object.defineProperty(exports, "__esModule", ({
1771
1818
  value: true
1772
1819
  }));
1773
- exports.default = void 0;
1820
+ exports["default"] = void 0;
1774
1821
 
1775
1822
  var _webaudio = _interopRequireDefault(__webpack_require__(/*! ./webaudio */ "./src/webaudio.js"));
1776
1823
 
@@ -1786,19 +1833,19 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
1786
1833
 
1787
1834
  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
1835
 
1789
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
1836
+ 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
1837
 
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); }
1838
+ 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
1839
 
1793
1840
  function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
1794
1841
 
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); }
1842
+ 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
1843
 
1797
1844
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1798
1845
 
1799
1846
  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
1847
 
1801
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
1848
+ 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
1849
 
1803
1850
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
1804
1851
 
@@ -2141,7 +2188,7 @@ var MediaElement = /*#__PURE__*/function (_WebAudio) {
2141
2188
  }, {
2142
2189
  key: "seekTo",
2143
2190
  value: function seekTo(start) {
2144
- if (start != null) {
2191
+ if (start != null && !isNaN(start)) {
2145
2192
  this.media.currentTime = start;
2146
2193
  }
2147
2194
 
@@ -2329,7 +2376,7 @@ var MediaElement = /*#__PURE__*/function (_WebAudio) {
2329
2376
  return MediaElement;
2330
2377
  }(_webaudio.default);
2331
2378
 
2332
- exports.default = MediaElement;
2379
+ exports["default"] = MediaElement;
2333
2380
  module.exports = exports.default;
2334
2381
 
2335
2382
  /***/ }),
@@ -2346,13 +2393,13 @@ module.exports = exports.default;
2346
2393
  Object.defineProperty(exports, "__esModule", ({
2347
2394
  value: true
2348
2395
  }));
2349
- exports.default = void 0;
2396
+ exports["default"] = void 0;
2350
2397
 
2351
2398
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2352
2399
 
2353
2400
  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
2401
 
2355
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
2402
+ 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
2403
 
2357
2404
  /**
2358
2405
  * Caches the decoded peaks data to improve rendering speed for large audio
@@ -2492,7 +2539,7 @@ var PeakCache = /*#__PURE__*/function () {
2492
2539
  return PeakCache;
2493
2540
  }();
2494
2541
 
2495
- exports.default = PeakCache;
2542
+ exports["default"] = PeakCache;
2496
2543
  module.exports = exports.default;
2497
2544
 
2498
2545
  /***/ }),
@@ -2509,7 +2556,7 @@ module.exports = exports.default;
2509
2556
  Object.defineProperty(exports, "__esModule", ({
2510
2557
  value: true
2511
2558
  }));
2512
- exports.default = absMax;
2559
+ exports["default"] = absMax;
2513
2560
 
2514
2561
  var _max = _interopRequireDefault(__webpack_require__(/*! ./max */ "./src/util/max.js"));
2515
2562
 
@@ -2547,7 +2594,7 @@ module.exports = exports.default;
2547
2594
  Object.defineProperty(exports, "__esModule", ({
2548
2595
  value: true
2549
2596
  }));
2550
- exports.default = clamp;
2597
+ exports["default"] = clamp;
2551
2598
 
2552
2599
  /**
2553
2600
  * Returns a number limited to the given range.
@@ -2577,7 +2624,7 @@ module.exports = exports.default;
2577
2624
  Object.defineProperty(exports, "__esModule", ({
2578
2625
  value: true
2579
2626
  }));
2580
- exports.default = fetchFile;
2627
+ exports["default"] = fetchFile;
2581
2628
 
2582
2629
  var _observer = _interopRequireDefault(__webpack_require__(/*! ./observer */ "./src/util/observer.js"));
2583
2630
 
@@ -2587,7 +2634,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
2587
2634
 
2588
2635
  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
2636
 
2590
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
2637
+ 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
2638
 
2592
2639
  var ProgressHandler = /*#__PURE__*/function () {
2593
2640
  /**
@@ -2827,7 +2874,7 @@ module.exports = exports.default;
2827
2874
  Object.defineProperty(exports, "__esModule", ({
2828
2875
  value: true
2829
2876
  }));
2830
- exports.default = frame;
2877
+ exports["default"] = frame;
2831
2878
 
2832
2879
  var _requestAnimationFrame = _interopRequireDefault(__webpack_require__(/*! ./request-animation-frame */ "./src/util/request-animation-frame.js"));
2833
2880
 
@@ -2869,7 +2916,7 @@ module.exports = exports.default;
2869
2916
  Object.defineProperty(exports, "__esModule", ({
2870
2917
  value: true
2871
2918
  }));
2872
- exports.default = getId;
2919
+ exports["default"] = getId;
2873
2920
 
2874
2921
  /**
2875
2922
  * Get a random prefixed ID
@@ -2906,58 +2953,64 @@ module.exports = exports.default;
2906
2953
  Object.defineProperty(exports, "__esModule", ({
2907
2954
  value: true
2908
2955
  }));
2909
- Object.defineProperty(exports, "getId", ({
2956
+ Object.defineProperty(exports, "Observer", ({
2910
2957
  enumerable: true,
2911
2958
  get: function get() {
2912
- return _getId.default;
2959
+ return _observer.default;
2913
2960
  }
2914
2961
  }));
2915
- Object.defineProperty(exports, "max", ({
2962
+ Object.defineProperty(exports, "absMax", ({
2916
2963
  enumerable: true,
2917
2964
  get: function get() {
2918
- return _max.default;
2965
+ return _absMax.default;
2919
2966
  }
2920
2967
  }));
2921
- Object.defineProperty(exports, "min", ({
2968
+ Object.defineProperty(exports, "clamp", ({
2922
2969
  enumerable: true,
2923
2970
  get: function get() {
2924
- return _min.default;
2971
+ return _clamp.default;
2925
2972
  }
2926
2973
  }));
2927
- Object.defineProperty(exports, "absMax", ({
2974
+ Object.defineProperty(exports, "debounce", ({
2928
2975
  enumerable: true,
2929
2976
  get: function get() {
2930
- return _absMax.default;
2977
+ return _debounce.default;
2931
2978
  }
2932
2979
  }));
2933
- Object.defineProperty(exports, "Observer", ({
2980
+ Object.defineProperty(exports, "fetchFile", ({
2934
2981
  enumerable: true,
2935
2982
  get: function get() {
2936
- return _observer.default;
2983
+ return _fetch.default;
2937
2984
  }
2938
2985
  }));
2939
- Object.defineProperty(exports, "style", ({
2986
+ Object.defineProperty(exports, "frame", ({
2940
2987
  enumerable: true,
2941
2988
  get: function get() {
2942
- return _style.default;
2989
+ return _frame.default;
2943
2990
  }
2944
2991
  }));
2945
- Object.defineProperty(exports, "requestAnimationFrame", ({
2992
+ Object.defineProperty(exports, "getId", ({
2946
2993
  enumerable: true,
2947
2994
  get: function get() {
2948
- return _requestAnimationFrame.default;
2995
+ return _getId.default;
2949
2996
  }
2950
2997
  }));
2951
- Object.defineProperty(exports, "frame", ({
2998
+ Object.defineProperty(exports, "ignoreSilenceMode", ({
2952
2999
  enumerable: true,
2953
3000
  get: function get() {
2954
- return _frame.default;
3001
+ return _silenceMode.default;
2955
3002
  }
2956
3003
  }));
2957
- Object.defineProperty(exports, "debounce", ({
3004
+ Object.defineProperty(exports, "max", ({
2958
3005
  enumerable: true,
2959
3006
  get: function get() {
2960
- return _debounce.default;
3007
+ return _max.default;
3008
+ }
3009
+ }));
3010
+ Object.defineProperty(exports, "min", ({
3011
+ enumerable: true,
3012
+ get: function get() {
3013
+ return _min.default;
2961
3014
  }
2962
3015
  }));
2963
3016
  Object.defineProperty(exports, "preventClick", ({
@@ -2966,16 +3019,16 @@ Object.defineProperty(exports, "preventClick", ({
2966
3019
  return _preventClick.default;
2967
3020
  }
2968
3021
  }));
2969
- Object.defineProperty(exports, "fetchFile", ({
3022
+ Object.defineProperty(exports, "requestAnimationFrame", ({
2970
3023
  enumerable: true,
2971
3024
  get: function get() {
2972
- return _fetch.default;
3025
+ return _requestAnimationFrame.default;
2973
3026
  }
2974
3027
  }));
2975
- Object.defineProperty(exports, "clamp", ({
3028
+ Object.defineProperty(exports, "style", ({
2976
3029
  enumerable: true,
2977
3030
  get: function get() {
2978
- return _clamp.default;
3031
+ return _style.default;
2979
3032
  }
2980
3033
  }));
2981
3034
  Object.defineProperty(exports, "withOrientation", ({
@@ -3011,6 +3064,8 @@ var _clamp = _interopRequireDefault(__webpack_require__(/*! ./clamp */ "./src/ut
3011
3064
 
3012
3065
  var _orientation = _interopRequireDefault(__webpack_require__(/*! ./orientation */ "./src/util/orientation.js"));
3013
3066
 
3067
+ var _silenceMode = _interopRequireDefault(__webpack_require__(/*! ./silence-mode */ "./src/util/silence-mode.js"));
3068
+
3014
3069
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3015
3070
 
3016
3071
  /***/ }),
@@ -3027,7 +3082,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
3027
3082
  Object.defineProperty(exports, "__esModule", ({
3028
3083
  value: true
3029
3084
  }));
3030
- exports.default = max;
3085
+ exports["default"] = max;
3031
3086
 
3032
3087
  /**
3033
3088
  * Get the largest value
@@ -3062,7 +3117,7 @@ module.exports = exports.default;
3062
3117
  Object.defineProperty(exports, "__esModule", ({
3063
3118
  value: true
3064
3119
  }));
3065
- exports.default = min;
3120
+ exports["default"] = min;
3066
3121
 
3067
3122
  /**
3068
3123
  * Get the smallest value
@@ -3097,13 +3152,13 @@ module.exports = exports.default;
3097
3152
  Object.defineProperty(exports, "__esModule", ({
3098
3153
  value: true
3099
3154
  }));
3100
- exports.default = void 0;
3155
+ exports["default"] = void 0;
3101
3156
 
3102
3157
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3103
3158
 
3104
3159
  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
3160
 
3106
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
3161
+ 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
3162
 
3108
3163
  /**
3109
3164
  * @typedef {Object} ListenerDescriptor
@@ -3287,7 +3342,7 @@ var Observer = /*#__PURE__*/function () {
3287
3342
  return Observer;
3288
3343
  }();
3289
3344
 
3290
- exports.default = Observer;
3345
+ exports["default"] = Observer;
3291
3346
  module.exports = exports.default;
3292
3347
 
3293
3348
  /***/ }),
@@ -3304,7 +3359,7 @@ module.exports = exports.default;
3304
3359
  Object.defineProperty(exports, "__esModule", ({
3305
3360
  value: true
3306
3361
  }));
3307
- exports.default = withOrientation;
3362
+ exports["default"] = withOrientation;
3308
3363
  var verticalPropMap = {
3309
3364
  width: 'height',
3310
3365
  height: 'width',
@@ -3411,7 +3466,7 @@ module.exports = exports.default;
3411
3466
  Object.defineProperty(exports, "__esModule", ({
3412
3467
  value: true
3413
3468
  }));
3414
- exports.default = preventClick;
3469
+ exports["default"] = preventClick;
3415
3470
 
3416
3471
  /**
3417
3472
  * Stops propagation of click event and removes event listener
@@ -3450,7 +3505,7 @@ module.exports = exports.default;
3450
3505
  Object.defineProperty(exports, "__esModule", ({
3451
3506
  value: true
3452
3507
  }));
3453
- exports.default = void 0;
3508
+ exports["default"] = void 0;
3454
3509
 
3455
3510
  /* eslint-disable valid-jsdoc */
3456
3511
 
@@ -3464,7 +3519,57 @@ var _default = (window.requestAnimationFrame || window.webkitRequestAnimationFra
3464
3519
  return setTimeout(callback, 1000 / 60);
3465
3520
  }).bind(window);
3466
3521
 
3467
- exports.default = _default;
3522
+ exports["default"] = _default;
3523
+ module.exports = exports.default;
3524
+
3525
+ /***/ }),
3526
+
3527
+ /***/ "./src/util/silence-mode.js":
3528
+ /*!**********************************!*\
3529
+ !*** ./src/util/silence-mode.js ***!
3530
+ \**********************************/
3531
+ /***/ ((module, exports) => {
3532
+
3533
+ "use strict";
3534
+
3535
+
3536
+ Object.defineProperty(exports, "__esModule", ({
3537
+ value: true
3538
+ }));
3539
+ exports["default"] = ignoreSilenceMode;
3540
+
3541
+ /**
3542
+ * Ignores device silence mode when using the `WebAudio` backend.
3543
+ *
3544
+ * Many mobile devices contain a hardware button to mute the ringtone for incoming
3545
+ * calls and messages. Unfortunately, on some platforms like iOS, this also mutes
3546
+ * wavesurfer's audio when using the `WebAudio` backend. This function creates a
3547
+ * temporary `<audio>` element that makes sure the WebAudio backend keeps playing
3548
+ * when muting the device ringer.
3549
+ *
3550
+ * @since 5.2.0
3551
+ */
3552
+ function ignoreSilenceMode() {
3553
+ // Set the src to a short bit of url encoded as a silent mp3
3554
+ // NOTE The silence MP3 must be high quality, when web audio sounds are played
3555
+ // in parallel the web audio sound is mixed to match the bitrate of the html sound
3556
+ // 0.01 seconds of silence VBR220-260 Joint Stereo 859B
3557
+ 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)
3558
+
3559
+ var tmp = document.createElement("div");
3560
+ tmp.innerHTML = '<audio x-webkit-airplay="deny"></audio>';
3561
+ var audioSilentMode = tmp.children.item(0);
3562
+ audioSilentMode.src = audioData;
3563
+ audioSilentMode.preload = "auto";
3564
+ audioSilentMode.type = "audio/mpeg";
3565
+ audioSilentMode.disableRemotePlayback = true; // play
3566
+
3567
+ audioSilentMode.play(); // cleanup
3568
+
3569
+ audioSilentMode.remove();
3570
+ tmp.remove();
3571
+ }
3572
+
3468
3573
  module.exports = exports.default;
3469
3574
 
3470
3575
  /***/ }),
@@ -3481,7 +3586,7 @@ module.exports = exports.default;
3481
3586
  Object.defineProperty(exports, "__esModule", ({
3482
3587
  value: true
3483
3588
  }));
3484
- exports.default = style;
3589
+ exports["default"] = style;
3485
3590
 
3486
3591
  /**
3487
3592
  * Apply a map of styles to an element
@@ -3513,12 +3618,12 @@ module.exports = exports.default;
3513
3618
  "use strict";
3514
3619
 
3515
3620
 
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); }
3621
+ 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
3622
 
3518
3623
  Object.defineProperty(exports, "__esModule", ({
3519
3624
  value: true
3520
3625
  }));
3521
- exports.default = void 0;
3626
+ exports["default"] = void 0;
3522
3627
 
3523
3628
  var util = _interopRequireWildcard(__webpack_require__(/*! ./util */ "./src/util/index.js"));
3524
3629
 
@@ -3538,13 +3643,13 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
3538
3643
 
3539
3644
  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
3645
 
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); }
3646
+ 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
3647
 
3543
3648
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
3544
3649
 
3545
3650
  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
3651
 
3547
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
3652
+ 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
3653
 
3549
3654
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
3550
3655
 
@@ -3552,11 +3657,13 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
3552
3657
 
3553
3658
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
3554
3659
 
3660
+ 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; }
3661
+
3555
3662
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3556
3663
 
3557
3664
  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
3665
 
3559
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
3666
+ 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
3667
 
3561
3668
  /*
3562
3669
  * This work is licensed under a BSD-3-Clause License.
@@ -3628,6 +3735,10 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
3628
3735
  * pixels.
3629
3736
  * @property {boolean} hideScrollbar=false Whether to hide the horizontal
3630
3737
  * scrollbar when one would normally be shown.
3738
+ * @property {boolean} hideCursor=false Whether to hide the mouse cursor
3739
+ * when one would normally be shown by default.
3740
+ * @property {boolean} ignoreSilenceMode=false If true, ignores device silence mode
3741
+ * when using the `WebAudio` backend.
3631
3742
  * @property {boolean} interact=true Whether the mouse interaction will be
3632
3743
  * enabled at initialization. You can switch this parameter at any time later
3633
3744
  * on.
@@ -3837,7 +3948,7 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
3837
3948
  * @private
3838
3949
  */
3839
3950
 
3840
- _this.defaultParams = {
3951
+ _defineProperty(_assertThisInitialized(_this), "defaultParams", {
3841
3952
  audioContext: null,
3842
3953
  audioScriptProcessor: null,
3843
3954
  audioRate: 1,
@@ -3865,6 +3976,8 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
3865
3976
  forceDecode: false,
3866
3977
  height: 128,
3867
3978
  hideScrollbar: false,
3979
+ hideCursor: false,
3980
+ ignoreSilenceMode: false,
3868
3981
  interact: true,
3869
3982
  loopSelection: true,
3870
3983
  maxCanvasWidth: 4000,
@@ -3893,13 +4006,16 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
3893
4006
  vertical: false,
3894
4007
  waveColor: '#999',
3895
4008
  xhr: {}
3896
- };
3897
- _this.backends = {
4009
+ });
4010
+
4011
+ _defineProperty(_assertThisInitialized(_this), "backends", {
3898
4012
  MediaElement: _mediaelement.default,
3899
4013
  WebAudio: _webaudio.default,
3900
4014
  MediaElementWebAudio: _mediaelementWebaudio.default
3901
- };
3902
- _this.util = util;
4015
+ });
4016
+
4017
+ _defineProperty(_assertThisInitialized(_this), "util", util);
4018
+
3903
4019
  _this.params = Object.assign({}, _this.defaultParams, params);
3904
4020
  _this.params.splitChannelsOptions = Object.assign({}, _this.defaultParams.splitChannelsOptions, params.splitChannelsOptions);
3905
4021
  /** @private */
@@ -4383,6 +4499,11 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
4383
4499
  value: function play(start, end) {
4384
4500
  var _this7 = this;
4385
4501
 
4502
+ if (this.params.ignoreSilenceMode) {
4503
+ // ignores device hardware silence mode
4504
+ util.ignoreSilenceMode();
4505
+ }
4506
+
4386
4507
  this.fireEvent('interaction', function () {
4387
4508
  return _this7.play(start, end);
4388
4509
  });
@@ -4728,49 +4849,77 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
4728
4849
  /**
4729
4850
  * Get the fill color of the waveform after the cursor.
4730
4851
  *
4731
- * @return {string} A CSS color string.
4852
+ * @param {?number} channelIdx Optional index of the channel to get its wave color if splitChannels is true
4853
+ * @return {string|object} A CSS color string, or an array of CSS color strings.
4732
4854
  */
4733
4855
 
4734
4856
  }, {
4735
4857
  key: "getWaveColor",
4736
4858
  value: function getWaveColor() {
4859
+ var channelIdx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
4860
+
4861
+ if (this.params.splitChannelsOptions.channelColors[channelIdx]) {
4862
+ return this.params.splitChannelsOptions.channelColors[channelIdx].waveColor;
4863
+ }
4864
+
4737
4865
  return this.params.waveColor;
4738
4866
  }
4739
4867
  /**
4740
4868
  * Set the fill color of the waveform after the cursor.
4741
4869
  *
4742
- * @param {string} color A CSS color string.
4870
+ * @param {string|object} color A CSS color string, or an array of CSS color strings.
4871
+ * @param {?number} channelIdx Optional index of the channel to set its wave color if splitChannels is true
4743
4872
  * @example wavesurfer.setWaveColor('#ddd');
4744
4873
  */
4745
4874
 
4746
4875
  }, {
4747
4876
  key: "setWaveColor",
4748
4877
  value: function setWaveColor(color) {
4749
- this.params.waveColor = color;
4878
+ var channelIdx = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
4879
+
4880
+ if (this.params.splitChannelsOptions.channelColors[channelIdx]) {
4881
+ this.params.splitChannelsOptions.channelColors[channelIdx].waveColor = color;
4882
+ } else {
4883
+ this.params.waveColor = color;
4884
+ }
4885
+
4750
4886
  this.drawBuffer();
4751
4887
  }
4752
4888
  /**
4753
4889
  * Get the fill color of the waveform behind the cursor.
4754
4890
  *
4755
- * @return {string} A CSS color string.
4891
+ * @param {?number} channelIdx Optional index of the channel to get its progress color if splitChannels is true
4892
+ * @return {string|object} A CSS color string, or an array of CSS color strings.
4756
4893
  */
4757
4894
 
4758
4895
  }, {
4759
4896
  key: "getProgressColor",
4760
4897
  value: function getProgressColor() {
4898
+ var channelIdx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
4899
+
4900
+ if (this.params.splitChannelsOptions.channelColors[channelIdx]) {
4901
+ return this.params.splitChannelsOptions.channelColors[channelIdx].progressColor;
4902
+ }
4903
+
4761
4904
  return this.params.progressColor;
4762
4905
  }
4763
4906
  /**
4764
4907
  * Set the fill color of the waveform behind the cursor.
4765
4908
  *
4766
- * @param {string} color A CSS color string.
4909
+ * @param {string|object} color A CSS color string, or an array of CSS color strings.
4910
+ * @param {?number} channelIdx Optional index of the channel to set its progress color if splitChannels is true
4767
4911
  * @example wavesurfer.setProgressColor('#400');
4768
4912
  */
4769
4913
 
4770
4914
  }, {
4771
4915
  key: "setProgressColor",
4772
- value: function setProgressColor(color) {
4773
- this.params.progressColor = color;
4916
+ value: function setProgressColor(color, channelIdx) {
4917
+ if (this.params.splitChannelsOptions.channelColors[channelIdx]) {
4918
+ this.params.splitChannelsOptions.channelColors[channelIdx].progressColor = color;
4919
+ } else {
4920
+ this.params.progressColor = color;
4921
+ }
4922
+
4774
4923
  this.drawBuffer();
4775
4924
  }
4776
4925
  /**
@@ -5185,17 +5334,19 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
5185
5334
  value: function decodeArrayBuffer(arraybuffer, callback) {
5186
5335
  var _this13 = this;
5187
5336
 
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
- });
5337
+ if (!this.isDestroyed) {
5338
+ this.arraybuffer = arraybuffer;
5339
+ this.backend.decodeArrayBuffer(arraybuffer, function (data) {
5340
+ // Only use the decoded data if we haven't been destroyed or
5341
+ // another decode started in the meantime
5342
+ if (!_this13.isDestroyed && _this13.arraybuffer == arraybuffer) {
5343
+ callback(data);
5344
+ _this13.arraybuffer = null;
5345
+ }
5346
+ }, function () {
5347
+ return _this13.fireEvent('error', 'Error decoding audiobuffer');
5348
+ });
5349
+ }
5199
5350
  }
5200
5351
  /**
5201
5352
  * Load an array buffer using fetch and pass the result to a callback
@@ -5444,9 +5595,12 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
5444
5595
  return WaveSurfer;
5445
5596
  }(util.Observer);
5446
5597
 
5447
- exports.default = WaveSurfer;
5448
- WaveSurfer.VERSION = "5.1.0";
5449
- WaveSurfer.util = util;
5598
+ exports["default"] = WaveSurfer;
5599
+
5600
+ _defineProperty(WaveSurfer, "VERSION", "6.0.2");
5601
+
5602
+ _defineProperty(WaveSurfer, "util", util);
5603
+
5450
5604
  module.exports = exports.default;
5451
5605
 
5452
5606
  /***/ }),
@@ -5460,12 +5614,12 @@ module.exports = exports.default;
5460
5614
  "use strict";
5461
5615
 
5462
5616
 
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); }
5617
+ 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
5618
 
5465
5619
  Object.defineProperty(exports, "__esModule", ({
5466
5620
  value: true
5467
5621
  }));
5468
- exports.default = void 0;
5622
+ exports["default"] = void 0;
5469
5623
 
5470
5624
  var util = _interopRequireWildcard(__webpack_require__(/*! ./util */ "./src/util/index.js"));
5471
5625
 
@@ -5473,21 +5627,19 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
5473
5627
 
5474
5628
  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
5629
 
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
5630
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5479
5631
 
5480
5632
  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
5633
 
5482
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
5634
+ 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
5635
 
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); }
5636
+ 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
5637
 
5486
5638
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
5487
5639
 
5488
5640
  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
5641
 
5490
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
5642
+ 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
5643
 
5492
5644
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
5493
5645
 
@@ -5495,6 +5647,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
5495
5647
 
5496
5648
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
5497
5649
 
5650
+ 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; }
5651
+
5498
5652
  // using constants to prevent someone writing the string wrong
5499
5653
  var PLAYING = 'playing';
5500
5654
  var PAUSED = 'paused';
@@ -5516,7 +5670,7 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5516
5670
  * @param {WavesurferParams} params Wavesurfer parameters
5517
5671
  */
5518
5672
  function WebAudio(params) {
5519
- var _this$stateBehaviors, _this$states;
5673
+ var _defineProperty2, _this$states;
5520
5674
 
5521
5675
  var _this;
5522
5676
 
@@ -5525,9 +5679,11 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5525
5679
  _this = _super.call(this);
5526
5680
  /** @private */
5527
5681
 
5528
- _this.audioContext = null;
5529
- _this.offlineAudioContext = null;
5530
- _this.stateBehaviors = (_this$stateBehaviors = {}, _defineProperty(_this$stateBehaviors, PLAYING, {
5682
+ _defineProperty(_assertThisInitialized(_this), "audioContext", null);
5683
+
5684
+ _defineProperty(_assertThisInitialized(_this), "offlineAudioContext", null);
5685
+
5686
+ _defineProperty(_assertThisInitialized(_this), "stateBehaviors", (_defineProperty2 = {}, _defineProperty(_defineProperty2, PLAYING, {
5531
5687
  init: function init() {
5532
5688
  this.addOnAudioProcess();
5533
5689
  },
@@ -5538,7 +5694,7 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5538
5694
  getCurrentTime: function getCurrentTime() {
5539
5695
  return this.startPosition + this.getPlayedTime();
5540
5696
  }
5541
- }), _defineProperty(_this$stateBehaviors, PAUSED, {
5697
+ }), _defineProperty(_defineProperty2, PAUSED, {
5542
5698
  init: function init() {
5543
5699
  this.removeOnAudioProcess();
5544
5700
  },
@@ -5549,7 +5705,7 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5549
5705
  getCurrentTime: function getCurrentTime() {
5550
5706
  return this.startPosition;
5551
5707
  }
5552
- }), _defineProperty(_this$stateBehaviors, FINISHED, {
5708
+ }), _defineProperty(_defineProperty2, FINISHED, {
5553
5709
  init: function init() {
5554
5710
  this.removeOnAudioProcess();
5555
5711
  this.fireEvent('finish');
@@ -5560,7 +5716,8 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5560
5716
  getCurrentTime: function getCurrentTime() {
5561
5717
  return this.getDuration();
5562
5718
  }
5563
- }), _this$stateBehaviors);
5719
+ }), _defineProperty2));
5720
+
5564
5721
  _this.params = params;
5565
5722
  /** ac: Audio Context instance */
5566
5723
 
@@ -6281,7 +6438,17 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
6281
6438
  value: function pause() {
6282
6439
  this.scheduledPause = null;
6283
6440
  this.startPosition += this.getPlayedTime();
6284
- this.source && this.source.stop(0);
6441
+
6442
+ try {
6443
+ this.source && this.source.stop(0);
6444
+ } catch (err) {// Calling stop can throw the following 2 errors:
6445
+ // - RangeError (The value specified for when is negative.)
6446
+ // - InvalidStateNode (The node has not been started by calling start().)
6447
+ // We can safely ignore both errors, because:
6448
+ // - The range is surely correct
6449
+ // - The node might not have been started yet, in which case we just want to carry on without causing any trouble.
6450
+ }
6451
+
6285
6452
  this.setState(PAUSED);
6286
6453
  this.fireEvent('pause');
6287
6454
  }
@@ -6337,8 +6504,10 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
6337
6504
  return WebAudio;
6338
6505
  }(util.Observer);
6339
6506
 
6340
- exports.default = WebAudio;
6341
- WebAudio.scriptBufferSize = 256;
6507
+ exports["default"] = WebAudio;
6508
+
6509
+ _defineProperty(WebAudio, "scriptBufferSize", 256);
6510
+
6342
6511
  module.exports = exports.default;
6343
6512
 
6344
6513
  /***/ }),