wavesurfer.js 6.0.2 → 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 (46) hide show
  1. package/CHANGES.md +22 -0
  2. package/README.md +1 -1
  3. package/dist/plugin/wavesurfer.cursor.js +5 -5
  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 +1 -1
  8. package/dist/plugin/wavesurfer.elan.min.js +1 -1
  9. package/dist/plugin/wavesurfer.markers.js +1 -1
  10. package/dist/plugin/wavesurfer.markers.min.js +1 -1
  11. package/dist/plugin/wavesurfer.mediasession.js +1 -3
  12. package/dist/plugin/wavesurfer.mediasession.js.map +1 -1
  13. package/dist/plugin/wavesurfer.mediasession.min.js +1 -1
  14. package/dist/plugin/wavesurfer.mediasession.min.js.map +1 -1
  15. package/dist/plugin/wavesurfer.microphone.js +1 -1
  16. package/dist/plugin/wavesurfer.microphone.min.js +1 -1
  17. package/dist/plugin/wavesurfer.minimap.js +24 -4
  18. package/dist/plugin/wavesurfer.minimap.js.map +1 -1
  19. package/dist/plugin/wavesurfer.minimap.min.js +2 -2
  20. package/dist/plugin/wavesurfer.minimap.min.js.map +1 -1
  21. package/dist/plugin/wavesurfer.playhead.js +1 -1
  22. package/dist/plugin/wavesurfer.playhead.min.js +1 -1
  23. package/dist/plugin/wavesurfer.regions.js +1 -1
  24. package/dist/plugin/wavesurfer.regions.min.js +1 -1
  25. package/dist/plugin/wavesurfer.spectrogram.js +28 -9
  26. package/dist/plugin/wavesurfer.spectrogram.js.map +1 -1
  27. package/dist/plugin/wavesurfer.spectrogram.min.js +2 -2
  28. package/dist/plugin/wavesurfer.spectrogram.min.js.map +1 -1
  29. package/dist/plugin/wavesurfer.timeline.js +5 -3
  30. package/dist/plugin/wavesurfer.timeline.js.map +1 -1
  31. package/dist/plugin/wavesurfer.timeline.min.js +2 -2
  32. package/dist/plugin/wavesurfer.timeline.min.js.map +1 -1
  33. package/dist/wavesurfer-html-init.js +1 -1
  34. package/dist/wavesurfer-html-init.min.js +1 -1
  35. package/dist/wavesurfer.js +33 -10
  36. package/dist/wavesurfer.js.map +1 -1
  37. package/dist/wavesurfer.min.js +2 -2
  38. package/dist/wavesurfer.min.js.map +1 -1
  39. package/package.json +10 -10
  40. package/src/plugin/cursor/index.js +4 -4
  41. package/src/plugin/mediasession/index.js +0 -2
  42. package/src/plugin/minimap/index.js +17 -2
  43. package/src/plugin/spectrogram/index.js +23 -10
  44. package/src/plugin/timeline/index.js +7 -1
  45. package/src/wavesurfer.js +4 -1
  46. package/src/webaudio.js +24 -7
package/CHANGES.md CHANGED
@@ -1,6 +1,28 @@
1
1
  wavesurfer.js changelog
2
2
  =======================
3
3
 
4
+ 6.1.0 (31.03.2022)
5
+ ------------------
6
+ - Fix many calls to `setSinkId` resulting in no sound (#2481)
7
+ - Optimize responsive resize to avoid unnecessarily firing redraw on unpainted waveforms (#2485)
8
+ - Minimap plugin:
9
+ - Remove waveform of previous audio when starting to load new audio (#2479)
10
+ - Changed regions function name to resolve ambiguities (#2482)
11
+
12
+ 6.0.4 (09.03.2022)
13
+ ------------------
14
+ - Spectrogram plugin:
15
+ - Add `frequencyMin`, `frequencyMax` option to scale frequency axis.
16
+ And set default 12kHz range to draw spectrogram like 5.x (#2455)
17
+ - Timeline plugin:
18
+ - Fix rendering issue for negative `offset` values (#2463)
19
+
20
+ 6.0.3 (01.03.2022)
21
+ ------------------
22
+ - Cursor plugin:
23
+ - Fix type documentation for `followCursorY` and `opacity` options (#2459)
24
+ - Fix destroying cursor and showTime dom nodes (#2460)
25
+
4
26
  6.0.2 (20.02.2022)
5
27
  ------------------
6
28
  - Fix regression and restore support for passing a `CanvasGradient` to
package/README.md CHANGED
@@ -22,7 +22,7 @@ The proceeds will go to the author and the current maintainer.
22
22
  ## Browser support
23
23
  wavesurfer.js works only in [modern browsers supporting Web Audio](http://caniuse.com/audio-api).
24
24
 
25
- It will fallback to Audio Element without graphics in other browsers (IE 11 and lower). You can also try [wavesurfer.swf](https://github.com/laurentvd/wavesurfer.swf) which is a Flash-based fallback.
25
+ It will fallback to Audio Element without graphics in other browsers (IE 11 and lower).
26
26
 
27
27
  ## FAQ
28
28
  ### Can the audio start playing before the waveform is drawn?
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wavesurfer.js cursor plugin 6.0.2 (2022-02-20)
2
+ * wavesurfer.js cursor plugin 6.1.0 (2022-03-31)
3
3
  * https://wavesurfer-js.org
4
4
  * @license BSD-3-Clause
5
5
  */
@@ -45,7 +45,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
45
45
  * waveform
46
46
  * @property {string} width='1px' The width of the cursor
47
47
  * @property {string} color='black' The color of the cursor
48
- * @property {string} opacity='0.25' The opacity of the cursor
48
+ * @property {number|string} opacity='0.25' The opacity of the cursor
49
49
  * @property {string} style='solid' The border style of the cursor
50
50
  * @property {number} zIndex=3 The z-index of the cursor element
51
51
  * @property {object} customStyle An object with custom styles which are applied
@@ -53,7 +53,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
53
53
  * @property {boolean} showTime=false Show the time on the cursor.
54
54
  * @property {object} customShowTimeStyle An object with custom styles which are
55
55
  * applied to the cursor time element.
56
- * @property {string} followCursorY=false Use `true` to make the time on
56
+ * @property {boolean} followCursorY=false Use `true` to make the time on
57
57
  * the cursor follow the x and the y-position of the mouse. Use `false` to make the
58
58
  * it only follow the x-position of the mouse.
59
59
  * @property {function} formatTimeCallback Formats the timestamp on the cursor.
@@ -244,10 +244,10 @@ var CursorPlugin = /*#__PURE__*/function () {
244
244
  key: "destroy",
245
245
  value: function destroy() {
246
246
  if (this.params.showTime) {
247
- this.cursor.parentNode.removeChild(this.showTime);
247
+ this.showTime.remove();
248
248
  }
249
249
 
250
- this.cursor.parentNode.removeChild(this.cursor);
250
+ this.cursor.remove();
251
251
  this.wrapper.removeEventListener('mousemove', this._onMousemove);
252
252
 
253
253
  if (this.params.hideOnBlur) {
@@ -1 +1 @@
1
- {"version":3,"file":"wavesurfer.cursor.js","mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C,CAAC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACqBA;AAkEjB;AACJ;AACA;AACA;AACA;AACA;AACA;AACI,wBAAYC,MAAZ,EAAoBC,EAApB,EAAwB;AAAA;;AAAA;;AAAA,2CAjDR;AACZC,MAAAA,UAAU,EAAE,IADA;AAEZC,MAAAA,KAAK,EAAE,KAFK;AAGZC,MAAAA,KAAK,EAAE,OAHK;AAIZC,MAAAA,OAAO,EAAE,MAJG;AAKZC,MAAAA,KAAK,EAAE,OALK;AAMZC,MAAAA,MAAM,EAAE,CANI;AAOZC,MAAAA,WAAW,EAAE,EAPD;AAQZC,MAAAA,mBAAmB,EAAE,EART;AASZC,MAAAA,QAAQ,EAAE,KATE;AAUZC,MAAAA,aAAa,EAAE,KAVH;AAWZC,MAAAA,kBAAkB,EAAE;AAXR,KAiDQ;;AAAA,0CAhCT,UAAAC,CAAC,EAAI;AAChB,UAAMC,KAAK,GAAG,KAAI,CAACC,IAAL,CAAUC,eAAV,CAA0BH,CAA1B,EAA6B,KAAI,CAACI,UAAL,CAAgBjB,MAAhB,CAAuBkB,QAApD,CAAd;;AACA,UAAMC,IAAI,GAAG,KAAI,CAACC,OAAL,CAAaC,qBAAb,EAAb;;AACA,UAAIC,CAAC,GAAG,CAAR;AACA,UAAIC,CAAC,GAA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ACA;UACA","sources":["webpack://WaveSurfer.[name]/webpack/universalModuleDefinition","webpack://WaveSurfer.[name]/./src/plugin/cursor/index.js","webpack://WaveSurfer.[name]/webpack/bootstrap","webpack://WaveSurfer.[name]/webpack/before-startup","webpack://WaveSurfer.[name]/webpack/startup","webpack://WaveSurfer.[name]/webpack/after-startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"cursor\"] = factory();\n})(self, function() {\nreturn ","/**\n * @typedef {Object} CursorPluginParams\n * @property {?boolean} deferInit Set to true to stop auto init in `addPlugin()`\n * @property {boolean} hideOnBlur=true Hide the cursor when the mouse leaves the\n * waveform\n * @property {string} width='1px' The width of the cursor\n * @property {string} color='black' The color of the cursor\n * @property {string} opacity='0.25' The opacity of the cursor\n * @property {string} style='solid' The border style of the cursor\n * @property {number} zIndex=3 The z-index of the cursor element\n * @property {object} customStyle An object with custom styles which are applied\n * to the cursor element\n * @property {boolean} showTime=false Show the time on the cursor.\n * @property {object} customShowTimeStyle An object with custom styles which are\n * applied to the cursor time element.\n * @property {string} followCursorY=false Use `true` to make the time on\n * the cursor follow the x and the y-position of the mouse. Use `false` to make the\n * it only follow the x-position of the mouse.\n * @property {function} formatTimeCallback Formats the timestamp on the cursor.\n */\n\n/**\n * Displays a thin line at the position of the cursor on the waveform.\n *\n * @implements {PluginClass}\n * @extends {Observer}\n * @example\n * // es6\n * import CursorPlugin from 'wavesurfer.cursor.js';\n *\n * // commonjs\n * var CursorPlugin = require('wavesurfer.cursor.js');\n *\n * // if you are using <script> tags\n * var CursorPlugin = window.WaveSurfer.cursor;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * CursorPlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\nexport default class CursorPlugin {\n /**\n * Cursor plugin definition factory\n *\n * This function must be used to create a plugin definition which can be\n * used by wavesurfer to correctly instantiate the plugin.\n *\n * @param {CursorPluginParams} params parameters use to initialise the\n * plugin\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'cursor',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n staticProps: {},\n instance: CursorPlugin\n };\n }\n\n /**\n * @type {CursorPluginParams}\n */\n defaultParams = {\n hideOnBlur: true,\n width: '1px',\n color: 'black',\n opacity: '0.25',\n style: 'solid',\n zIndex: 4,\n customStyle: {},\n customShowTimeStyle: {},\n showTime: false,\n followCursorY: false,\n formatTimeCallback: null\n };\n\n /**\n * @param {object} e Mouse move event\n */\n _onMousemove = e => {\n const event = this.util.withOrientation(e, this.wavesurfer.params.vertical);\n const bbox = this.wrapper.getBoundingClientRect();\n let y = 0;\n let x = this.wrapper.scrollLeft + event.clientX - bbox.left;\n let flip = bbox.right < event.clientX + this.displayTime.getBoundingClientRect().width;\n\n if (this.params.showTime && this.params.followCursorY) {\n // follow y-position of the mouse\n y = event.clientY - (bbox.top + bbox.height / 2);\n }\n\n this.updateCursorPosition(x, y, flip);\n };\n\n /**\n * @returns {void}\n */\n _onMouseenter = () => this.showCursor();\n\n /**\n * @returns {void}\n */\n _onMouseleave = () => this.hideCursor();\n\n /**\n * Construct the plugin class. You probably want to use `CursorPlugin.create`\n * instead.\n *\n * @param {CursorPluginParams} params Plugin parameters\n * @param {object} ws Wavesurfer instance\n */\n constructor(params, ws) {\n this.wavesurfer = ws;\n this.style = ws.util.style;\n this.util = ws.util;\n /**\n * The cursor HTML element\n *\n * @type {?HTMLElement}\n */\n this.cursor = null;\n /**\n * displays the time next to the cursor\n *\n * @type {?HTMLElement}\n */\n this.showTime = null;\n /**\n * The html container that will display the time\n *\n * @type {?HTMLElement}\n */\n this.displayTime = null;\n\n this.params = Object.assign({}, this.defaultParams, params);\n }\n\n _onReady() {\n this.wrapper = this.wavesurfer.drawer.wrapper;\n this.cursor = this.util.withOrientation(this.wrapper.appendChild(\n document.createElement('cursor'),\n ), this.wavesurfer.params.vertical);\n\n this.style(this.cursor,\n Object.assign(\n {\n position: 'absolute',\n zIndex: this.params.zIndex,\n left: 0,\n top: 0,\n bottom: 0,\n width: '0',\n display: 'flex',\n borderRightStyle: this.params.style,\n borderRightWidth: this.params.width,\n borderRightColor: this.params.color,\n opacity: this.params.opacity,\n pointerEvents: 'none'\n },\n this.params.customStyle\n )\n );\n\n if (this.params.showTime) {\n this.showTime = this.util.withOrientation(this.wrapper.appendChild(\n document.createElement('showTitle')\n ), this.wavesurfer.params.vertical);\n this.style(\n this.showTime,\n Object.assign(\n {\n position: 'absolute',\n zIndex: this.params.zIndex,\n left: 0,\n top: 0,\n bottom: 0,\n width: 'auto',\n display: 'flex',\n opacity: this.params.opacity,\n pointerEvents: 'none',\n height: '100%'\n },\n this.params.customStyle\n )\n );\n\n this.displayTime = this.util.withOrientation(this.showTime.appendChild(\n document.createElement('div'),\n ), this.wavesurfer.params.vertical);\n\n this.style(this.displayTime,\n Object.assign(\n {\n display: 'inline',\n pointerEvents: 'none',\n margin: 'auto',\n visibility: 'hidden' // initial value will be hidden just for measuring purpose\n },\n this.params.customShowTimeStyle\n )\n );\n\n // initial value to measure display width\n this.displayTime.innerHTML = this.formatTime(0);\n }\n\n this.wrapper.addEventListener('mousemove', this._onMousemove);\n if (this.params.hideOnBlur) {\n // ensure elements are hidden initially\n this.hideCursor();\n this.wrapper.addEventListener('mouseenter', this._onMouseenter);\n this.wrapper.addEventListener('mouseleave', this._onMouseleave);\n }\n }\n\n /**\n * Initialise the plugin (used by the Plugin API)\n */\n init() {\n if (this.wavesurfer.isReady) {\n this._onReady();\n } else {\n this.wavesurfer.once('ready', () => this._onReady());\n }\n }\n\n /**\n * Destroy the plugin (used by the Plugin API)\n */\n destroy() {\n if (this.params.showTime) {\n this.cursor.parentNode.removeChild(this.showTime);\n }\n this.cursor.parentNode.removeChild(this.cursor);\n this.wrapper.removeEventListener('mousemove', this._onMousemove);\n if (this.params.hideOnBlur) {\n this.wrapper.removeEventListener('mouseenter', this._onMouseenter);\n this.wrapper.removeEventListener('mouseleave', this._onMouseleave);\n }\n }\n\n /**\n * Update the cursor position\n *\n * @param {number} xpos The x offset of the cursor in pixels\n * @param {number} ypos The y offset of the cursor in pixels\n * @param {boolean} flip Flag to flip duration text from right to left\n */\n updateCursorPosition(xpos, ypos, flip = false) {\n this.style(this.cursor, {\n left: `${xpos}px`\n });\n if (this.params.showTime) {\n const duration = this.wavesurfer.getDuration();\n const elementWidth =\n this.wavesurfer.drawer.width /\n this.wavesurfer.params.pixelRatio;\n const scrollWidth = this.wavesurfer.drawer.getScrollX();\n\n const scrollTime =\n (duration / this.wavesurfer.drawer.width) * scrollWidth;\n\n const timeValue =\n Math.max(0, ((xpos - this.wrapper.scrollLeft) / elementWidth) * duration) + scrollTime;\n const formatValue = this.formatTime(timeValue);\n if (flip) {\n const textOffset = this.displayTime.getBoundingClientRect().width;\n xpos -= textOffset;\n }\n this.style(this.showTime, {\n left: `${xpos}px`,\n top: `${ypos}px`\n });\n this.style(this.displayTime, {\n visibility: 'visible'\n });\n this.displayTime.innerHTML = `${formatValue}`;\n }\n }\n\n /**\n * Show the cursor\n */\n showCursor() {\n this.style(this.cursor, {\n display: 'flex'\n });\n if (this.params.showTime) {\n this.style(this.showTime, {\n display: 'flex'\n });\n }\n }\n\n /**\n * Hide the cursor\n */\n hideCursor() {\n this.style(this.cursor, {\n display: 'none'\n });\n if (this.params.showTime) {\n this.style(this.showTime, {\n display: 'none'\n });\n }\n }\n\n /**\n * Format the timestamp for `cursorTime`.\n *\n * @param {number} cursorTime Time in seconds\n * @returns {string} Formatted timestamp\n */\n formatTime(cursorTime) {\n cursorTime = isNaN(cursorTime) ? 0 : cursorTime;\n\n if (this.params.formatTimeCallback) {\n return this.params.formatTimeCallback(cursorTime);\n }\n return [cursorTime].map(time =>\n [\n Math.floor((time % 3600) / 60), // minutes\n ('00' + Math.floor(time % 60)).slice(-2), // seconds\n ('000' + Math.floor((time % 1) * 1000)).slice(-3) // milliseconds\n ].join(':')\n );\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./src/plugin/cursor/index.js\");\n",""],"names":["CursorPlugin","params","ws","hideOnBlur","width","color","opacity","style","zIndex","customStyle","customShowTimeStyle","showTime","followCursorY","formatTimeCallback","e","event","util","withOrientation","wavesurfer","vertical","bbox","wrapper","getBoundingClientRect","y","x","scrollLeft","clientX","left","flip","right","displayTime","clientY","top","height","updateCursorPosition","showCursor","hideCursor","cursor","Object","assign","defaultParams","drawer","appendChild","document","createElement","position","bottom","display","borderRightStyle","borderRightWidth","borderRightColor","pointerEvents","margin","visibility","innerHTML","formatTime","addEventListener","_onMousemove","_onMouseenter","_onMouseleave","isReady","_onReady","once","parentNode","removeChild","removeEventListener","xpos","ypos","duration","getDuration","elementWidth","pixelRatio","scrollWidth","getScrollX","scrollTime","timeValue","Math","max","formatValue","textOffset","cursorTime","isNaN","map","time","floor","slice","join","name","deferInit","staticProps","instance"],"sourceRoot":""}
1
+ {"version":3,"file":"wavesurfer.cursor.js","mappings":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L,CAAYY,kBAAZ,CAA+BkE,UAA/B,CAAP;AACH;;AACD,aAAO,CAACA,UAAD,EAAaE,GAAb,CAAiB,UAAAC,IAAI;AAAA,eACxB,CACIP,IAAI,CAACQ,KAAL,CAAYD,IAAI,GAAG,IAAR,GAAgB,EAA3B,CADJ,EACoC;AAChC,SAAC,OAAOP,IAAI,CAACQ,KAAL,CAAWD,IAAI,GAAG,EAAlB,CAAR,EAA+BE,KAA/B,CAAqC,CAAC,CAAtC,CAFJ,EAE8C;AAC1C,SAAC,QAAQT,IAAI,CAACQ,KAAL,CAAYD,IAAI,GAAG,CAAR,GAAa,IAAxB,CAAT,EAAwCE,KAAxC,CAA8C,CAAC,CAA/C,CAHJ,CAGsD;AAHtD,UAIEC,IAJF,CAIO,GAJP,CADwB;AAAA,OAArB,CAAP;AAOH;;;;AAhSD;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACI,oBAAcpF,MAAd,EAAsB;AAClB,aAAO;AACHqF,QAAAA,IAAI,EAAE,QADH;AAEHC,QAAAA,SAAS,EAAEtF,MAAM,IAAIA,MAAM,CAACsF,SAAjB,GAA6BtF,MAAM,CAACsF,SAApC,GAAgD,KAFxD;AAGHtF,QAAAA,MAAM,EAAEA,MAHL;AAIHuF,QAAAA,WAAW,EAAE,EAJV;AAKHC,QAAAA,QAAQ,EAAEzF;AALP,OAAP;AAOH;AAED;AACJ;AACA;;;;;;;;;;;;;;UCrEA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;UEtBA;UACA;UACA;UACA","sources":["webpack://WaveSurfer.[name]/webpack/universalModuleDefinition","webpack://WaveSurfer.[name]/./src/plugin/cursor/index.js","webpack://WaveSurfer.[name]/webpack/bootstrap","webpack://WaveSurfer.[name]/webpack/before-startup","webpack://WaveSurfer.[name]/webpack/startup","webpack://WaveSurfer.[name]/webpack/after-startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"cursor\"] = factory();\n})(self, function() {\nreturn ","/**\n * @typedef {Object} CursorPluginParams\n * @property {?boolean} deferInit Set to true to stop auto init in `addPlugin()`\n * @property {boolean} hideOnBlur=true Hide the cursor when the mouse leaves the\n * waveform\n * @property {string} width='1px' The width of the cursor\n * @property {string} color='black' The color of the cursor\n * @property {number|string} opacity='0.25' The opacity of the cursor\n * @property {string} style='solid' The border style of the cursor\n * @property {number} zIndex=3 The z-index of the cursor element\n * @property {object} customStyle An object with custom styles which are applied\n * to the cursor element\n * @property {boolean} showTime=false Show the time on the cursor.\n * @property {object} customShowTimeStyle An object with custom styles which are\n * applied to the cursor time element.\n * @property {boolean} followCursorY=false Use `true` to make the time on\n * the cursor follow the x and the y-position of the mouse. Use `false` to make the\n * it only follow the x-position of the mouse.\n * @property {function} formatTimeCallback Formats the timestamp on the cursor.\n */\n\n/**\n * Displays a thin line at the position of the cursor on the waveform.\n *\n * @implements {PluginClass}\n * @extends {Observer}\n * @example\n * // es6\n * import CursorPlugin from 'wavesurfer.cursor.js';\n *\n * // commonjs\n * var CursorPlugin = require('wavesurfer.cursor.js');\n *\n * // if you are using <script> tags\n * var CursorPlugin = window.WaveSurfer.cursor;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * CursorPlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\nexport default class CursorPlugin {\n /**\n * Cursor plugin definition factory\n *\n * This function must be used to create a plugin definition which can be\n * used by wavesurfer to correctly instantiate the plugin.\n *\n * @param {CursorPluginParams} params parameters use to initialise the\n * plugin\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'cursor',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n staticProps: {},\n instance: CursorPlugin\n };\n }\n\n /**\n * @type {CursorPluginParams}\n */\n defaultParams = {\n hideOnBlur: true,\n width: '1px',\n color: 'black',\n opacity: '0.25',\n style: 'solid',\n zIndex: 4,\n customStyle: {},\n customShowTimeStyle: {},\n showTime: false,\n followCursorY: false,\n formatTimeCallback: null\n };\n\n /**\n * @param {object} e Mouse move event\n */\n _onMousemove = e => {\n const event = this.util.withOrientation(e, this.wavesurfer.params.vertical);\n const bbox = this.wrapper.getBoundingClientRect();\n let y = 0;\n let x = this.wrapper.scrollLeft + event.clientX - bbox.left;\n let flip = bbox.right < event.clientX + this.displayTime.getBoundingClientRect().width;\n\n if (this.params.showTime && this.params.followCursorY) {\n // follow y-position of the mouse\n y = event.clientY - (bbox.top + bbox.height / 2);\n }\n\n this.updateCursorPosition(x, y, flip);\n };\n\n /**\n * @returns {void}\n */\n _onMouseenter = () => this.showCursor();\n\n /**\n * @returns {void}\n */\n _onMouseleave = () => this.hideCursor();\n\n /**\n * Construct the plugin class. You probably want to use `CursorPlugin.create`\n * instead.\n *\n * @param {CursorPluginParams} params Plugin parameters\n * @param {object} ws Wavesurfer instance\n */\n constructor(params, ws) {\n this.wavesurfer = ws;\n this.style = ws.util.style;\n this.util = ws.util;\n /**\n * The cursor HTML element\n *\n * @type {?HTMLElement}\n */\n this.cursor = null;\n /**\n * displays the time next to the cursor\n *\n * @type {?HTMLElement}\n */\n this.showTime = null;\n /**\n * The html container that will display the time\n *\n * @type {?HTMLElement}\n */\n this.displayTime = null;\n\n this.params = Object.assign({}, this.defaultParams, params);\n }\n\n _onReady() {\n this.wrapper = this.wavesurfer.drawer.wrapper;\n this.cursor = this.util.withOrientation(this.wrapper.appendChild(\n document.createElement('cursor'),\n ), this.wavesurfer.params.vertical);\n\n this.style(this.cursor,\n Object.assign(\n {\n position: 'absolute',\n zIndex: this.params.zIndex,\n left: 0,\n top: 0,\n bottom: 0,\n width: '0',\n display: 'flex',\n borderRightStyle: this.params.style,\n borderRightWidth: this.params.width,\n borderRightColor: this.params.color,\n opacity: this.params.opacity,\n pointerEvents: 'none'\n },\n this.params.customStyle\n )\n );\n\n if (this.params.showTime) {\n this.showTime = this.util.withOrientation(this.wrapper.appendChild(\n document.createElement('showTitle')\n ), this.wavesurfer.params.vertical);\n this.style(\n this.showTime,\n Object.assign(\n {\n position: 'absolute',\n zIndex: this.params.zIndex,\n left: 0,\n top: 0,\n bottom: 0,\n width: 'auto',\n display: 'flex',\n opacity: this.params.opacity,\n pointerEvents: 'none',\n height: '100%'\n },\n this.params.customStyle\n )\n );\n\n this.displayTime = this.util.withOrientation(this.showTime.appendChild(\n document.createElement('div'),\n ), this.wavesurfer.params.vertical);\n\n this.style(this.displayTime,\n Object.assign(\n {\n display: 'inline',\n pointerEvents: 'none',\n margin: 'auto',\n visibility: 'hidden' // initial value will be hidden just for measuring purpose\n },\n this.params.customShowTimeStyle\n )\n );\n\n // initial value to measure display width\n this.displayTime.innerHTML = this.formatTime(0);\n }\n\n this.wrapper.addEventListener('mousemove', this._onMousemove);\n if (this.params.hideOnBlur) {\n // ensure elements are hidden initially\n this.hideCursor();\n this.wrapper.addEventListener('mouseenter', this._onMouseenter);\n this.wrapper.addEventListener('mouseleave', this._onMouseleave);\n }\n }\n\n /**\n * Initialise the plugin (used by the Plugin API)\n */\n init() {\n if (this.wavesurfer.isReady) {\n this._onReady();\n } else {\n this.wavesurfer.once('ready', () => this._onReady());\n }\n }\n\n /**\n * Destroy the plugin (used by the Plugin API)\n */\n destroy() {\n if (this.params.showTime) {\n this.showTime.remove();\n }\n this.cursor.remove();\n this.wrapper.removeEventListener('mousemove', this._onMousemove);\n if (this.params.hideOnBlur) {\n this.wrapper.removeEventListener('mouseenter', this._onMouseenter);\n this.wrapper.removeEventListener('mouseleave', this._onMouseleave);\n }\n }\n\n /**\n * Update the cursor position\n *\n * @param {number} xpos The x offset of the cursor in pixels\n * @param {number} ypos The y offset of the cursor in pixels\n * @param {boolean} flip Flag to flip duration text from right to left\n */\n updateCursorPosition(xpos, ypos, flip = false) {\n this.style(this.cursor, {\n left: `${xpos}px`\n });\n if (this.params.showTime) {\n const duration = this.wavesurfer.getDuration();\n const elementWidth =\n this.wavesurfer.drawer.width /\n this.wavesurfer.params.pixelRatio;\n const scrollWidth = this.wavesurfer.drawer.getScrollX();\n\n const scrollTime =\n (duration / this.wavesurfer.drawer.width) * scrollWidth;\n\n const timeValue =\n Math.max(0, ((xpos - this.wrapper.scrollLeft) / elementWidth) * duration) + scrollTime;\n const formatValue = this.formatTime(timeValue);\n if (flip) {\n const textOffset = this.displayTime.getBoundingClientRect().width;\n xpos -= textOffset;\n }\n this.style(this.showTime, {\n left: `${xpos}px`,\n top: `${ypos}px`\n });\n this.style(this.displayTime, {\n visibility: 'visible'\n });\n this.displayTime.innerHTML = `${formatValue}`;\n }\n }\n\n /**\n * Show the cursor\n */\n showCursor() {\n this.style(this.cursor, {\n display: 'flex'\n });\n if (this.params.showTime) {\n this.style(this.showTime, {\n display: 'flex'\n });\n }\n }\n\n /**\n * Hide the cursor\n */\n hideCursor() {\n this.style(this.cursor, {\n display: 'none'\n });\n if (this.params.showTime) {\n this.style(this.showTime, {\n display: 'none'\n });\n }\n }\n\n /**\n * Format the timestamp for `cursorTime`.\n *\n * @param {number} cursorTime Time in seconds\n * @returns {string} Formatted timestamp\n */\n formatTime(cursorTime) {\n cursorTime = isNaN(cursorTime) ? 0 : cursorTime;\n\n if (this.params.formatTimeCallback) {\n return this.params.formatTimeCallback(cursorTime);\n }\n return [cursorTime].map(time =>\n [\n Math.floor((time % 3600) / 60), // minutes\n ('00' + Math.floor(time % 60)).slice(-2), // seconds\n ('000' + Math.floor((time % 1) * 1000)).slice(-3) // milliseconds\n ].join(':')\n );\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./src/plugin/cursor/index.js\");\n",""],"names":["CursorPlugin","params","ws","hideOnBlur","width","color","opacity","style","zIndex","customStyle","customShowTimeStyle","showTime","followCursorY","formatTimeCallback","e","event","util","withOrientation","wavesurfer","vertical","bbox","wrapper","getBoundingClientRect","y","x","scrollLeft","clientX","left","flip","right","displayTime","clientY","top","height","updateCursorPosition","showCursor","hideCursor","cursor","Object","assign","defaultParams","drawer","appendChild","document","createElement","position","bottom","display","borderRightStyle","borderRightWidth","borderRightColor","pointerEvents","margin","visibility","innerHTML","formatTime","addEventListener","_onMousemove","_onMouseenter","_onMouseleave","isReady","_onReady","once","remove","removeEventListener","xpos","ypos","duration","getDuration","elementWidth","pixelRatio","scrollWidth","getScrollX","scrollTime","timeValue","Math","max","formatValue","textOffset","cursorTime","isNaN","map","time","floor","slice","join","name","deferInit","staticProps","instance"],"sourceRoot":""}
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * wavesurfer.js cursor plugin 6.0.2 (2022-02-20)
2
+ * wavesurfer.js cursor plugin 6.1.0 (2022-03-31)
3
3
  * https://wavesurfer-js.org
4
4
  * @license BSD-3-Clause
5
5
  */
6
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("WaveSurfer",[],t):"object"==typeof exports?exports.WaveSurfer=t():(e.WaveSurfer=e.WaveSurfer||{},e.WaveSurfer.cursor=t())}(self,(function(){return(()=>{"use strict";var e={178:(e,t)=>{function i(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function s(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(){function e(t,i){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),s(this,"defaultParams",{hideOnBlur:!0,width:"1px",color:"black",opacity:"0.25",style:"solid",zIndex:4,customStyle:{},customShowTimeStyle:{},showTime:!1,followCursorY:!1,formatTimeCallback:null}),s(this,"_onMousemove",(function(e){var t=r.util.withOrientation(e,r.wavesurfer.params.vertical),i=r.wrapper.getBoundingClientRect(),s=0,a=r.wrapper.scrollLeft+t.clientX-i.left,o=i.right<t.clientX+r.displayTime.getBoundingClientRect().width;r.params.showTime&&r.params.followCursorY&&(s=t.clientY-(i.top+i.height/2)),r.updateCursorPosition(a,s,o)})),s(this,"_onMouseenter",(function(){return r.showCursor()})),s(this,"_onMouseleave",(function(){return r.hideCursor()})),this.wavesurfer=i,this.style=i.util.style,this.util=i.util,this.cursor=null,this.showTime=null,this.displayTime=null,this.params=Object.assign({},this.defaultParams,t)}var t,r,a;return t=e,r=[{key:"_onReady",value:function(){this.wrapper=this.wavesurfer.drawer.wrapper,this.cursor=this.util.withOrientation(this.wrapper.appendChild(document.createElement("cursor")),this.wavesurfer.params.vertical),this.style(this.cursor,Object.assign({position:"absolute",zIndex:this.params.zIndex,left:0,top:0,bottom:0,width:"0",display:"flex",borderRightStyle:this.params.style,borderRightWidth:this.params.width,borderRightColor:this.params.color,opacity:this.params.opacity,pointerEvents:"none"},this.params.customStyle)),this.params.showTime&&(this.showTime=this.util.withOrientation(this.wrapper.appendChild(document.createElement("showTitle")),this.wavesurfer.params.vertical),this.style(this.showTime,Object.assign({position:"absolute",zIndex:this.params.zIndex,left:0,top:0,bottom:0,width:"auto",display:"flex",opacity:this.params.opacity,pointerEvents:"none",height:"100%"},this.params.customStyle)),this.displayTime=this.util.withOrientation(this.showTime.appendChild(document.createElement("div")),this.wavesurfer.params.vertical),this.style(this.displayTime,Object.assign({display:"inline",pointerEvents:"none",margin:"auto",visibility:"hidden"},this.params.customShowTimeStyle)),this.displayTime.innerHTML=this.formatTime(0)),this.wrapper.addEventListener("mousemove",this._onMousemove),this.params.hideOnBlur&&(this.hideCursor(),this.wrapper.addEventListener("mouseenter",this._onMouseenter),this.wrapper.addEventListener("mouseleave",this._onMouseleave))}},{key:"init",value:function(){var e=this;this.wavesurfer.isReady?this._onReady():this.wavesurfer.once("ready",(function(){return e._onReady()}))}},{key:"destroy",value:function(){this.params.showTime&&this.cursor.parentNode.removeChild(this.showTime),this.cursor.parentNode.removeChild(this.cursor),this.wrapper.removeEventListener("mousemove",this._onMousemove),this.params.hideOnBlur&&(this.wrapper.removeEventListener("mouseenter",this._onMouseenter),this.wrapper.removeEventListener("mouseleave",this._onMouseleave))}},{key:"updateCursorPosition",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.style(this.cursor,{left:"".concat(e,"px")}),this.params.showTime){var s=this.wavesurfer.getDuration(),r=this.wavesurfer.drawer.width/this.wavesurfer.params.pixelRatio,a=this.wavesurfer.drawer.getScrollX(),o=s/this.wavesurfer.drawer.width*a,n=Math.max(0,(e-this.wrapper.scrollLeft)/r*s)+o,h=this.formatTime(n);if(i){var l=this.displayTime.getBoundingClientRect().width;e-=l}this.style(this.showTime,{left:"".concat(e,"px"),top:"".concat(t,"px")}),this.style(this.displayTime,{visibility:"visible"}),this.displayTime.innerHTML="".concat(h)}}},{key:"showCursor",value:function(){this.style(this.cursor,{display:"flex"}),this.params.showTime&&this.style(this.showTime,{display:"flex"})}},{key:"hideCursor",value:function(){this.style(this.cursor,{display:"none"}),this.params.showTime&&this.style(this.showTime,{display:"none"})}},{key:"formatTime",value:function(e){return e=isNaN(e)?0:e,this.params.formatTimeCallback?this.params.formatTimeCallback(e):[e].map((function(e){return[Math.floor(e%3600/60),("00"+Math.floor(e%60)).slice(-2),("000"+Math.floor(e%1*1e3)).slice(-3)].join(":")}))}}],a=[{key:"create",value:function(t){return{name:"cursor",deferInit:!(!t||!t.deferInit)&&t.deferInit,params:t,staticProps:{},instance:e}}}],r&&i(t.prototype,r),a&&i(t,a),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.default=r,e.exports=t.default}},t={};var i=function i(s){var r=t[s];if(void 0!==r)return r.exports;var a=t[s]={exports:{}};return e[s](a,a.exports,i),a.exports}(178);return i})()}));
6
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("WaveSurfer",[],t):"object"==typeof exports?exports.WaveSurfer=t():(e.WaveSurfer=e.WaveSurfer||{},e.WaveSurfer.cursor=t())}(self,(function(){return(()=>{"use strict";var e={178:(e,t)=>{function i(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function s(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(){function e(t,i){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),s(this,"defaultParams",{hideOnBlur:!0,width:"1px",color:"black",opacity:"0.25",style:"solid",zIndex:4,customStyle:{},customShowTimeStyle:{},showTime:!1,followCursorY:!1,formatTimeCallback:null}),s(this,"_onMousemove",(function(e){var t=r.util.withOrientation(e,r.wavesurfer.params.vertical),i=r.wrapper.getBoundingClientRect(),s=0,a=r.wrapper.scrollLeft+t.clientX-i.left,o=i.right<t.clientX+r.displayTime.getBoundingClientRect().width;r.params.showTime&&r.params.followCursorY&&(s=t.clientY-(i.top+i.height/2)),r.updateCursorPosition(a,s,o)})),s(this,"_onMouseenter",(function(){return r.showCursor()})),s(this,"_onMouseleave",(function(){return r.hideCursor()})),this.wavesurfer=i,this.style=i.util.style,this.util=i.util,this.cursor=null,this.showTime=null,this.displayTime=null,this.params=Object.assign({},this.defaultParams,t)}var t,r,a;return t=e,r=[{key:"_onReady",value:function(){this.wrapper=this.wavesurfer.drawer.wrapper,this.cursor=this.util.withOrientation(this.wrapper.appendChild(document.createElement("cursor")),this.wavesurfer.params.vertical),this.style(this.cursor,Object.assign({position:"absolute",zIndex:this.params.zIndex,left:0,top:0,bottom:0,width:"0",display:"flex",borderRightStyle:this.params.style,borderRightWidth:this.params.width,borderRightColor:this.params.color,opacity:this.params.opacity,pointerEvents:"none"},this.params.customStyle)),this.params.showTime&&(this.showTime=this.util.withOrientation(this.wrapper.appendChild(document.createElement("showTitle")),this.wavesurfer.params.vertical),this.style(this.showTime,Object.assign({position:"absolute",zIndex:this.params.zIndex,left:0,top:0,bottom:0,width:"auto",display:"flex",opacity:this.params.opacity,pointerEvents:"none",height:"100%"},this.params.customStyle)),this.displayTime=this.util.withOrientation(this.showTime.appendChild(document.createElement("div")),this.wavesurfer.params.vertical),this.style(this.displayTime,Object.assign({display:"inline",pointerEvents:"none",margin:"auto",visibility:"hidden"},this.params.customShowTimeStyle)),this.displayTime.innerHTML=this.formatTime(0)),this.wrapper.addEventListener("mousemove",this._onMousemove),this.params.hideOnBlur&&(this.hideCursor(),this.wrapper.addEventListener("mouseenter",this._onMouseenter),this.wrapper.addEventListener("mouseleave",this._onMouseleave))}},{key:"init",value:function(){var e=this;this.wavesurfer.isReady?this._onReady():this.wavesurfer.once("ready",(function(){return e._onReady()}))}},{key:"destroy",value:function(){this.params.showTime&&this.showTime.remove(),this.cursor.remove(),this.wrapper.removeEventListener("mousemove",this._onMousemove),this.params.hideOnBlur&&(this.wrapper.removeEventListener("mouseenter",this._onMouseenter),this.wrapper.removeEventListener("mouseleave",this._onMouseleave))}},{key:"updateCursorPosition",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.style(this.cursor,{left:"".concat(e,"px")}),this.params.showTime){var s=this.wavesurfer.getDuration(),r=this.wavesurfer.drawer.width/this.wavesurfer.params.pixelRatio,a=this.wavesurfer.drawer.getScrollX(),o=s/this.wavesurfer.drawer.width*a,n=Math.max(0,(e-this.wrapper.scrollLeft)/r*s)+o,h=this.formatTime(n);if(i){var l=this.displayTime.getBoundingClientRect().width;e-=l}this.style(this.showTime,{left:"".concat(e,"px"),top:"".concat(t,"px")}),this.style(this.displayTime,{visibility:"visible"}),this.displayTime.innerHTML="".concat(h)}}},{key:"showCursor",value:function(){this.style(this.cursor,{display:"flex"}),this.params.showTime&&this.style(this.showTime,{display:"flex"})}},{key:"hideCursor",value:function(){this.style(this.cursor,{display:"none"}),this.params.showTime&&this.style(this.showTime,{display:"none"})}},{key:"formatTime",value:function(e){return e=isNaN(e)?0:e,this.params.formatTimeCallback?this.params.formatTimeCallback(e):[e].map((function(e){return[Math.floor(e%3600/60),("00"+Math.floor(e%60)).slice(-2),("000"+Math.floor(e%1*1e3)).slice(-3)].join(":")}))}}],a=[{key:"create",value:function(t){return{name:"cursor",deferInit:!(!t||!t.deferInit)&&t.deferInit,params:t,staticProps:{},instance:e}}}],r&&i(t.prototype,r),a&&i(t,a),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.default=r,e.exports=t.default}},t={};var i=function i(s){var r=t[s];if(void 0!==r)return r.exports;var a=t[s]={exports:{}};return e[s](a,a.exports,i),a.exports}(178);return i})()}));
7
7
  //# sourceMappingURL=wavesurfer.cursor.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wavesurfer.cursor.min.js","mappings":";;;;;CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,aAAc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,KAAK9B,MAAM8B,KAAK1B,SAAU,CACtBqC,QAAS,W,wBAQrB,WACIX,KAAK9B,MAAM8B,KAAKC,OAAQ,CACpBU,QAAS,SAETX,KAAKpC,OAAOU,UACZ0B,KAAK9B,MAAM8B,KAAK1B,SAAU,CACtBqC,QAAS,W,wBAWrB,SAAWiC,GAGP,OAFAA,EAAaC,MAAMD,GAAc,EAAIA,EAEjC5C,KAAKpC,OAAOY,mBACLwB,KAAKpC,OAAOY,mBAAmBoE,GAEnC,CAACA,GAAYE,KAAI,SAAAC,GAAI,MACxB,CACIP,KAAKQ,MAAOD,EAAO,KAAQ,KAC1B,KAAOP,KAAKQ,MAAMD,EAAO,KAAKE,OAAO,IACrC,MAAQT,KAAKQ,MAAOD,EAAO,EAAK,MAAOE,OAAO,IACjDC,KAAK,W,uBApRf,SAActF,GACV,MAAO,CACHuF,KAAM,SACNC,aAAWxF,IAAUA,EAAOwF,YAAYxF,EAAOwF,UAC/CxF,OAAQA,EACRyF,YAAa,GACbC,SAAU3F,M,mFAjBDA,G,kCC7CjB4F,EAA2B,GCE/B,IAAIC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAarG,QAGrB,IAAIC,EAASgG,EAAyBG,GAAY,CAGjDpG,QAAS,IAOV,OAHAuG,EAAoBH,GAAUnG,EAAQA,EAAOD,QAASmG,GAG/ClG,EAAOD,QClBWmG,CAAoB,K,UHO9C","sources":["webpack://WaveSurfer.[name]/webpack/universalModuleDefinition","webpack://WaveSurfer.[name]/./src/plugin/cursor/index.js","webpack://WaveSurfer.[name]/webpack/bootstrap","webpack://WaveSurfer.[name]/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"cursor\"] = factory();\n})(self, function() {\nreturn ","/**\n * @typedef {Object} CursorPluginParams\n * @property {?boolean} deferInit Set to true to stop auto init in `addPlugin()`\n * @property {boolean} hideOnBlur=true Hide the cursor when the mouse leaves the\n * waveform\n * @property {string} width='1px' The width of the cursor\n * @property {string} color='black' The color of the cursor\n * @property {string} opacity='0.25' The opacity of the cursor\n * @property {string} style='solid' The border style of the cursor\n * @property {number} zIndex=3 The z-index of the cursor element\n * @property {object} customStyle An object with custom styles which are applied\n * to the cursor element\n * @property {boolean} showTime=false Show the time on the cursor.\n * @property {object} customShowTimeStyle An object with custom styles which are\n * applied to the cursor time element.\n * @property {string} followCursorY=false Use `true` to make the time on\n * the cursor follow the x and the y-position of the mouse. Use `false` to make the\n * it only follow the x-position of the mouse.\n * @property {function} formatTimeCallback Formats the timestamp on the cursor.\n */\n\n/**\n * Displays a thin line at the position of the cursor on the waveform.\n *\n * @implements {PluginClass}\n * @extends {Observer}\n * @example\n * // es6\n * import CursorPlugin from 'wavesurfer.cursor.js';\n *\n * // commonjs\n * var CursorPlugin = require('wavesurfer.cursor.js');\n *\n * // if you are using <script> tags\n * var CursorPlugin = window.WaveSurfer.cursor;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * CursorPlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\nexport default class CursorPlugin {\n /**\n * Cursor plugin definition factory\n *\n * This function must be used to create a plugin definition which can be\n * used by wavesurfer to correctly instantiate the plugin.\n *\n * @param {CursorPluginParams} params parameters use to initialise the\n * plugin\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'cursor',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n staticProps: {},\n instance: CursorPlugin\n };\n }\n\n /**\n * @type {CursorPluginParams}\n */\n defaultParams = {\n hideOnBlur: true,\n width: '1px',\n color: 'black',\n opacity: '0.25',\n style: 'solid',\n zIndex: 4,\n customStyle: {},\n customShowTimeStyle: {},\n showTime: false,\n followCursorY: false,\n formatTimeCallback: null\n };\n\n /**\n * @param {object} e Mouse move event\n */\n _onMousemove = e => {\n const event = this.util.withOrientation(e, this.wavesurfer.params.vertical);\n const bbox = this.wrapper.getBoundingClientRect();\n let y = 0;\n let x = this.wrapper.scrollLeft + event.clientX - bbox.left;\n let flip = bbox.right < event.clientX + this.displayTime.getBoundingClientRect().width;\n\n if (this.params.showTime && this.params.followCursorY) {\n // follow y-position of the mouse\n y = event.clientY - (bbox.top + bbox.height / 2);\n }\n\n this.updateCursorPosition(x, y, flip);\n };\n\n /**\n * @returns {void}\n */\n _onMouseenter = () => this.showCursor();\n\n /**\n * @returns {void}\n */\n _onMouseleave = () => this.hideCursor();\n\n /**\n * Construct the plugin class. You probably want to use `CursorPlugin.create`\n * instead.\n *\n * @param {CursorPluginParams} params Plugin parameters\n * @param {object} ws Wavesurfer instance\n */\n constructor(params, ws) {\n this.wavesurfer = ws;\n this.style = ws.util.style;\n this.util = ws.util;\n /**\n * The cursor HTML element\n *\n * @type {?HTMLElement}\n */\n this.cursor = null;\n /**\n * displays the time next to the cursor\n *\n * @type {?HTMLElement}\n */\n this.showTime = null;\n /**\n * The html container that will display the time\n *\n * @type {?HTMLElement}\n */\n this.displayTime = null;\n\n this.params = Object.assign({}, this.defaultParams, params);\n }\n\n _onReady() {\n this.wrapper = this.wavesurfer.drawer.wrapper;\n this.cursor = this.util.withOrientation(this.wrapper.appendChild(\n document.createElement('cursor'),\n ), this.wavesurfer.params.vertical);\n\n this.style(this.cursor,\n Object.assign(\n {\n position: 'absolute',\n zIndex: this.params.zIndex,\n left: 0,\n top: 0,\n bottom: 0,\n width: '0',\n display: 'flex',\n borderRightStyle: this.params.style,\n borderRightWidth: this.params.width,\n borderRightColor: this.params.color,\n opacity: this.params.opacity,\n pointerEvents: 'none'\n },\n this.params.customStyle\n )\n );\n\n if (this.params.showTime) {\n this.showTime = this.util.withOrientation(this.wrapper.appendChild(\n document.createElement('showTitle')\n ), this.wavesurfer.params.vertical);\n this.style(\n this.showTime,\n Object.assign(\n {\n position: 'absolute',\n zIndex: this.params.zIndex,\n left: 0,\n top: 0,\n bottom: 0,\n width: 'auto',\n display: 'flex',\n opacity: this.params.opacity,\n pointerEvents: 'none',\n height: '100%'\n },\n this.params.customStyle\n )\n );\n\n this.displayTime = this.util.withOrientation(this.showTime.appendChild(\n document.createElement('div'),\n ), this.wavesurfer.params.vertical);\n\n this.style(this.displayTime,\n Object.assign(\n {\n display: 'inline',\n pointerEvents: 'none',\n margin: 'auto',\n visibility: 'hidden' // initial value will be hidden just for measuring purpose\n },\n this.params.customShowTimeStyle\n )\n );\n\n // initial value to measure display width\n this.displayTime.innerHTML = this.formatTime(0);\n }\n\n this.wrapper.addEventListener('mousemove', this._onMousemove);\n if (this.params.hideOnBlur) {\n // ensure elements are hidden initially\n this.hideCursor();\n this.wrapper.addEventListener('mouseenter', this._onMouseenter);\n this.wrapper.addEventListener('mouseleave', this._onMouseleave);\n }\n }\n\n /**\n * Initialise the plugin (used by the Plugin API)\n */\n init() {\n if (this.wavesurfer.isReady) {\n this._onReady();\n } else {\n this.wavesurfer.once('ready', () => this._onReady());\n }\n }\n\n /**\n * Destroy the plugin (used by the Plugin API)\n */\n destroy() {\n if (this.params.showTime) {\n this.cursor.parentNode.removeChild(this.showTime);\n }\n this.cursor.parentNode.removeChild(this.cursor);\n this.wrapper.removeEventListener('mousemove', this._onMousemove);\n if (this.params.hideOnBlur) {\n this.wrapper.removeEventListener('mouseenter', this._onMouseenter);\n this.wrapper.removeEventListener('mouseleave', this._onMouseleave);\n }\n }\n\n /**\n * Update the cursor position\n *\n * @param {number} xpos The x offset of the cursor in pixels\n * @param {number} ypos The y offset of the cursor in pixels\n * @param {boolean} flip Flag to flip duration text from right to left\n */\n updateCursorPosition(xpos, ypos, flip = false) {\n this.style(this.cursor, {\n left: `${xpos}px`\n });\n if (this.params.showTime) {\n const duration = this.wavesurfer.getDuration();\n const elementWidth =\n this.wavesurfer.drawer.width /\n this.wavesurfer.params.pixelRatio;\n const scrollWidth = this.wavesurfer.drawer.getScrollX();\n\n const scrollTime =\n (duration / this.wavesurfer.drawer.width) * scrollWidth;\n\n const timeValue =\n Math.max(0, ((xpos - this.wrapper.scrollLeft) / elementWidth) * duration) + scrollTime;\n const formatValue = this.formatTime(timeValue);\n if (flip) {\n const textOffset = this.displayTime.getBoundingClientRect().width;\n xpos -= textOffset;\n }\n this.style(this.showTime, {\n left: `${xpos}px`,\n top: `${ypos}px`\n });\n this.style(this.displayTime, {\n visibility: 'visible'\n });\n this.displayTime.innerHTML = `${formatValue}`;\n }\n }\n\n /**\n * Show the cursor\n */\n showCursor() {\n this.style(this.cursor, {\n display: 'flex'\n });\n if (this.params.showTime) {\n this.style(this.showTime, {\n display: 'flex'\n });\n }\n }\n\n /**\n * Hide the cursor\n */\n hideCursor() {\n this.style(this.cursor, {\n display: 'none'\n });\n if (this.params.showTime) {\n this.style(this.showTime, {\n display: 'none'\n });\n }\n }\n\n /**\n * Format the timestamp for `cursorTime`.\n *\n * @param {number} cursorTime Time in seconds\n * @returns {string} Formatted timestamp\n */\n formatTime(cursorTime) {\n cursorTime = isNaN(cursorTime) ? 0 : cursorTime;\n\n if (this.params.formatTimeCallback) {\n return this.params.formatTimeCallback(cursorTime);\n }\n return [cursorTime].map(time =>\n [\n Math.floor((time % 3600) / 60), // minutes\n ('00' + Math.floor(time % 60)).slice(-2), // seconds\n ('000' + Math.floor((time % 1) * 1000)).slice(-3) // milliseconds\n ].join(':')\n );\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(178);\n"],"names":["root","factory","exports","module","define","amd","self","CursorPlugin","params","ws","hideOnBlur","width","color","opacity","style","zIndex","customStyle","customShowTimeStyle","showTime","followCursorY","formatTimeCallback","e","event","util","withOrientation","wavesurfer","vertical","bbox","wrapper","getBoundingClientRect","y","x","scrollLeft","clientX","left","flip","right","displayTime","clientY","top","height","updateCursorPosition","showCursor","hideCursor","this","cursor","Object","assign","defaultParams","drawer","appendChild","document","createElement","position","bottom","display","borderRightStyle","borderRightWidth","borderRightColor","pointerEvents","margin","visibility","innerHTML","formatTime","addEventListener","_onMousemove","_onMouseenter","_onMouseleave","isReady","_onReady","once","parentNode","removeChild","removeEventListener","xpos","ypos","duration","getDuration","elementWidth","pixelRatio","scrollWidth","getScrollX","scrollTime","timeValue","Math","max","formatValue","textOffset","cursorTime","isNaN","map","time","floor","slice","join","name","deferInit","staticProps","instance","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
1
+ {"version":3,"file":"wavesurfer.cursor.min.js","mappings":";;;;;CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,aAAc,GAAIH,GACC,iBAAZC,QACdA,QAAoB,WAAID,KAExBD,EAAiB,WAAIA,EAAiB,YAAK,GAAIA,EAAiB,WAAU,OAAIC,KARhF,CASGK,MAAM,WACT,Y,oYCoCqBC,EAAAA,WAyEjB,WAAYC,EAAQC,GAAI,Y,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D,GAAc,EAAIA,EAEjC3C,KAAKpC,OAAOY,mBACLwB,KAAKpC,OAAOY,mBAAmBmE,GAEnC,CAACA,GAAYE,KAAI,SAAAC,GAAI,MACxB,CACIP,KAAKQ,MAAOD,EAAO,KAAQ,KAC1B,KAAOP,KAAKQ,MAAMD,EAAO,KAAKE,OAAO,IACrC,MAAQT,KAAKQ,MAAOD,EAAO,EAAK,MAAOE,OAAO,IACjDC,KAAK,W,uBApRf,SAAcrF,GACV,MAAO,CACHsF,KAAM,SACNC,aAAWvF,IAAUA,EAAOuF,YAAYvF,EAAOuF,UAC/CvF,OAAQA,EACRwF,YAAa,GACbC,SAAU1F,M,mFAjBDA,G,kCC7CjB2F,EAA2B,GCE/B,IAAIC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAapG,QAGrB,IAAIC,EAAS+F,EAAyBG,GAAY,CAGjDnG,QAAS,IAOV,OAHAsG,EAAoBH,GAAUlG,EAAQA,EAAOD,QAASkG,GAG/CjG,EAAOD,QClBWkG,CAAoB,K,UHO9C","sources":["webpack://WaveSurfer.[name]/webpack/universalModuleDefinition","webpack://WaveSurfer.[name]/./src/plugin/cursor/index.js","webpack://WaveSurfer.[name]/webpack/bootstrap","webpack://WaveSurfer.[name]/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"cursor\"] = factory();\n})(self, function() {\nreturn ","/**\n * @typedef {Object} CursorPluginParams\n * @property {?boolean} deferInit Set to true to stop auto init in `addPlugin()`\n * @property {boolean} hideOnBlur=true Hide the cursor when the mouse leaves the\n * waveform\n * @property {string} width='1px' The width of the cursor\n * @property {string} color='black' The color of the cursor\n * @property {number|string} opacity='0.25' The opacity of the cursor\n * @property {string} style='solid' The border style of the cursor\n * @property {number} zIndex=3 The z-index of the cursor element\n * @property {object} customStyle An object with custom styles which are applied\n * to the cursor element\n * @property {boolean} showTime=false Show the time on the cursor.\n * @property {object} customShowTimeStyle An object with custom styles which are\n * applied to the cursor time element.\n * @property {boolean} followCursorY=false Use `true` to make the time on\n * the cursor follow the x and the y-position of the mouse. Use `false` to make the\n * it only follow the x-position of the mouse.\n * @property {function} formatTimeCallback Formats the timestamp on the cursor.\n */\n\n/**\n * Displays a thin line at the position of the cursor on the waveform.\n *\n * @implements {PluginClass}\n * @extends {Observer}\n * @example\n * // es6\n * import CursorPlugin from 'wavesurfer.cursor.js';\n *\n * // commonjs\n * var CursorPlugin = require('wavesurfer.cursor.js');\n *\n * // if you are using <script> tags\n * var CursorPlugin = window.WaveSurfer.cursor;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * CursorPlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\nexport default class CursorPlugin {\n /**\n * Cursor plugin definition factory\n *\n * This function must be used to create a plugin definition which can be\n * used by wavesurfer to correctly instantiate the plugin.\n *\n * @param {CursorPluginParams} params parameters use to initialise the\n * plugin\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'cursor',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n staticProps: {},\n instance: CursorPlugin\n };\n }\n\n /**\n * @type {CursorPluginParams}\n */\n defaultParams = {\n hideOnBlur: true,\n width: '1px',\n color: 'black',\n opacity: '0.25',\n style: 'solid',\n zIndex: 4,\n customStyle: {},\n customShowTimeStyle: {},\n showTime: false,\n followCursorY: false,\n formatTimeCallback: null\n };\n\n /**\n * @param {object} e Mouse move event\n */\n _onMousemove = e => {\n const event = this.util.withOrientation(e, this.wavesurfer.params.vertical);\n const bbox = this.wrapper.getBoundingClientRect();\n let y = 0;\n let x = this.wrapper.scrollLeft + event.clientX - bbox.left;\n let flip = bbox.right < event.clientX + this.displayTime.getBoundingClientRect().width;\n\n if (this.params.showTime && this.params.followCursorY) {\n // follow y-position of the mouse\n y = event.clientY - (bbox.top + bbox.height / 2);\n }\n\n this.updateCursorPosition(x, y, flip);\n };\n\n /**\n * @returns {void}\n */\n _onMouseenter = () => this.showCursor();\n\n /**\n * @returns {void}\n */\n _onMouseleave = () => this.hideCursor();\n\n /**\n * Construct the plugin class. You probably want to use `CursorPlugin.create`\n * instead.\n *\n * @param {CursorPluginParams} params Plugin parameters\n * @param {object} ws Wavesurfer instance\n */\n constructor(params, ws) {\n this.wavesurfer = ws;\n this.style = ws.util.style;\n this.util = ws.util;\n /**\n * The cursor HTML element\n *\n * @type {?HTMLElement}\n */\n this.cursor = null;\n /**\n * displays the time next to the cursor\n *\n * @type {?HTMLElement}\n */\n this.showTime = null;\n /**\n * The html container that will display the time\n *\n * @type {?HTMLElement}\n */\n this.displayTime = null;\n\n this.params = Object.assign({}, this.defaultParams, params);\n }\n\n _onReady() {\n this.wrapper = this.wavesurfer.drawer.wrapper;\n this.cursor = this.util.withOrientation(this.wrapper.appendChild(\n document.createElement('cursor'),\n ), this.wavesurfer.params.vertical);\n\n this.style(this.cursor,\n Object.assign(\n {\n position: 'absolute',\n zIndex: this.params.zIndex,\n left: 0,\n top: 0,\n bottom: 0,\n width: '0',\n display: 'flex',\n borderRightStyle: this.params.style,\n borderRightWidth: this.params.width,\n borderRightColor: this.params.color,\n opacity: this.params.opacity,\n pointerEvents: 'none'\n },\n this.params.customStyle\n )\n );\n\n if (this.params.showTime) {\n this.showTime = this.util.withOrientation(this.wrapper.appendChild(\n document.createElement('showTitle')\n ), this.wavesurfer.params.vertical);\n this.style(\n this.showTime,\n Object.assign(\n {\n position: 'absolute',\n zIndex: this.params.zIndex,\n left: 0,\n top: 0,\n bottom: 0,\n width: 'auto',\n display: 'flex',\n opacity: this.params.opacity,\n pointerEvents: 'none',\n height: '100%'\n },\n this.params.customStyle\n )\n );\n\n this.displayTime = this.util.withOrientation(this.showTime.appendChild(\n document.createElement('div'),\n ), this.wavesurfer.params.vertical);\n\n this.style(this.displayTime,\n Object.assign(\n {\n display: 'inline',\n pointerEvents: 'none',\n margin: 'auto',\n visibility: 'hidden' // initial value will be hidden just for measuring purpose\n },\n this.params.customShowTimeStyle\n )\n );\n\n // initial value to measure display width\n this.displayTime.innerHTML = this.formatTime(0);\n }\n\n this.wrapper.addEventListener('mousemove', this._onMousemove);\n if (this.params.hideOnBlur) {\n // ensure elements are hidden initially\n this.hideCursor();\n this.wrapper.addEventListener('mouseenter', this._onMouseenter);\n this.wrapper.addEventListener('mouseleave', this._onMouseleave);\n }\n }\n\n /**\n * Initialise the plugin (used by the Plugin API)\n */\n init() {\n if (this.wavesurfer.isReady) {\n this._onReady();\n } else {\n this.wavesurfer.once('ready', () => this._onReady());\n }\n }\n\n /**\n * Destroy the plugin (used by the Plugin API)\n */\n destroy() {\n if (this.params.showTime) {\n this.showTime.remove();\n }\n this.cursor.remove();\n this.wrapper.removeEventListener('mousemove', this._onMousemove);\n if (this.params.hideOnBlur) {\n this.wrapper.removeEventListener('mouseenter', this._onMouseenter);\n this.wrapper.removeEventListener('mouseleave', this._onMouseleave);\n }\n }\n\n /**\n * Update the cursor position\n *\n * @param {number} xpos The x offset of the cursor in pixels\n * @param {number} ypos The y offset of the cursor in pixels\n * @param {boolean} flip Flag to flip duration text from right to left\n */\n updateCursorPosition(xpos, ypos, flip = false) {\n this.style(this.cursor, {\n left: `${xpos}px`\n });\n if (this.params.showTime) {\n const duration = this.wavesurfer.getDuration();\n const elementWidth =\n this.wavesurfer.drawer.width /\n this.wavesurfer.params.pixelRatio;\n const scrollWidth = this.wavesurfer.drawer.getScrollX();\n\n const scrollTime =\n (duration / this.wavesurfer.drawer.width) * scrollWidth;\n\n const timeValue =\n Math.max(0, ((xpos - this.wrapper.scrollLeft) / elementWidth) * duration) + scrollTime;\n const formatValue = this.formatTime(timeValue);\n if (flip) {\n const textOffset = this.displayTime.getBoundingClientRect().width;\n xpos -= textOffset;\n }\n this.style(this.showTime, {\n left: `${xpos}px`,\n top: `${ypos}px`\n });\n this.style(this.displayTime, {\n visibility: 'visible'\n });\n this.displayTime.innerHTML = `${formatValue}`;\n }\n }\n\n /**\n * Show the cursor\n */\n showCursor() {\n this.style(this.cursor, {\n display: 'flex'\n });\n if (this.params.showTime) {\n this.style(this.showTime, {\n display: 'flex'\n });\n }\n }\n\n /**\n * Hide the cursor\n */\n hideCursor() {\n this.style(this.cursor, {\n display: 'none'\n });\n if (this.params.showTime) {\n this.style(this.showTime, {\n display: 'none'\n });\n }\n }\n\n /**\n * Format the timestamp for `cursorTime`.\n *\n * @param {number} cursorTime Time in seconds\n * @returns {string} Formatted timestamp\n */\n formatTime(cursorTime) {\n cursorTime = isNaN(cursorTime) ? 0 : cursorTime;\n\n if (this.params.formatTimeCallback) {\n return this.params.formatTimeCallback(cursorTime);\n }\n return [cursorTime].map(time =>\n [\n Math.floor((time % 3600) / 60), // minutes\n ('00' + Math.floor(time % 60)).slice(-2), // seconds\n ('000' + Math.floor((time % 1) * 1000)).slice(-3) // milliseconds\n ].join(':')\n );\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(178);\n"],"names":["root","factory","exports","module","define","amd","self","CursorPlugin","params","ws","hideOnBlur","width","color","opacity","style","zIndex","customStyle","customShowTimeStyle","showTime","followCursorY","formatTimeCallback","e","event","util","withOrientation","wavesurfer","vertical","bbox","wrapper","getBoundingClientRect","y","x","scrollLeft","clientX","left","flip","right","displayTime","clientY","top","height","updateCursorPosition","showCursor","hideCursor","this","cursor","Object","assign","defaultParams","drawer","appendChild","document","createElement","position","bottom","display","borderRightStyle","borderRightWidth","borderRightColor","pointerEvents","margin","visibility","innerHTML","formatTime","addEventListener","_onMousemove","_onMouseenter","_onMouseleave","isReady","_onReady","once","remove","removeEventListener","xpos","ypos","duration","getDuration","elementWidth","pixelRatio","scrollWidth","getScrollX","scrollTime","timeValue","Math","max","formatValue","textOffset","cursorTime","isNaN","map","time","floor","slice","join","name","deferInit","staticProps","instance","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wavesurfer.js elan plugin 6.0.2 (2022-02-20)
2
+ * wavesurfer.js elan 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 elan plugin 6.0.2 (2022-02-20)
2
+ * wavesurfer.js elan 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 markers plugin 6.0.2 (2022-02-20)
2
+ * wavesurfer.js markers 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 markers plugin 6.0.2 (2022-02-20)
2
+ * wavesurfer.js markers 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 mediasession plugin 6.0.2 (2022-02-20)
2
+ * wavesurfer.js mediasession plugin 6.1.0 (2022-03-31)
3
3
  * https://wavesurfer-js.org
4
4
  * @license BSD-3-Clause
5
5
  */
@@ -38,8 +38,6 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
38
38
 
39
39
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
40
40
 
41
- /*global MediaMetadata*/
42
-
43
41
  /**
44
42
  * @typedef {Object} MediaSessionPluginParams
45
43
  * @property {MediaMetadata} metadata A MediaMetadata object: a representation
@@ -1 +1 @@
1
- {"version":3,"file":"wavesurfer.mediasession.js","mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C,CAAC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;ACVA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACqBA;AAmBjB,8BAAYC,MAAZ,EAAoBC,EAApB,EAAwB;AAAA;;AAAA;;AACpB,SAAKD,MAAL,GAAcA,MAAd;AACA,SAAKE,UAAL,GAAkBD,EAAlB;;AAEA,QAAI,kBAAkBE,SAAtB,EAAiC;AAC7B;AACA,WAAKC,QAAL,GAAgB,KAAKJ,MAAL,CAAYI,QAA5B;AACA,WAAKC,MAAL,GAH6B,CAK7B;;AACA,WAAKH,UAAL,CAAgBI,EAAhB,CAAmB,MAAnB,EAA2B,YAAM;AAC7B,aAAI,CAACD,MAAL;AACH,OAFD,EAN6B,CAU7B;;A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UACA","sources":["webpack://WaveSurfer.[name]/webpack/universalModuleDefinition","webpack://WaveSurfer.[name]/./src/plugin/mediasession/index.js","webpack://WaveSurfer.[name]/webpack/bootstrap","webpack://WaveSurfer.[name]/webpack/before-startup","webpack://WaveSurfer.[name]/webpack/startup","webpack://WaveSurfer.[name]/webpack/after-startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"mediasession\"] = factory();\n})(self, function() {\nreturn ","/*global MediaMetadata*/\n\n/**\n * @typedef {Object} MediaSessionPluginParams\n * @property {MediaMetadata} metadata A MediaMetadata object: a representation\n * of the metadata associated with a MediaSession that can be used by user agents\n * to provide a customized user interface.\n * @property {?boolean} deferInit Set to true to manually call\n * `initPlugin('mediasession')`\n */\n\n/**\n * Visualize MediaSession information for a wavesurfer instance.\n *\n * @implements {PluginClass}\n * @extends {Observer}\n * @example\n * // es6\n * import MediaSessionPlugin from 'wavesurfer.mediasession.js';\n *\n * // commonjs\n * var MediaSessionPlugin = require('wavesurfer.mediasession.js');\n *\n * // if you are using <script> tags\n * var MediaSessionPlugin = window.WaveSurfer.mediasession;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * MediaSessionPlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\nexport default class MediaSessionPlugin {\n /**\n * MediaSession plugin definition factory\n *\n * This function must be used to create a plugin definition which can be\n * used by wavesurfer to correctly instantiate the plugin.\n *\n * @param {MediaSessionPluginParams} params parameters use to initialise the plugin\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'mediasession',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n instance: MediaSessionPlugin\n };\n }\n\n constructor(params, ws) {\n this.params = params;\n this.wavesurfer = ws;\n\n if ('mediaSession' in navigator) {\n // update metadata\n this.metadata = this.params.metadata;\n this.update();\n\n // update metadata when playback starts\n this.wavesurfer.on('play', () => {\n this.update();\n });\n\n // set playback action handlers\n navigator.mediaSession.setActionHandler('play', () => {\n this.wavesurfer.play();\n });\n navigator.mediaSession.setActionHandler('pause', () => {\n this.wavesurfer.playPause();\n });\n navigator.mediaSession.setActionHandler('seekbackward', () => {\n this.wavesurfer.skipBackward();\n });\n navigator.mediaSession.setActionHandler('seekforward', () => {\n this.wavesurfer.skipForward();\n });\n }\n }\n\n init() {}\n\n destroy() {}\n\n update() {\n if (typeof MediaMetadata === typeof Function) {\n // set metadata\n navigator.mediaSession.metadata = new MediaMetadata(this.metadata);\n }\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./src/plugin/mediasession/index.js\");\n",""],"names":["MediaSessionPlugin","params","ws","wavesurfer","navigator","metadata","update","on","mediaSession","setActionHandler","play","playPause","skipBackward","skipForward","MediaMetadata","Function","name","deferInit","instance"],"sourceRoot":""}
1
+ {"version":3,"file":"wavesurfer.mediasession.js","mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAC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AgCC,QAAhC,yCAAgCA,QAAhC,EAAJ,EAA8C;AAC1C;AACAX,QAAAA,SAAS,CAACI,YAAV,CAAuBH,QAAvB,GAAkC,IAAIS,aAAJ,CAAkB,KAAKT,QAAvB,CAAlC;AACH;AACJ;;;;AAzDD;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACI,oBAAcJ,MAAd,EAAsB;AAClB,aAAO;AACHe,QAAAA,IAAI,EAAE,cADH;AAEHC,QAAAA,SAAS,EAAEhB,MAAM,IAAIA,MAAM,CAACgB,SAAjB,GAA6BhB,MAAM,CAACgB,SAApC,GAAgD,KAFxD;AAGHhB,QAAAA,MAAM,EAAEA,MAHL;AAIHiB,QAAAA,QAAQ,EAAElB;AAJP,OAAP;AAMH;;;;;;;;;;;;;UCnDL;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;UEtBA;UACA;UACA;UACA","sources":["webpack://WaveSurfer.[name]/webpack/universalModuleDefinition","webpack://WaveSurfer.[name]/./src/plugin/mediasession/index.js","webpack://WaveSurfer.[name]/webpack/bootstrap","webpack://WaveSurfer.[name]/webpack/before-startup","webpack://WaveSurfer.[name]/webpack/startup","webpack://WaveSurfer.[name]/webpack/after-startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"mediasession\"] = factory();\n})(self, function() {\nreturn ","/**\n * @typedef {Object} MediaSessionPluginParams\n * @property {MediaMetadata} metadata A MediaMetadata object: a representation\n * of the metadata associated with a MediaSession that can be used by user agents\n * to provide a customized user interface.\n * @property {?boolean} deferInit Set to true to manually call\n * `initPlugin('mediasession')`\n */\n\n/**\n * Visualize MediaSession information for a wavesurfer instance.\n *\n * @implements {PluginClass}\n * @extends {Observer}\n * @example\n * // es6\n * import MediaSessionPlugin from 'wavesurfer.mediasession.js';\n *\n * // commonjs\n * var MediaSessionPlugin = require('wavesurfer.mediasession.js');\n *\n * // if you are using <script> tags\n * var MediaSessionPlugin = window.WaveSurfer.mediasession;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * MediaSessionPlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\nexport default class MediaSessionPlugin {\n /**\n * MediaSession plugin definition factory\n *\n * This function must be used to create a plugin definition which can be\n * used by wavesurfer to correctly instantiate the plugin.\n *\n * @param {MediaSessionPluginParams} params parameters use to initialise the plugin\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'mediasession',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n instance: MediaSessionPlugin\n };\n }\n\n constructor(params, ws) {\n this.params = params;\n this.wavesurfer = ws;\n\n if ('mediaSession' in navigator) {\n // update metadata\n this.metadata = this.params.metadata;\n this.update();\n\n // update metadata when playback starts\n this.wavesurfer.on('play', () => {\n this.update();\n });\n\n // set playback action handlers\n navigator.mediaSession.setActionHandler('play', () => {\n this.wavesurfer.play();\n });\n navigator.mediaSession.setActionHandler('pause', () => {\n this.wavesurfer.playPause();\n });\n navigator.mediaSession.setActionHandler('seekbackward', () => {\n this.wavesurfer.skipBackward();\n });\n navigator.mediaSession.setActionHandler('seekforward', () => {\n this.wavesurfer.skipForward();\n });\n }\n }\n\n init() {}\n\n destroy() {}\n\n update() {\n if (typeof MediaMetadata === typeof Function) {\n // set metadata\n navigator.mediaSession.metadata = new MediaMetadata(this.metadata);\n }\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./src/plugin/mediasession/index.js\");\n",""],"names":["MediaSessionPlugin","params","ws","wavesurfer","navigator","metadata","update","on","mediaSession","setActionHandler","play","playPause","skipBackward","skipForward","MediaMetadata","Function","name","deferInit","instance"],"sourceRoot":""}
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wavesurfer.js mediasession plugin 6.0.2 (2022-02-20)
2
+ * wavesurfer.js mediasession plugin 6.1.0 (2022-03-31)
3
3
  * https://wavesurfer-js.org
4
4
  * @license BSD-3-Clause
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"wavesurfer.mediasession.min.js","mappings":";;;;;CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,aAAc,GAAIH,GACC,iBAAZC,QACdA,QAAoB,WAAID,KAExBD,EAAiB,WAAIA,EAAiB,YAAK,GAAIA,EAAiB,WAAgB,aAAIC,KARtF,CASGK,MAAM,WACT,Y,kfC0BqBC,EAAAA,WAmBjB,WAAYC,EAAQC,GAAI,Y,4FAAA,SACpBC,KAAKF,OAASA,EACdE,KAAKC,WAAaF,EAEd,iBAAkBG,YAElBF,KAAKG,SAAWH,KAAKF,OAAOK,SAC5BH,KAAKI,SAGLJ,KAAKC,WAAWI,GAAG,QAAQ,WACvB,EAAKD,YAITF,UAAUI,aAAaC,iBAAiB,QAAQ,WAC5C,EAAKN,WAAWO,UAEpBN,UAAUI,aAAaC,iBAAiB,SAAS,WAC7C,EAAKN,WAAWQ,eAEpBP,UAAUI,aAAaC,iBAAiB,gBAAgB,WACpD,EAAKN,WAAWS,kBAEpBR,UAAUI,aAAaC,iBAAiB,eAAe,WACnD,EAAKN,WAAWU,kB,4CAlC5B,SAAcb,GACV,MAAO,CACHc,KAAM,eACNC,aAAWf,IAAUA,EAAOe,YAAYf,EAAOe,UAC/Cf,OAAQA,EACRgB,SAAUjB,O,qBAkClB,c,qBAEA,c,oBAEA,YACQ,oBAAOkB,cAAP,cAAOA,mBAAP,oBAAgCC,SAAhC,cAAgCA,aAEhCd,UAAUI,aAAaH,SAAW,IAAIY,cAAcf,KAAKG,gB,gFAxDhDN,G,kCCnCjBoB,EAA2B,GCE/B,IAAIC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAa7B,QAGrB,IAAIC,EAASwB,EAAyBG,GAAY,CAGjD5B,QAAS,IAOV,OAHA+B,EAAoBH,GAAU3B,EAAQA,EAAOD,QAAS2B,GAG/C1B,EAAOD,QClBW2B,CAAoB,K,UHO9C","sources":["webpack://WaveSurfer.[name]/webpack/universalModuleDefinition","webpack://WaveSurfer.[name]/./src/plugin/mediasession/index.js","webpack://WaveSurfer.[name]/webpack/bootstrap","webpack://WaveSurfer.[name]/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"mediasession\"] = factory();\n})(self, function() {\nreturn ","/*global MediaMetadata*/\n\n/**\n * @typedef {Object} MediaSessionPluginParams\n * @property {MediaMetadata} metadata A MediaMetadata object: a representation\n * of the metadata associated with a MediaSession that can be used by user agents\n * to provide a customized user interface.\n * @property {?boolean} deferInit Set to true to manually call\n * `initPlugin('mediasession')`\n */\n\n/**\n * Visualize MediaSession information for a wavesurfer instance.\n *\n * @implements {PluginClass}\n * @extends {Observer}\n * @example\n * // es6\n * import MediaSessionPlugin from 'wavesurfer.mediasession.js';\n *\n * // commonjs\n * var MediaSessionPlugin = require('wavesurfer.mediasession.js');\n *\n * // if you are using <script> tags\n * var MediaSessionPlugin = window.WaveSurfer.mediasession;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * MediaSessionPlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\nexport default class MediaSessionPlugin {\n /**\n * MediaSession plugin definition factory\n *\n * This function must be used to create a plugin definition which can be\n * used by wavesurfer to correctly instantiate the plugin.\n *\n * @param {MediaSessionPluginParams} params parameters use to initialise the plugin\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'mediasession',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n instance: MediaSessionPlugin\n };\n }\n\n constructor(params, ws) {\n this.params = params;\n this.wavesurfer = ws;\n\n if ('mediaSession' in navigator) {\n // update metadata\n this.metadata = this.params.metadata;\n this.update();\n\n // update metadata when playback starts\n this.wavesurfer.on('play', () => {\n this.update();\n });\n\n // set playback action handlers\n navigator.mediaSession.setActionHandler('play', () => {\n this.wavesurfer.play();\n });\n navigator.mediaSession.setActionHandler('pause', () => {\n this.wavesurfer.playPause();\n });\n navigator.mediaSession.setActionHandler('seekbackward', () => {\n this.wavesurfer.skipBackward();\n });\n navigator.mediaSession.setActionHandler('seekforward', () => {\n this.wavesurfer.skipForward();\n });\n }\n }\n\n init() {}\n\n destroy() {}\n\n update() {\n if (typeof MediaMetadata === typeof Function) {\n // set metadata\n navigator.mediaSession.metadata = new MediaMetadata(this.metadata);\n }\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(511);\n"],"names":["root","factory","exports","module","define","amd","self","MediaSessionPlugin","params","ws","this","wavesurfer","navigator","metadata","update","on","mediaSession","setActionHandler","play","playPause","skipBackward","skipForward","name","deferInit","instance","MediaMetadata","Function","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
1
+ {"version":3,"file":"wavesurfer.mediasession.min.js","mappings":";;;;;CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,aAAc,GAAIH,GACC,iBAAZC,QACdA,QAAoB,WAAID,KAExBD,EAAiB,WAAIA,EAAiB,YAAK,GAAIA,EAAiB,WAAgB,aAAIC,KARtF,CASGK,MAAM,WACT,Y,kfCwBqBC,EAAAA,WAmBjB,WAAYC,EAAQC,GAAI,Y,4FAAA,SACpBC,KAAKF,OAASA,EACdE,KAAKC,WAAaF,EAEd,iBAAkBG,YAElBF,KAAKG,SAAWH,KAAKF,OAAOK,SAC5BH,KAAKI,SAGLJ,KAAKC,WAAWI,GAAG,QAAQ,WACvB,EAAKD,YAITF,UAAUI,aAAaC,iBAAiB,QAAQ,WAC5C,EAAKN,WAAWO,UAEpBN,UAAUI,aAAaC,iBAAiB,SAAS,WAC7C,EAAKN,WAAWQ,eAEpBP,UAAUI,aAAaC,iBAAiB,gBAAgB,WACpD,EAAKN,WAAWS,kBAEpBR,UAAUI,aAAaC,iBAAiB,eAAe,WACnD,EAAKN,WAAWU,kB,4CAlC5B,SAAcb,GACV,MAAO,CACHc,KAAM,eACNC,aAAWf,IAAUA,EAAOe,YAAYf,EAAOe,UAC/Cf,OAAQA,EACRgB,SAAUjB,O,qBAkClB,c,qBAEA,c,oBAEA,YACQ,oBAAOkB,cAAP,cAAOA,mBAAP,oBAAgCC,SAAhC,cAAgCA,aAEhCd,UAAUI,aAAaH,SAAW,IAAIY,cAAcf,KAAKG,gB,gFAxDhDN,G,kCCjCjBoB,EAA2B,GCE/B,IAAIC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAa7B,QAGrB,IAAIC,EAASwB,EAAyBG,GAAY,CAGjD5B,QAAS,IAOV,OAHA+B,EAAoBH,GAAU3B,EAAQA,EAAOD,QAAS2B,GAG/C1B,EAAOD,QClBW2B,CAAoB,K,UHO9C","sources":["webpack://WaveSurfer.[name]/webpack/universalModuleDefinition","webpack://WaveSurfer.[name]/./src/plugin/mediasession/index.js","webpack://WaveSurfer.[name]/webpack/bootstrap","webpack://WaveSurfer.[name]/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"mediasession\"] = factory();\n})(self, function() {\nreturn ","/**\n * @typedef {Object} MediaSessionPluginParams\n * @property {MediaMetadata} metadata A MediaMetadata object: a representation\n * of the metadata associated with a MediaSession that can be used by user agents\n * to provide a customized user interface.\n * @property {?boolean} deferInit Set to true to manually call\n * `initPlugin('mediasession')`\n */\n\n/**\n * Visualize MediaSession information for a wavesurfer instance.\n *\n * @implements {PluginClass}\n * @extends {Observer}\n * @example\n * // es6\n * import MediaSessionPlugin from 'wavesurfer.mediasession.js';\n *\n * // commonjs\n * var MediaSessionPlugin = require('wavesurfer.mediasession.js');\n *\n * // if you are using <script> tags\n * var MediaSessionPlugin = window.WaveSurfer.mediasession;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * MediaSessionPlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\nexport default class MediaSessionPlugin {\n /**\n * MediaSession plugin definition factory\n *\n * This function must be used to create a plugin definition which can be\n * used by wavesurfer to correctly instantiate the plugin.\n *\n * @param {MediaSessionPluginParams} params parameters use to initialise the plugin\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'mediasession',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n instance: MediaSessionPlugin\n };\n }\n\n constructor(params, ws) {\n this.params = params;\n this.wavesurfer = ws;\n\n if ('mediaSession' in navigator) {\n // update metadata\n this.metadata = this.params.metadata;\n this.update();\n\n // update metadata when playback starts\n this.wavesurfer.on('play', () => {\n this.update();\n });\n\n // set playback action handlers\n navigator.mediaSession.setActionHandler('play', () => {\n this.wavesurfer.play();\n });\n navigator.mediaSession.setActionHandler('pause', () => {\n this.wavesurfer.playPause();\n });\n navigator.mediaSession.setActionHandler('seekbackward', () => {\n this.wavesurfer.skipBackward();\n });\n navigator.mediaSession.setActionHandler('seekforward', () => {\n this.wavesurfer.skipForward();\n });\n }\n }\n\n init() {}\n\n destroy() {}\n\n update() {\n if (typeof MediaMetadata === typeof Function) {\n // set metadata\n navigator.mediaSession.metadata = new MediaMetadata(this.metadata);\n }\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(511);\n"],"names":["root","factory","exports","module","define","amd","self","MediaSessionPlugin","params","ws","this","wavesurfer","navigator","metadata","update","on","mediaSession","setActionHandler","play","playPause","skipBackward","skipForward","name","deferInit","instance","MediaMetadata","Function","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wavesurfer.js microphone plugin 6.0.2 (2022-02-20)
2
+ * wavesurfer.js microphone 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 microphone plugin 6.0.2 (2022-02-20)
2
+ * wavesurfer.js microphone 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 minimap plugin 6.0.2 (2022-02-20)
2
+ * wavesurfer.js minimap plugin 6.1.0 (2022-03-31)
3
3
  * https://wavesurfer-js.org
4
4
  * @license BSD-3-Clause
5
5
  */
@@ -113,6 +113,7 @@ var MinimapPlugin = /*#__PURE__*/function () {
113
113
  this.drawer = new ws.Drawer(this.params.container, this.params);
114
114
  this.wavesurfer = ws;
115
115
  this.util = ws.util;
116
+ this.cleared = false;
116
117
  this.renderEvent = 'redraw';
117
118
  this.overviewRegion = null;
118
119
  this.regionsPlugin = this.wavesurfer[this.params.regionsPluginName];
@@ -137,7 +138,7 @@ var MinimapPlugin = /*#__PURE__*/function () {
137
138
  }
138
139
 
139
140
  if (_this.regionsPlugin && _this.params.showRegions) {
140
- _this.regions();
141
+ _this.drawRegions();
141
142
  }
142
143
 
143
144
  _this.render();
@@ -178,6 +179,23 @@ var MinimapPlugin = /*#__PURE__*/function () {
178
179
  }
179
180
  });
180
181
 
182
+ this._onLoading = function (percent) {
183
+ if (percent >= 100) {
184
+ _this.cleared = false;
185
+ return;
186
+ }
187
+
188
+ if (_this.cleared === true) {
189
+ return;
190
+ }
191
+
192
+ var len = _this.drawer.getWidth();
193
+
194
+ _this.drawer.drawPeaks([0], len, 0, len);
195
+
196
+ _this.cleared = true;
197
+ };
198
+
181
199
  this._onZoom = function (e) {
182
200
  _this.render();
183
201
  };
@@ -205,13 +223,14 @@ var MinimapPlugin = /*#__PURE__*/function () {
205
223
  this.wavesurfer.un('scroll', this._onScroll);
206
224
  this.wavesurfer.un('audioprocess', this._onAudioprocess);
207
225
  this.wavesurfer.un('zoom', this._onZoom);
226
+ this.wavesurfer.un('loading', this._onLoading);
208
227
  this.drawer.destroy();
209
228
  this.overviewRegion = null;
210
229
  this.unAll();
211
230
  }
212
231
  }, {
213
- key: "regions",
214
- value: function regions() {
232
+ key: "drawRegions",
233
+ value: function drawRegions() {
215
234
  var _this2 = this;
216
235
 
217
236
  this.regions = {};
@@ -288,6 +307,7 @@ var MinimapPlugin = /*#__PURE__*/function () {
288
307
  window.addEventListener('orientationchange', this._onResize, true);
289
308
  this.wavesurfer.on('audioprocess', this._onAudioprocess);
290
309
  this.wavesurfer.on('seek', this._onSeek);
310
+ this.wavesurfer.on('loading', this._onLoading);
291
311
 
292
312
  if (this.params.showOverview) {
293
313
  this.wavesurfer.on('scroll', this._onScroll);