wavesurfer.js 5.2.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGES.md +22 -0
  2. package/README.md +10 -0
  3. package/dist/plugin/wavesurfer.cursor.js +52 -50
  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 +9 -6
  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 +141 -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 +5 -5
  16. package/dist/plugin/wavesurfer.mediasession.min.js +2 -2
  17. package/dist/plugin/wavesurfer.mediasession.min.js.map +1 -1
  18. package/dist/plugin/wavesurfer.microphone.js +4 -4
  19. package/dist/plugin/wavesurfer.microphone.min.js +2 -2
  20. package/dist/plugin/wavesurfer.microphone.min.js.map +1 -1
  21. package/dist/plugin/wavesurfer.minimap.js +25 -22
  22. package/dist/plugin/wavesurfer.minimap.js.map +1 -1
  23. package/dist/plugin/wavesurfer.minimap.min.js +2 -2
  24. package/dist/plugin/wavesurfer.minimap.min.js.map +1 -1
  25. package/dist/plugin/wavesurfer.playhead.js +4 -4
  26. package/dist/plugin/wavesurfer.playhead.min.js +2 -2
  27. package/dist/plugin/wavesurfer.playhead.min.js.map +1 -1
  28. package/dist/plugin/wavesurfer.regions.js +53 -16
  29. package/dist/plugin/wavesurfer.regions.js.map +1 -1
  30. package/dist/plugin/wavesurfer.regions.min.js +2 -2
  31. package/dist/plugin/wavesurfer.regions.min.js.map +1 -1
  32. package/dist/plugin/wavesurfer.spectrogram.js +70 -57
  33. package/dist/plugin/wavesurfer.spectrogram.js.map +1 -1
  34. package/dist/plugin/wavesurfer.spectrogram.min.js +2 -2
  35. package/dist/plugin/wavesurfer.spectrogram.min.js.map +1 -1
  36. package/dist/plugin/wavesurfer.timeline.js +39 -44
  37. package/dist/plugin/wavesurfer.timeline.js.map +1 -1
  38. package/dist/plugin/wavesurfer.timeline.min.js +2 -2
  39. package/dist/plugin/wavesurfer.timeline.min.js.map +1 -1
  40. package/dist/wavesurfer-html-init.js +5 -5
  41. package/dist/wavesurfer-html-init.min.js +2 -2
  42. package/dist/wavesurfer-html-init.min.js.map +1 -1
  43. package/dist/wavesurfer.js +209 -121
  44. package/dist/wavesurfer.js.map +1 -1
  45. package/dist/wavesurfer.min.js +2 -2
  46. package/dist/wavesurfer.min.js.map +1 -1
  47. package/package.json +23 -23
  48. package/src/drawer.canvasentry.js +30 -6
  49. package/src/drawer.js +1 -0
  50. package/src/drawer.multicanvas.js +19 -8
  51. package/src/mediaelement.js +1 -1
  52. package/src/plugin/cursor/index.js +68 -70
  53. package/src/plugin/markers/index.js +112 -23
  54. package/src/plugin/minimap/index.js +24 -21
  55. package/src/plugin/regions/index.js +30 -3
  56. package/src/plugin/regions/region.js +13 -4
  57. package/src/plugin/spectrogram/index.js +65 -50
  58. package/src/wavesurfer.js +31 -10
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wavesurfer.js 5.2.0 (2021-08-16)
2
+ * wavesurfer.js 6.0.0 (2022-02-07)
3
3
  * https://wavesurfer-js.org
4
4
  * @license BSD-3-Clause
5
5
  */
@@ -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 5.3.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,9 +479,9 @@ 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
 
@@ -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,9 +980,9 @@ 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
 
@@ -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;
1290
1318
 
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) */
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 = peaks[peakIndexRange];
1329
+
1330
+ if (newPeak > peak) {
1331
+ peak = newPeak; // higher
1332
+ }
1333
+
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,13 +1675,13 @@ 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
 
@@ -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,13 +1830,13 @@ 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
 
@@ -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,88 +2950,88 @@ 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;
2961
3005
  }
2962
3006
  }));
2963
- Object.defineProperty(exports, "preventClick", ({
3007
+ Object.defineProperty(exports, "min", ({
2964
3008
  enumerable: true,
2965
3009
  get: function get() {
2966
- return _preventClick.default;
3010
+ return _min.default;
2967
3011
  }
2968
3012
  }));
2969
- Object.defineProperty(exports, "fetchFile", ({
3013
+ Object.defineProperty(exports, "preventClick", ({
2970
3014
  enumerable: true,
2971
3015
  get: function get() {
2972
- return _fetch.default;
3016
+ return _preventClick.default;
2973
3017
  }
2974
3018
  }));
2975
- Object.defineProperty(exports, "clamp", ({
3019
+ Object.defineProperty(exports, "requestAnimationFrame", ({
2976
3020
  enumerable: true,
2977
3021
  get: function get() {
2978
- return _clamp.default;
3022
+ return _requestAnimationFrame.default;
2979
3023
  }
2980
3024
  }));
2981
- Object.defineProperty(exports, "withOrientation", ({
3025
+ Object.defineProperty(exports, "style", ({
2982
3026
  enumerable: true,
2983
3027
  get: function get() {
2984
- return _orientation.default;
3028
+ return _style.default;
2985
3029
  }
2986
3030
  }));
2987
- Object.defineProperty(exports, "ignoreSilenceMode", ({
3031
+ Object.defineProperty(exports, "withOrientation", ({
2988
3032
  enumerable: true,
2989
3033
  get: function get() {
2990
- return _silenceMode.default;
3034
+ return _orientation.default;
2991
3035
  }
2992
3036
  }));
2993
3037
 
@@ -3035,7 +3079,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
3035
3079
  Object.defineProperty(exports, "__esModule", ({
3036
3080
  value: true
3037
3081
  }));
3038
- exports.default = max;
3082
+ exports["default"] = max;
3039
3083
 
3040
3084
  /**
3041
3085
  * Get the largest value
@@ -3070,7 +3114,7 @@ module.exports = exports.default;
3070
3114
  Object.defineProperty(exports, "__esModule", ({
3071
3115
  value: true
3072
3116
  }));
3073
- exports.default = min;
3117
+ exports["default"] = min;
3074
3118
 
3075
3119
  /**
3076
3120
  * Get the smallest value
@@ -3105,13 +3149,13 @@ module.exports = exports.default;
3105
3149
  Object.defineProperty(exports, "__esModule", ({
3106
3150
  value: true
3107
3151
  }));
3108
- exports.default = void 0;
3152
+ exports["default"] = void 0;
3109
3153
 
3110
3154
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3111
3155
 
3112
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); } }
3113
3157
 
3114
- 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; }
3115
3159
 
3116
3160
  /**
3117
3161
  * @typedef {Object} ListenerDescriptor
@@ -3295,7 +3339,7 @@ var Observer = /*#__PURE__*/function () {
3295
3339
  return Observer;
3296
3340
  }();
3297
3341
 
3298
- exports.default = Observer;
3342
+ exports["default"] = Observer;
3299
3343
  module.exports = exports.default;
3300
3344
 
3301
3345
  /***/ }),
@@ -3312,7 +3356,7 @@ module.exports = exports.default;
3312
3356
  Object.defineProperty(exports, "__esModule", ({
3313
3357
  value: true
3314
3358
  }));
3315
- exports.default = withOrientation;
3359
+ exports["default"] = withOrientation;
3316
3360
  var verticalPropMap = {
3317
3361
  width: 'height',
3318
3362
  height: 'width',
@@ -3419,7 +3463,7 @@ module.exports = exports.default;
3419
3463
  Object.defineProperty(exports, "__esModule", ({
3420
3464
  value: true
3421
3465
  }));
3422
- exports.default = preventClick;
3466
+ exports["default"] = preventClick;
3423
3467
 
3424
3468
  /**
3425
3469
  * Stops propagation of click event and removes event listener
@@ -3458,7 +3502,7 @@ module.exports = exports.default;
3458
3502
  Object.defineProperty(exports, "__esModule", ({
3459
3503
  value: true
3460
3504
  }));
3461
- exports.default = void 0;
3505
+ exports["default"] = void 0;
3462
3506
 
3463
3507
  /* eslint-disable valid-jsdoc */
3464
3508
 
@@ -3472,7 +3516,7 @@ var _default = (window.requestAnimationFrame || window.webkitRequestAnimationFra
3472
3516
  return setTimeout(callback, 1000 / 60);
3473
3517
  }).bind(window);
3474
3518
 
3475
- exports.default = _default;
3519
+ exports["default"] = _default;
3476
3520
  module.exports = exports.default;
3477
3521
 
3478
3522
  /***/ }),
@@ -3489,7 +3533,7 @@ module.exports = exports.default;
3489
3533
  Object.defineProperty(exports, "__esModule", ({
3490
3534
  value: true
3491
3535
  }));
3492
- exports.default = ignoreSilenceMode;
3536
+ exports["default"] = ignoreSilenceMode;
3493
3537
 
3494
3538
  /**
3495
3539
  * Ignores device silence mode when using the `WebAudio` backend.
@@ -3539,7 +3583,7 @@ module.exports = exports.default;
3539
3583
  Object.defineProperty(exports, "__esModule", ({
3540
3584
  value: true
3541
3585
  }));
3542
- exports.default = style;
3586
+ exports["default"] = style;
3543
3587
 
3544
3588
  /**
3545
3589
  * Apply a map of styles to an element
@@ -3571,12 +3615,12 @@ module.exports = exports.default;
3571
3615
  "use strict";
3572
3616
 
3573
3617
 
3574
- 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); }
3575
3619
 
3576
3620
  Object.defineProperty(exports, "__esModule", ({
3577
3621
  value: true
3578
3622
  }));
3579
- exports.default = void 0;
3623
+ exports["default"] = void 0;
3580
3624
 
3581
3625
  var util = _interopRequireWildcard(__webpack_require__(/*! ./util */ "./src/util/index.js"));
3582
3626
 
@@ -3596,7 +3640,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
3596
3640
 
3597
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; }
3598
3642
 
3599
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
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); }
3600
3644
 
3601
3645
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
3602
3646
 
@@ -3610,11 +3654,13 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
3610
3654
 
3611
3655
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
3612
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
+
3613
3659
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3614
3660
 
3615
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); } }
3616
3662
 
3617
- 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; }
3618
3664
 
3619
3665
  /*
3620
3666
  * This work is licensed under a BSD-3-Clause License.
@@ -3686,6 +3732,8 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
3686
3732
  * pixels.
3687
3733
  * @property {boolean} hideScrollbar=false Whether to hide the horizontal
3688
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.
3689
3737
  * @property {boolean} ignoreSilenceMode=false If true, ignores device silence mode
3690
3738
  * when using the `WebAudio` backend.
3691
3739
  * @property {boolean} interact=true Whether the mouse interaction will be
@@ -3897,7 +3945,7 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
3897
3945
  * @private
3898
3946
  */
3899
3947
 
3900
- _this.defaultParams = {
3948
+ _defineProperty(_assertThisInitialized(_this), "defaultParams", {
3901
3949
  audioContext: null,
3902
3950
  audioScriptProcessor: null,
3903
3951
  audioRate: 1,
@@ -3925,6 +3973,7 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
3925
3973
  forceDecode: false,
3926
3974
  height: 128,
3927
3975
  hideScrollbar: false,
3976
+ hideCursor: false,
3928
3977
  ignoreSilenceMode: false,
3929
3978
  interact: true,
3930
3979
  loopSelection: true,
@@ -3954,13 +4003,16 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
3954
4003
  vertical: false,
3955
4004
  waveColor: '#999',
3956
4005
  xhr: {}
3957
- };
3958
- _this.backends = {
4006
+ });
4007
+
4008
+ _defineProperty(_assertThisInitialized(_this), "backends", {
3959
4009
  MediaElement: _mediaelement.default,
3960
4010
  WebAudio: _webaudio.default,
3961
4011
  MediaElementWebAudio: _mediaelementWebaudio.default
3962
- };
3963
- _this.util = util;
4012
+ });
4013
+
4014
+ _defineProperty(_assertThisInitialized(_this), "util", util);
4015
+
3964
4016
  _this.params = Object.assign({}, _this.defaultParams, params);
3965
4017
  _this.params.splitChannelsOptions = Object.assign({}, _this.defaultParams.splitChannelsOptions, params.splitChannelsOptions);
3966
4018
  /** @private */
@@ -4794,49 +4846,77 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
4794
4846
  /**
4795
4847
  * Get the fill color of the waveform after the cursor.
4796
4848
  *
4797
- * @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.
4798
4851
  */
4799
4852
 
4800
4853
  }, {
4801
4854
  key: "getWaveColor",
4802
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
+
4803
4862
  return this.params.waveColor;
4804
4863
  }
4805
4864
  /**
4806
4865
  * Set the fill color of the waveform after the cursor.
4807
4866
  *
4808
- * @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
4809
4869
  * @example wavesurfer.setWaveColor('#ddd');
4810
4870
  */
4811
4871
 
4812
4872
  }, {
4813
4873
  key: "setWaveColor",
4814
4874
  value: function setWaveColor(color) {
4815
- 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
+
4816
4883
  this.drawBuffer();
4817
4884
  }
4818
4885
  /**
4819
4886
  * Get the fill color of the waveform behind the cursor.
4820
4887
  *
4821
- * @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.
4822
4890
  */
4823
4891
 
4824
4892
  }, {
4825
4893
  key: "getProgressColor",
4826
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
+
4827
4901
  return this.params.progressColor;
4828
4902
  }
4829
4903
  /**
4830
4904
  * Set the fill color of the waveform behind the cursor.
4831
4905
  *
4832
- * @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
4833
4908
  * @example wavesurfer.setProgressColor('#400');
4834
4909
  */
4835
4910
 
4836
4911
  }, {
4837
4912
  key: "setProgressColor",
4838
- value: function setProgressColor(color) {
4839
- 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
+
4840
4920
  this.drawBuffer();
4841
4921
  }
4842
4922
  /**
@@ -5512,9 +5592,12 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
5512
5592
  return WaveSurfer;
5513
5593
  }(util.Observer);
5514
5594
 
5515
- exports.default = WaveSurfer;
5516
- WaveSurfer.VERSION = "5.2.0";
5517
- WaveSurfer.util = util;
5595
+ exports["default"] = WaveSurfer;
5596
+
5597
+ _defineProperty(WaveSurfer, "VERSION", "6.0.0");
5598
+
5599
+ _defineProperty(WaveSurfer, "util", util);
5600
+
5518
5601
  module.exports = exports.default;
5519
5602
 
5520
5603
  /***/ }),
@@ -5528,12 +5611,12 @@ module.exports = exports.default;
5528
5611
  "use strict";
5529
5612
 
5530
5613
 
5531
- 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); }
5532
5615
 
5533
5616
  Object.defineProperty(exports, "__esModule", ({
5534
5617
  value: true
5535
5618
  }));
5536
- exports.default = void 0;
5619
+ exports["default"] = void 0;
5537
5620
 
5538
5621
  var util = _interopRequireWildcard(__webpack_require__(/*! ./util */ "./src/util/index.js"));
5539
5622
 
@@ -5541,15 +5624,13 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
5541
5624
 
5542
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; }
5543
5626
 
5544
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5545
-
5546
5627
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5547
5628
 
5548
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); } }
5549
5630
 
5550
- 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; }
5551
5632
 
5552
- 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); }
5553
5634
 
5554
5635
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
5555
5636
 
@@ -5563,6 +5644,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
5563
5644
 
5564
5645
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
5565
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
+
5566
5649
  // using constants to prevent someone writing the string wrong
5567
5650
  var PLAYING = 'playing';
5568
5651
  var PAUSED = 'paused';
@@ -5584,7 +5667,7 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5584
5667
  * @param {WavesurferParams} params Wavesurfer parameters
5585
5668
  */
5586
5669
  function WebAudio(params) {
5587
- var _this$stateBehaviors, _this$states;
5670
+ var _defineProperty2, _this$states;
5588
5671
 
5589
5672
  var _this;
5590
5673
 
@@ -5593,9 +5676,11 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5593
5676
  _this = _super.call(this);
5594
5677
  /** @private */
5595
5678
 
5596
- _this.audioContext = null;
5597
- _this.offlineAudioContext = null;
5598
- _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, {
5599
5684
  init: function init() {
5600
5685
  this.addOnAudioProcess();
5601
5686
  },
@@ -5606,7 +5691,7 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5606
5691
  getCurrentTime: function getCurrentTime() {
5607
5692
  return this.startPosition + this.getPlayedTime();
5608
5693
  }
5609
- }), _defineProperty(_this$stateBehaviors, PAUSED, {
5694
+ }), _defineProperty(_defineProperty2, PAUSED, {
5610
5695
  init: function init() {
5611
5696
  this.removeOnAudioProcess();
5612
5697
  },
@@ -5617,7 +5702,7 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5617
5702
  getCurrentTime: function getCurrentTime() {
5618
5703
  return this.startPosition;
5619
5704
  }
5620
- }), _defineProperty(_this$stateBehaviors, FINISHED, {
5705
+ }), _defineProperty(_defineProperty2, FINISHED, {
5621
5706
  init: function init() {
5622
5707
  this.removeOnAudioProcess();
5623
5708
  this.fireEvent('finish');
@@ -5628,7 +5713,8 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5628
5713
  getCurrentTime: function getCurrentTime() {
5629
5714
  return this.getDuration();
5630
5715
  }
5631
- }), _this$stateBehaviors);
5716
+ }), _defineProperty2));
5717
+
5632
5718
  _this.params = params;
5633
5719
  /** ac: Audio Context instance */
5634
5720
 
@@ -6415,8 +6501,10 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
6415
6501
  return WebAudio;
6416
6502
  }(util.Observer);
6417
6503
 
6418
- exports.default = WebAudio;
6419
- WebAudio.scriptBufferSize = 256;
6504
+ exports["default"] = WebAudio;
6505
+
6506
+ _defineProperty(WebAudio, "scriptBufferSize", 256);
6507
+
6420
6508
  module.exports = exports.default;
6421
6509
 
6422
6510
  /***/ }),