wavesurfer.js 6.0.4 → 6.1.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 (37) hide show
  1. package/CHANGES.md +8 -0
  2. package/README.md +1 -1
  3. package/dist/plugin/wavesurfer.cursor.js +1 -1
  4. package/dist/plugin/wavesurfer.cursor.min.js +1 -1
  5. package/dist/plugin/wavesurfer.elan.js +1 -1
  6. package/dist/plugin/wavesurfer.elan.min.js +1 -1
  7. package/dist/plugin/wavesurfer.markers.js +1 -1
  8. package/dist/plugin/wavesurfer.markers.min.js +1 -1
  9. package/dist/plugin/wavesurfer.mediasession.js +1 -3
  10. package/dist/plugin/wavesurfer.mediasession.js.map +1 -1
  11. package/dist/plugin/wavesurfer.mediasession.min.js +1 -1
  12. package/dist/plugin/wavesurfer.mediasession.min.js.map +1 -1
  13. package/dist/plugin/wavesurfer.microphone.js +1 -1
  14. package/dist/plugin/wavesurfer.microphone.min.js +1 -1
  15. package/dist/plugin/wavesurfer.minimap.js +24 -4
  16. package/dist/plugin/wavesurfer.minimap.js.map +1 -1
  17. package/dist/plugin/wavesurfer.minimap.min.js +2 -2
  18. package/dist/plugin/wavesurfer.minimap.min.js.map +1 -1
  19. package/dist/plugin/wavesurfer.playhead.js +1 -1
  20. package/dist/plugin/wavesurfer.playhead.min.js +1 -1
  21. package/dist/plugin/wavesurfer.regions.js +1 -1
  22. package/dist/plugin/wavesurfer.regions.min.js +1 -1
  23. package/dist/plugin/wavesurfer.spectrogram.js +1 -1
  24. package/dist/plugin/wavesurfer.spectrogram.min.js +1 -1
  25. package/dist/plugin/wavesurfer.timeline.js +1 -1
  26. package/dist/plugin/wavesurfer.timeline.min.js +1 -1
  27. package/dist/wavesurfer-html-init.js +1 -1
  28. package/dist/wavesurfer-html-init.min.js +1 -1
  29. package/dist/wavesurfer.js +33 -10
  30. package/dist/wavesurfer.js.map +1 -1
  31. package/dist/wavesurfer.min.js +2 -2
  32. package/dist/wavesurfer.min.js.map +1 -1
  33. package/package.json +7 -7
  34. package/src/plugin/mediasession/index.js +0 -2
  35. package/src/plugin/minimap/index.js +17 -2
  36. package/src/wavesurfer.js +4 -1
  37. package/src/webaudio.js +24 -7
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wavesurfer.js regions plugin 6.0.4 (2022-03-08)
2
+ * wavesurfer.js regions plugin 6.1.0 (2022-03-31)
3
3
  * https://wavesurfer-js.org
4
4
  * @license BSD-3-Clause
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wavesurfer.js regions plugin 6.0.4 (2022-03-08)
2
+ * wavesurfer.js regions plugin 6.1.0 (2022-03-31)
3
3
  * https://wavesurfer-js.org
4
4
  * @license BSD-3-Clause
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wavesurfer.js spectrogram plugin 6.0.4 (2022-03-08)
2
+ * wavesurfer.js spectrogram plugin 6.1.0 (2022-03-31)
3
3
  * https://wavesurfer-js.org
4
4
  * @license BSD-3-Clause
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wavesurfer.js spectrogram plugin 6.0.4 (2022-03-08)
2
+ * wavesurfer.js spectrogram plugin 6.1.0 (2022-03-31)
3
3
  * https://wavesurfer-js.org
4
4
  * @license BSD-3-Clause
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wavesurfer.js timeline plugin 6.0.4 (2022-03-08)
2
+ * wavesurfer.js timeline plugin 6.1.0 (2022-03-31)
3
3
  * https://wavesurfer-js.org
4
4
  * @license BSD-3-Clause
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wavesurfer.js timeline plugin 6.0.4 (2022-03-08)
2
+ * wavesurfer.js timeline plugin 6.1.0 (2022-03-31)
3
3
  * https://wavesurfer-js.org
4
4
  * @license BSD-3-Clause
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wavesurfer.js 6.0.4 (2022-03-08)
2
+ * wavesurfer.js 6.1.0 (2022-03-31)
3
3
  * https://wavesurfer-js.org
4
4
  * @license BSD-3-Clause
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wavesurfer.js 6.0.4 (2022-03-08)
2
+ * wavesurfer.js 6.1.0 (2022-03-31)
3
3
  * https://wavesurfer-js.org
4
4
  * @license BSD-3-Clause
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wavesurfer.js 6.0.4 (2022-03-08)
2
+ * wavesurfer.js 6.1.0 (2022-03-31)
3
3
  * https://wavesurfer-js.org
4
4
  * @license BSD-3-Clause
5
5
  */
@@ -4149,7 +4149,10 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
4149
4149
  if (prevWidth != _this.drawer.wrapper.clientWidth && !_this.params.scrollParent) {
4150
4150
  prevWidth = _this.drawer.wrapper.clientWidth;
4151
4151
 
4152
- _this.drawer.fireEvent('redraw');
4152
+ if (prevWidth) {
4153
+ // redraw only if waveform container is rendered and has a width
4154
+ _this.drawer.fireEvent('redraw');
4155
+ }
4153
4156
  }
4154
4157
  }, typeof _this.params.responsive === 'number' ? _this.params.responsive : 100);
4155
4158
  return _possibleConstructorReturn(_this, _assertThisInitialized(_this));
@@ -5597,7 +5600,7 @@ var WaveSurfer = /*#__PURE__*/function (_util$Observer) {
5597
5600
 
5598
5601
  exports["default"] = WaveSurfer;
5599
5602
 
5600
- _defineProperty(WaveSurfer, "VERSION", "6.0.4");
5603
+ _defineProperty(WaveSurfer, "VERSION", "6.1.0");
5601
5604
 
5602
5605
  _defineProperty(WaveSurfer, "util", util);
5603
5606
 
@@ -5773,6 +5776,12 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
5773
5776
  /** @private */
5774
5777
 
5775
5778
  _this.explicitDuration = params.duration;
5779
+ /** @private */
5780
+
5781
+ _this.sinkStreamDestination = null;
5782
+ /** @private */
5783
+
5784
+ _this.sinkAudioElement = null;
5776
5785
  /**
5777
5786
  * Boolean indicating if the backend was destroyed.
5778
5787
  */
@@ -6003,18 +6012,24 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
6003
6012
  * output. Here we create an HTMLAudioElement, connect the
6004
6013
  * webaudio stream to that element and setSinkId there.
6005
6014
  */
6006
- var audio = new window.Audio();
6015
+ if (!this.sinkAudioElement) {
6016
+ this.sinkAudioElement = new window.Audio(); // autoplay is necessary since we're not invoking .play()
6007
6017
 
6008
- if (!audio.setSinkId) {
6018
+ this.sinkAudioElement.autoplay = true;
6019
+ }
6020
+
6021
+ if (!this.sinkAudioElement.setSinkId) {
6009
6022
  return Promise.reject(new Error('setSinkId is not supported in your browser'));
6010
6023
  }
6011
6024
 
6012
- audio.autoplay = true;
6013
- var dest = this.ac.createMediaStreamDestination();
6025
+ if (!this.sinkStreamDestination) {
6026
+ this.sinkStreamDestination = this.ac.createMediaStreamDestination();
6027
+ }
6028
+
6014
6029
  this.gainNode.disconnect();
6015
- this.gainNode.connect(dest);
6016
- audio.srcObject = dest.stream;
6017
- return audio.setSinkId(deviceId);
6030
+ this.gainNode.connect(this.sinkStreamDestination);
6031
+ this.sinkAudioElement.srcObject = this.sinkStreamDestination.stream;
6032
+ return this.sinkAudioElement.setSinkId(deviceId);
6018
6033
  } else {
6019
6034
  return Promise.reject(new Error('Invalid deviceId: ' + deviceId));
6020
6035
  }
@@ -6261,6 +6276,14 @@ var WebAudio = /*#__PURE__*/function (_util$Observer) {
6261
6276
 
6262
6277
 
6263
6278
  window.WaveSurferOfflineAudioContext = null;
6279
+ } // disconnect resources used by setSinkId
6280
+
6281
+
6282
+ if (this.sinkStreamDestination) {
6283
+ this.sinkAudioElement.pause();
6284
+ this.sinkAudioElement.srcObject = null;
6285
+ this.sinkStreamDestination.disconnect();
6286
+ this.sinkStreamDestination = null;
6264
6287
  }
6265
6288
  }
6266
6289
  /**