wavesurfer.js 6.6.2 → 6.6.4

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 (33) hide show
  1. package/README.md +2 -2
  2. package/dist/plugin/wavesurfer.cursor.js +1 -1
  3. package/dist/plugin/wavesurfer.cursor.min.js +1 -1
  4. package/dist/plugin/wavesurfer.elan.js +1 -1
  5. package/dist/plugin/wavesurfer.elan.min.js +1 -1
  6. package/dist/plugin/wavesurfer.markers.js +12 -3
  7. package/dist/plugin/wavesurfer.markers.js.map +1 -1
  8. package/dist/plugin/wavesurfer.markers.min.js +2 -2
  9. package/dist/plugin/wavesurfer.markers.min.js.map +1 -1
  10. package/dist/plugin/wavesurfer.mediasession.js +1 -1
  11. package/dist/plugin/wavesurfer.mediasession.min.js +1 -1
  12. package/dist/plugin/wavesurfer.microphone.js +1 -1
  13. package/dist/plugin/wavesurfer.microphone.min.js +1 -1
  14. package/dist/plugin/wavesurfer.minimap.js +1 -1
  15. package/dist/plugin/wavesurfer.minimap.min.js +1 -1
  16. package/dist/plugin/wavesurfer.playhead.js +1 -1
  17. package/dist/plugin/wavesurfer.playhead.min.js +1 -1
  18. package/dist/plugin/wavesurfer.regions.js +1 -1
  19. package/dist/plugin/wavesurfer.regions.min.js +1 -1
  20. package/dist/plugin/wavesurfer.spectrogram.js +1 -1
  21. package/dist/plugin/wavesurfer.spectrogram.min.js +1 -1
  22. package/dist/plugin/wavesurfer.timeline.js +1 -1
  23. package/dist/plugin/wavesurfer.timeline.min.js +1 -1
  24. package/dist/wavesurfer-html-init.js +1 -1
  25. package/dist/wavesurfer-html-init.min.js +1 -1
  26. package/dist/wavesurfer.js +17 -28
  27. package/dist/wavesurfer.js.map +1 -1
  28. package/dist/wavesurfer.min.js +2 -2
  29. package/dist/wavesurfer.min.js.map +1 -1
  30. package/package.json +1 -1
  31. package/src/plugin/markers/index.js +9 -2
  32. package/src/wavesurfer.js +6 -0
  33. package/src/webaudio.js +9 -26
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wavesurfer.js 6.6.2 (2023-03-26)
2
+ * wavesurfer.js 6.6.4 (2023-06-10)
3
3
  * https://wavesurfer-js.org
4
4
  * @license BSD-3-Clause
5
5
  */
@@ -4018,6 +4018,11 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
4018
4018
  }
4019
4019
  _this5.fireEvent('scroll', e);
4020
4020
  });
4021
+
4022
+ // Relay the dblclick event from the drawer
4023
+ this.drawer.on('dblclick', function (e, progress) {
4024
+ _this5.fireEvent('dblclick', e, progress);
4025
+ });
4021
4026
  }
4022
4027
 
4023
4028
  /**
@@ -5181,7 +5186,7 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
5181
5186
  return WaveSurfer;
5182
5187
  }(util.Observer);
5183
5188
  exports["default"] = WaveSurfer;
5184
- _defineProperty(WaveSurfer, "VERSION", "6.6.2");
5189
+ _defineProperty(WaveSurfer, "VERSION", "6.6.4");
5185
5190
  /**
5186
5191
  * Functions in the `util` property are available as a static property of the
5187
5192
  * WaveSurfer class
@@ -5233,7 +5238,7 @@ var FINISHED = 'finished';
5233
5238
  /**
5234
5239
  * WebAudio backend
5235
5240
  *
5236
- * @extends {Observer}
5241
+ * @extends {util.Observer}
5237
5242
  */
5238
5243
  var WebAudio = /*#__PURE__*/function (_util$Observer) {
5239
5244
  _inherits(WebAudio, _util$Observer);
@@ -5252,8 +5257,6 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5252
5257
  /** audioContext: allows to process audio with WebAudio API */
5253
5258
  _defineProperty(_assertThisInitialized(_this), "audioContext", null);
5254
5259
  /** @private */
5255
- _defineProperty(_assertThisInitialized(_this), "offlineAudioContext", null);
5256
- /** @private */
5257
5260
  _defineProperty(_assertThisInitialized(_this), "stateBehaviors", (_defineProperty2 = {}, _defineProperty(_defineProperty2, PLAYING, {
5258
5261
  init: function init() {
5259
5262
  this.addOnAudioProcess();
@@ -5266,9 +5269,7 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5266
5269
  return this.startPosition + this.getPlayedTime();
5267
5270
  }
5268
5271
  }), _defineProperty(_defineProperty2, PAUSED, {
5269
- init: function init() {
5270
- this.removeOnAudioProcess();
5271
- },
5272
+ init: function init() {},
5272
5273
  getPlayedPercents: function getPlayedPercents() {
5273
5274
  var duration = this.getDuration();
5274
5275
  return this.getCurrentTime() / duration || 0;
@@ -5278,7 +5279,6 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5278
5279
  }
5279
5280
  }), _defineProperty(_defineProperty2, FINISHED, {
5280
5281
  init: function init() {
5281
- this.removeOnAudioProcess();
5282
5282
  this.fireEvent('finish');
5283
5283
  },
5284
5284
  getPlayedPercents: function getPlayedPercents() {
@@ -5341,7 +5341,7 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5341
5341
  */
5342
5342
  _createClass(WebAudio, [{
5343
5343
  key: "supportsWebAudio",
5344
- value: /** scriptBufferSize: size of the processing buffer */
5344
+ value:
5345
5345
  /**
5346
5346
  * Does the browser support this backend
5347
5347
  *
@@ -5467,14 +5467,8 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5467
5467
  value: function createScriptNode() {
5468
5468
  if (this.params.audioScriptProcessor) {
5469
5469
  this.scriptNode = this.params.audioScriptProcessor;
5470
- } else {
5471
- if (this.ac.createScriptProcessor) {
5472
- this.scriptNode = this.ac.createScriptProcessor(WebAudio.scriptBufferSize);
5473
- } else {
5474
- this.scriptNode = this.ac.createJavaScriptNode(WebAudio.scriptBufferSize);
5475
- }
5470
+ this.scriptNode.connect(this.ac.destination);
5476
5471
  }
5477
- this.scriptNode.connect(this.ac.destination);
5478
5472
  }
5479
5473
 
5480
5474
  /** @private */
@@ -5482,25 +5476,21 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5482
5476
  key: "addOnAudioProcess",
5483
5477
  value: function addOnAudioProcess() {
5484
5478
  var _this2 = this;
5485
- this.scriptNode.onaudioprocess = function () {
5479
+ var loop = function loop() {
5486
5480
  var time = _this2.getCurrentTime();
5487
- if (time >= _this2.getDuration()) {
5481
+ if (time >= _this2.getDuration() && _this2.state !== _this2.states[FINISHED]) {
5488
5482
  _this2.setState(FINISHED);
5489
5483
  _this2.fireEvent('pause');
5490
- } else if (time >= _this2.scheduledPause) {
5484
+ } else if (time >= _this2.scheduledPause && _this2.state !== _this2.states[PAUSED]) {
5491
5485
  _this2.pause();
5492
5486
  } else if (_this2.state === _this2.states[PLAYING]) {
5493
5487
  _this2.fireEvent('audioprocess', time);
5488
+ util.frame(loop)();
5494
5489
  }
5495
5490
  };
5491
+ loop();
5496
5492
  }
5497
5493
 
5498
- /** @private */
5499
- }, {
5500
- key: "removeOnAudioProcess",
5501
- value: function removeOnAudioProcess() {
5502
- this.scriptNode.onaudioprocess = null;
5503
- }
5504
5494
  /** Create analyser node to perform audio analysis */
5505
5495
  }, {
5506
5496
  key: "createAnalyserNode",
@@ -5761,7 +5751,7 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5761
5751
  this.disconnectFilters();
5762
5752
  this.disconnectSource();
5763
5753
  this.gainNode.disconnect();
5764
- this.scriptNode.disconnect();
5754
+ this.scriptNode && this.scriptNode.disconnect();
5765
5755
  this.analyser.disconnect();
5766
5756
 
5767
5757
  // close the audioContext if closeAudioContext option is set to true
@@ -6020,7 +6010,6 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
6020
6010
  return WebAudio;
6021
6011
  }(util.Observer);
6022
6012
  exports["default"] = WebAudio;
6023
- _defineProperty(WebAudio, "scriptBufferSize", 256);
6024
6013
  module.exports = exports.default;
6025
6014
 
6026
6015
  /***/ }),