wavesurfer.js 6.6.2 → 6.6.3

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 (32) hide show
  1. package/README.md +1 -1
  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 +12 -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/webaudio.js +9 -26
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wavesurfer.js 6.6.2 (2023-03-26)
2
+ * wavesurfer.js 6.6.3 (2023-04-04)
3
3
  * https://wavesurfer-js.org
4
4
  * @license BSD-3-Clause
5
5
  */
@@ -5181,7 +5181,7 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
5181
5181
  return WaveSurfer;
5182
5182
  }(util.Observer);
5183
5183
  exports["default"] = WaveSurfer;
5184
- _defineProperty(WaveSurfer, "VERSION", "6.6.2");
5184
+ _defineProperty(WaveSurfer, "VERSION", "6.6.3");
5185
5185
  /**
5186
5186
  * Functions in the `util` property are available as a static property of the
5187
5187
  * WaveSurfer class
@@ -5233,7 +5233,7 @@ var FINISHED = 'finished';
5233
5233
  /**
5234
5234
  * WebAudio backend
5235
5235
  *
5236
- * @extends {Observer}
5236
+ * @extends {util.Observer}
5237
5237
  */
5238
5238
  var WebAudio = /*#__PURE__*/function (_util$Observer) {
5239
5239
  _inherits(WebAudio, _util$Observer);
@@ -5252,8 +5252,6 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5252
5252
  /** audioContext: allows to process audio with WebAudio API */
5253
5253
  _defineProperty(_assertThisInitialized(_this), "audioContext", null);
5254
5254
  /** @private */
5255
- _defineProperty(_assertThisInitialized(_this), "offlineAudioContext", null);
5256
- /** @private */
5257
5255
  _defineProperty(_assertThisInitialized(_this), "stateBehaviors", (_defineProperty2 = {}, _defineProperty(_defineProperty2, PLAYING, {
5258
5256
  init: function init() {
5259
5257
  this.addOnAudioProcess();
@@ -5266,9 +5264,7 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5266
5264
  return this.startPosition + this.getPlayedTime();
5267
5265
  }
5268
5266
  }), _defineProperty(_defineProperty2, PAUSED, {
5269
- init: function init() {
5270
- this.removeOnAudioProcess();
5271
- },
5267
+ init: function init() {},
5272
5268
  getPlayedPercents: function getPlayedPercents() {
5273
5269
  var duration = this.getDuration();
5274
5270
  return this.getCurrentTime() / duration || 0;
@@ -5278,7 +5274,6 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5278
5274
  }
5279
5275
  }), _defineProperty(_defineProperty2, FINISHED, {
5280
5276
  init: function init() {
5281
- this.removeOnAudioProcess();
5282
5277
  this.fireEvent('finish');
5283
5278
  },
5284
5279
  getPlayedPercents: function getPlayedPercents() {
@@ -5341,7 +5336,7 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5341
5336
  */
5342
5337
  _createClass(WebAudio, [{
5343
5338
  key: "supportsWebAudio",
5344
- value: /** scriptBufferSize: size of the processing buffer */
5339
+ value:
5345
5340
  /**
5346
5341
  * Does the browser support this backend
5347
5342
  *
@@ -5467,14 +5462,8 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5467
5462
  value: function createScriptNode() {
5468
5463
  if (this.params.audioScriptProcessor) {
5469
5464
  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
- }
5465
+ this.scriptNode.connect(this.ac.destination);
5476
5466
  }
5477
- this.scriptNode.connect(this.ac.destination);
5478
5467
  }
5479
5468
 
5480
5469
  /** @private */
@@ -5482,25 +5471,21 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5482
5471
  key: "addOnAudioProcess",
5483
5472
  value: function addOnAudioProcess() {
5484
5473
  var _this2 = this;
5485
- this.scriptNode.onaudioprocess = function () {
5474
+ var loop = function loop() {
5486
5475
  var time = _this2.getCurrentTime();
5487
- if (time >= _this2.getDuration()) {
5476
+ if (time >= _this2.getDuration() && _this2.state !== _this2.states[FINISHED]) {
5488
5477
  _this2.setState(FINISHED);
5489
5478
  _this2.fireEvent('pause');
5490
- } else if (time >= _this2.scheduledPause) {
5479
+ } else if (time >= _this2.scheduledPause && _this2.state !== _this2.states[PAUSED]) {
5491
5480
  _this2.pause();
5492
5481
  } else if (_this2.state === _this2.states[PLAYING]) {
5493
5482
  _this2.fireEvent('audioprocess', time);
5483
+ util.frame(loop)();
5494
5484
  }
5495
5485
  };
5486
+ loop();
5496
5487
  }
5497
5488
 
5498
- /** @private */
5499
- }, {
5500
- key: "removeOnAudioProcess",
5501
- value: function removeOnAudioProcess() {
5502
- this.scriptNode.onaudioprocess = null;
5503
- }
5504
5489
  /** Create analyser node to perform audio analysis */
5505
5490
  }, {
5506
5491
  key: "createAnalyserNode",
@@ -5761,7 +5746,7 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5761
5746
  this.disconnectFilters();
5762
5747
  this.disconnectSource();
5763
5748
  this.gainNode.disconnect();
5764
- this.scriptNode.disconnect();
5749
+ this.scriptNode && this.scriptNode.disconnect();
5765
5750
  this.analyser.disconnect();
5766
5751
 
5767
5752
  // close the audioContext if closeAudioContext option is set to true
@@ -6020,7 +6005,6 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
6020
6005
  return WebAudio;
6021
6006
  }(util.Observer);
6022
6007
  exports["default"] = WebAudio;
6023
- _defineProperty(WebAudio, "scriptBufferSize", 256);
6024
6008
  module.exports = exports.default;
6025
6009
 
6026
6010
  /***/ }),