wavesurfer.js 6.3.0 → 6.4.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 (53) hide show
  1. package/README.md +1 -0
  2. package/dist/plugin/wavesurfer.cursor.js +29 -49
  3. package/dist/plugin/wavesurfer.cursor.js.map +1 -1
  4. package/dist/plugin/wavesurfer.cursor.min.js +2 -2
  5. package/dist/plugin/wavesurfer.cursor.min.js.map +1 -1
  6. package/dist/plugin/wavesurfer.elan.js +19 -49
  7. package/dist/plugin/wavesurfer.elan.js.map +1 -1
  8. package/dist/plugin/wavesurfer.elan.min.js +1 -1
  9. package/dist/plugin/wavesurfer.elan.min.js.map +1 -1
  10. package/dist/plugin/wavesurfer.markers.js +57 -72
  11. package/dist/plugin/wavesurfer.markers.js.map +1 -1
  12. package/dist/plugin/wavesurfer.markers.min.js +2 -2
  13. package/dist/plugin/wavesurfer.markers.min.js.map +1 -1
  14. package/dist/plugin/wavesurfer.mediasession.js +5 -15
  15. package/dist/plugin/wavesurfer.mediasession.js.map +1 -1
  16. package/dist/plugin/wavesurfer.mediasession.min.js +1 -1
  17. package/dist/plugin/wavesurfer.mediasession.min.js.map +1 -1
  18. package/dist/plugin/wavesurfer.microphone.js +44 -62
  19. package/dist/plugin/wavesurfer.microphone.js.map +1 -1
  20. package/dist/plugin/wavesurfer.microphone.min.js +1 -1
  21. package/dist/plugin/wavesurfer.microphone.min.js.map +1 -1
  22. package/dist/plugin/wavesurfer.minimap.js +16 -68
  23. package/dist/plugin/wavesurfer.minimap.js.map +1 -1
  24. package/dist/plugin/wavesurfer.minimap.min.js +1 -1
  25. package/dist/plugin/wavesurfer.minimap.min.js.map +1 -1
  26. package/dist/plugin/wavesurfer.playhead.js +2 -29
  27. package/dist/plugin/wavesurfer.playhead.js.map +1 -1
  28. package/dist/plugin/wavesurfer.playhead.min.js +1 -1
  29. package/dist/plugin/wavesurfer.playhead.min.js.map +1 -1
  30. package/dist/plugin/wavesurfer.regions.js +98 -252
  31. package/dist/plugin/wavesurfer.regions.js.map +1 -1
  32. package/dist/plugin/wavesurfer.regions.min.js +1 -1
  33. package/dist/plugin/wavesurfer.regions.min.js.map +1 -1
  34. package/dist/plugin/wavesurfer.spectrogram.js +51 -146
  35. package/dist/plugin/wavesurfer.spectrogram.js.map +1 -1
  36. package/dist/plugin/wavesurfer.spectrogram.min.js +1 -1
  37. package/dist/plugin/wavesurfer.spectrogram.min.js.map +1 -1
  38. package/dist/plugin/wavesurfer.timeline.js +42 -85
  39. package/dist/plugin/wavesurfer.timeline.js.map +1 -1
  40. package/dist/plugin/wavesurfer.timeline.min.js +1 -1
  41. package/dist/plugin/wavesurfer.timeline.min.js.map +1 -1
  42. package/dist/wavesurfer-html-init.js +31 -53
  43. package/dist/wavesurfer-html-init.js.map +1 -1
  44. package/dist/wavesurfer-html-init.min.js +1 -1
  45. package/dist/wavesurfer-html-init.min.js.map +1 -1
  46. package/dist/wavesurfer.js +419 -982
  47. package/dist/wavesurfer.js.map +1 -1
  48. package/dist/wavesurfer.min.js +2 -2
  49. package/dist/wavesurfer.min.js.map +1 -1
  50. package/package.json +6 -6
  51. package/src/plugin/cursor/index.js +15 -3
  52. package/src/plugin/markers/index.js +39 -0
  53. package/CHANGES.md +0 -482
@@ -1 +1 @@
1
- {"version":3,"file":"wavesurfer.markers.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,CAAC,EAAGA,EAAiB,WAAW,QAAIC,IAChF,CATD,CASGK,MAAM,IACT,M,wQC2BA,IAGqBC,EAAAA,WAuCjB,WAAYC,EAAQC,GAAI,Y,4FAAA,SACpBC,KAAKF,OAASA,EACdE,KAAKC,WAAaF,EAClBC,KAAK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,cAAenF,KAAKqF,eAAgBW,IAElEhG,KAAKqF,eAAe3C,KAAO1C,KAAKC,WAAWW,OAAOqF,YAAYD,GAAShG,KAAKC,WAAWyF,cACvF1F,KAAKS,yBACR,G,wBASD,SAAWuF,GAAO,WAQd,GAPIhG,KAAKqF,gBACLa,YAAW,WACP,EAAKb,gBAAiB,EACtB,EAAK9E,UAAW,CACnB,GAAE,GAGFP,KAAKO,SAAV,CAIAyF,EAAMf,kBACN,IAAMQ,EAAWzF,KAAKC,WAAWyF,cACjC1F,KAAKqF,eAAe3C,KAAO1C,KAAKC,WAAWW,OAAOqF,YAAYD,GAASP,EACvEzF,KAAKS,yBACLT,KAAKC,WAAWkF,UAAU,cAAenF,KAAKqF,eAAgBW,EAN7D,CAOJ,G,mBAKD,WACI,KAAQhG,KAAKa,QAAQ0E,OAAS,GAC1BvF,KAAKmG,OAAO,EAEnB,M,gFAnWgBtG,G,kCCvCjBuG,EAA2B,CAAC,ECEhC,IAAIC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAahH,QAGrB,IAAIC,EAAS2G,EAAyBG,GAAY,CAGjD/G,QAAS,CAAC,GAOX,OAHAkH,EAAoBH,GAAU9G,EAAQA,EAAOD,QAAS8G,GAG/C7G,EAAOD,OACf,CCnB0B8G,CAAoB,K,UHO9C","sources":["webpack://WaveSurfer/webpack/universalModuleDefinition","webpack://WaveSurfer/./src/plugin/markers/index.js","webpack://WaveSurfer/webpack/bootstrap","webpack://WaveSurfer/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\"][\"markers\"] = factory();\n})(self, () => {\nreturn ","/**\n * @typedef {Object} MarkerParams\n * @desc The parameters used to describe a marker.\n * @example wavesurfer.addMarker(regionParams);\n * @property {number} time The time to set the marker at\n * @property {?label} string An optional marker label\n * @property {?color} string Background color for marker\n * @property {?position} string \"top\" or \"bottom\", defaults to \"bottom\"\n * @property {?markerElement} element An HTML element to display instead of the default marker image\n * @property {?draggable} boolean Set marker as draggable, defaults to false\n * @property {?boolean} preventContextMenu Determines whether the context menu\n * is prevented from being opened, defaults to false\n */\n\n\n/**\n * Markers are points in time in the audio that can be jumped to.\n *\n * @implements {PluginClass}\n *\n * @example\n * import MarkersPlugin from 'wavesurfer.markers.js';\n *\n * // if you are using <script> tags\n * var MarkerPlugin = window.WaveSurfer.markers;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * MarkersPlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\n\nconst DEFAULT_FILL_COLOR = \"#D8D8D8\";\nconst DEFAULT_POSITION = \"bottom\";\n\nexport default class MarkersPlugin {\n /**\n * @typedef {Object} MarkersPluginParams\n * @property {?MarkerParams[]} markers Initial set of markers\n * @fires MarkersPlugin#marker-click\n * @fires MarkersPlugin#marker-drag\n * @fires MarkersPlugin#marker-drop\n */\n\n /**\n * Markers 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 {MarkersPluginParams} params parameters use to initialise the plugin\n * @since 4.6.0\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'markers',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n staticProps: {\n addMarker(options) {\n if (!this.initialisedPluginList.markers) {\n this.initPlugin('markers');\n }\n return this.markers.add(options);\n },\n clearMarkers() {\n this.markers && this.markers.clear();\n }\n },\n instance: MarkersPlugin\n };\n }\n\n constructor(params, ws) {\n this.params = params;\n this.wavesurfer = ws;\n this.util = ws.util;\n this.style = this.util.style;\n this.markerLineWidth = 1;\n this.markerWidth = 11;\n this.markerHeight = 22;\n this.dragging = false;\n\n\n this._onResize = () => {\n this._updateMarkerPositions();\n };\n\n this._onBackendCreated = () => {\n this.wrapper = this.wavesurfer.drawer.wrapper;\n if (this.params.markers) {\n this.params.markers.forEach(marker => this.add(marker));\n }\n window.addEventListener('resize', this._onResize, true);\n window.addEventListener('orientationchange', this._onResize, true);\n this.wavesurfer.on('zoom', this._onResize);\n\n if (!this.markers.find(marker => marker.draggable)){\n return;\n }\n\n this.onMouseMove = (e) => this._onMouseMove(e);\n window.addEventListener('mousemove', this.onMouseMove);\n\n this.onMouseUp = (e) => this._onMouseUp(e);\n window.addEventListener(\"mouseup\", this.onMouseUp);\n };\n\n this.markers = [];\n this._onReady = () => {\n this.wrapper = this.wavesurfer.drawer.wrapper;\n this._updateMarkerPositions();\n };\n }\n\n init() {\n // Check if ws is ready\n if (this.wavesurfer.isReady) {\n this._onBackendCreated();\n this._onReady();\n } else {\n this.wavesurfer.once('ready', this._onReady);\n this.wavesurfer.once('backend-created', this._onBackendCreated);\n }\n }\n\n destroy() {\n this.wavesurfer.un('ready', this._onReady);\n this.wavesurfer.un('backend-created', this._onBackendCreated);\n\n this.wavesurfer.un('zoom', this._onResize);\n\n window.removeEventListener('resize', this._onResize, true);\n window.removeEventListener('orientationchange', this._onResize, true);\n\n if (this.onMouseMove) {\n window.removeEventListener('mousemove', this.onMouseMove);\n }\n if (this.onMouseUp) {\n window.removeEventListener(\"mouseup\", this.onMouseUp);\n }\n\n this.clear();\n }\n\n /**\n * Add a marker\n *\n * @param {MarkerParams} params Marker definition\n * @return {object} The created marker\n */\n add(params) {\n let marker = {\n time: params.time,\n label: params.label,\n color: params.color || DEFAULT_FILL_COLOR,\n position: params.position || DEFAULT_POSITION,\n draggable: !!params.draggable,\n preventContextMenu: !!params.preventContextMenu\n };\n\n marker.el = this._createMarkerElement(marker, params.markerElement);\n\n this.wrapper.appendChild(marker.el);\n this.markers.push(marker);\n this._updateMarkerPositions();\n\n return marker;\n }\n\n /**\n * Remove a marker\n *\n * @param {number} index Index of the marker to remove\n */\n remove(index) {\n let marker = this.markers[index];\n if (!marker) {\n return;\n }\n let label = marker.el.getElementsByClassName(\"marker-label\")[0];\n if (label) {\n if (label._onContextMenu) {\n label.removeEventListener(\"contextmenu\", label._onContextMenu);\n }\n if (label._onClick) {\n label.removeEventListener(\"click\", label._onClick);\n }\n if (label._onMouseDown) {\n label.removeEventListener(\"mousedown\", label._onMouseDown);\n }\n }\n\n this.wrapper.removeChild(marker.el);\n this.markers.splice(index, 1);\n }\n\n _createPointerSVG(color, position) {\n const svgNS = \"http://www.w3.org/2000/svg\";\n\n const el = document.createElementNS(svgNS, \"svg\");\n const polygon = document.createElementNS(svgNS, \"polygon\");\n\n el.setAttribute(\"viewBox\", \"0 0 40 80\");\n\n polygon.setAttribute(\"id\", \"polygon\");\n polygon.setAttribute(\"stroke\", \"#979797\");\n polygon.setAttribute(\"fill\", color);\n polygon.setAttribute(\"points\", \"20 0 40 30 40 80 0 80 0 30\");\n if ( position == \"top\" ) {\n polygon.setAttribute(\"transform\", \"rotate(180, 20 40)\");\n }\n\n el.appendChild(polygon);\n\n this.style(el, {\n width: this.markerWidth + \"px\",\n height: this.markerHeight + \"px\",\n \"min-width\": this.markerWidth + \"px\",\n \"margin-right\": \"5px\",\n \"z-index\": 4\n });\n return el;\n }\n\n _createMarkerElement(marker, markerElement) {\n let label = marker.label;\n\n const el = document.createElement('marker');\n el.className = \"wavesurfer-marker\";\n\n this.style(el, {\n position: \"absolute\",\n height: \"100%\",\n display: \"flex\",\n overflow: \"hidden\",\n \"flex-direction\": (marker.position == \"top\" ? \"column-reverse\" : \"column\")\n });\n\n const line = document.createElement('div');\n const width = markerElement ? markerElement.width : this.markerWidth;\n marker.offset = (width - this.markerLineWidth) / 2;\n this.style(line, {\n \"flex-grow\": 1,\n \"margin-left\": marker.offset + \"px\",\n background: \"black\",\n width: this.markerLineWidth + \"px\",\n opacity: 0.1\n });\n el.appendChild(line);\n\n const labelDiv = document.createElement('div');\n const point = markerElement || this._createPointerSVG(marker.color, marker.position);\n if (marker.draggable){\n point.draggable = false;\n }\n labelDiv.appendChild(point);\n\n if ( label ) {\n const labelEl = document.createElement('span');\n labelEl.innerText = label;\n this.style(labelEl, {\n \"font-family\": \"monospace\",\n \"font-size\": \"90%\"\n });\n labelDiv.appendChild(labelEl);\n }\n\n this.style(labelDiv, {\n display: \"flex\",\n \"align-items\": \"center\",\n cursor: \"pointer\"\n });\n labelDiv.classList.add(\"marker-label\");\n\n el.appendChild(labelDiv);\n\n labelDiv._onClick = (e) => {\n e.stopPropagation();\n // Click event is caught when the marker-drop event was dispatched.\n // Drop event was dispatched at this moment, but this.dragging\n // is waiting for the next tick to set as false\n if (this.dragging){\n return;\n }\n this.wavesurfer.setCurrentTime(marker.time);\n this.wavesurfer.fireEvent(\"marker-click\", marker, e);\n };\n labelDiv.addEventListener(\"click\", labelDiv._onClick);\n\n labelDiv._onContextMenu = (e) => {\n if (marker.preventContextMenu) {\n e.preventDefault();\n }\n this.wavesurfer.fireEvent(\"marker-contextmenu\", marker, e);\n };\n labelDiv.addEventListener(\"contextmenu\", labelDiv._onContextMenu);\n\n if (marker.draggable) {\n labelDiv._onMouseDown = () => {\n this.selectedMarker = marker;\n };\n labelDiv.addEventListener(\"mousedown\", labelDiv._onMouseDown);\n }\n return el;\n }\n\n _updateMarkerPositions() {\n for ( let i = 0 ; i < this.markers.length; i++ ) {\n let marker = this.markers[i];\n this._updateMarkerPosition(marker);\n }\n }\n\n /**\n * Update a marker position based on its time property.\n *\n * @private\n * @param {MarkerParams} params The marker to update.\n * @returns {void}\n */\n _updateMarkerPosition(params) {\n const duration = this.wavesurfer.getDuration();\n const elementWidth =\n this.wavesurfer.drawer.width /\n this.wavesurfer.params.pixelRatio;\n\n const positionPct = Math.min(params.time / duration, 1);\n const leftPx = ((elementWidth * positionPct) - params.offset);\n this.style(params.el, {\n \"left\": leftPx + \"px\",\n \"max-width\": (elementWidth - leftPx) + \"px\"\n });\n }\n\n /**\n * Fires `marker-drag` event, update the `time` property for the\n * selected marker based on the mouse position, and calls to update\n * its position.\n *\n * @private\n * @param {MouseEvent} event The mouse event.\n * @returns {void}\n */\n _onMouseMove(event) {\n if (!this.selectedMarker){\n return;\n }\n if (!this.dragging){\n this.dragging = true;\n this.wavesurfer.fireEvent(\"marker-drag\", this.selectedMarker, event);\n }\n this.selectedMarker.time = this.wavesurfer.drawer.handleEvent(event) * this.wavesurfer.getDuration();\n this._updateMarkerPositions();\n }\n\n /**\n * Fires `marker-drop` event and unselect the dragged marker.\n *\n * @private\n * @param {MouseEvent} event The mouse event.\n * @returns {void}\n */\n _onMouseUp(event) {\n if (this.selectedMarker) {\n setTimeout(() => {\n this.selectedMarker = false;\n this.dragging = false;\n }, 0);\n }\n\n if (!this.dragging) {\n return;\n }\n\n event.stopPropagation();\n const duration = this.wavesurfer.getDuration();\n this.selectedMarker.time = this.wavesurfer.drawer.handleEvent(event) * duration;\n this._updateMarkerPositions();\n this.wavesurfer.fireEvent(\"marker-drop\", this.selectedMarker, event);\n }\n\n /**\n * Remove all markers\n */\n clear() {\n while ( this.markers.length > 0 ) {\n this.remove(0);\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__(188);\n"],"names":["root","factory","exports","module","define","amd","self","MarkersPlugin","params","ws","this","wavesurfer","util","style","markerLineWidth","markerWidth","markerHeight","dragging","_onResize","_updateMarkerPositions","_onBackendCreated","wrapper","drawer","markers","forEach","marker","add","window","addEventListener","on","find","draggable","onMouseMove","e","_onMouseMove","onMouseUp","_onMouseUp","_onReady","name","deferInit","staticProps","addMarker","options","initialisedPluginList","initPlugin","clearMarkers","clear","instance","isReady","once","un","removeEventListener","time","label","color","position","preventContextMenu","el","_createMarkerElement","markerElement","appendChild","push","index","getElementsByClassName","_onContextMenu","_onClick","_onMouseDown","removeChild","splice","svgNS","document","createElementNS","polygon","setAttribute","width","height","createElement","className","display","overflow","line","offset","background","opacity","labelDiv","point","_createPointerSVG","labelEl","innerText","cursor","classList","stopPropagation","setCurrentTime","fireEvent","preventDefault","selectedMarker","i","length","_updateMarkerPosition","duration","getDuration","elementWidth","pixelRatio","leftPx","Math","min","event","handleEvent","setTimeout","remove","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
1
+ {"version":3,"file":"wavesurfer.markers.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,CAAC,EAAGA,EAAiB,WAAW,QAAIC,IAChF,CATD,CASGK,MAAM,IACT,M,wQC4BA,IAGqBC,EAAa,WAuC9B,WAAYC,EAAQC,GAAI,Y,4FAAA,SACpBC,KAAKF,OAASA,EACdE,KAAKC,WAAaF,EAClBC,KAAKE,KAAOH,EAAGG,KACfF,KAAKG,MAAQH,KAAKE,KAAKC,MACvBH,KAAKI,gBAAkB,EACvBJ,KAAKK,YAAc,GACnBL,KAAKM,aAAe,GACp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,CAAC,ECEhC,IAAIC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAanH,QAGrB,IAAIC,EAAS8G,EAAyBG,GAAY,CAGjDlH,QAAS,CAAC,GAOX,OAHAqH,EAAoBH,GAAUjH,EAAQA,EAAOD,QAASiH,GAG/ChH,EAAOD,OACf,CCnB0BiH,CAAoB,K,UHO9C","sources":["webpack://WaveSurfer/webpack/universalModuleDefinition","webpack://WaveSurfer/./src/plugin/markers/index.js","webpack://WaveSurfer/webpack/bootstrap","webpack://WaveSurfer/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\"][\"markers\"] = factory();\n})(self, () => {\nreturn ","/**\n * @typedef {Object} MarkerParams\n * @desc The parameters used to describe a marker.\n * @example wavesurfer.addMarker(regionParams);\n * @property {number} time The time to set the marker at\n * @property {?label} string An optional marker label\n * @property {?tooltip} string An optional marker tooltip\n * @property {?color} string Background color for marker\n * @property {?position} string \"top\" or \"bottom\", defaults to \"bottom\"\n * @property {?markerElement} element An HTML element to display instead of the default marker image\n * @property {?draggable} boolean Set marker as draggable, defaults to false\n * @property {?boolean} preventContextMenu Determines whether the context menu\n * is prevented from being opened, defaults to false\n */\n\n\n/**\n * Markers are points in time in the audio that can be jumped to.\n *\n * @implements {PluginClass}\n *\n * @example\n * import MarkersPlugin from 'wavesurfer.markers.js';\n *\n * // if you are using <script> tags\n * var MarkerPlugin = window.WaveSurfer.markers;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * MarkersPlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\n\nconst DEFAULT_FILL_COLOR = \"#D8D8D8\";\nconst DEFAULT_POSITION = \"bottom\";\n\nexport default class MarkersPlugin {\n /**\n * @typedef {Object} MarkersPluginParams\n * @property {?MarkerParams[]} markers Initial set of markers\n * @fires MarkersPlugin#marker-click\n * @fires MarkersPlugin#marker-drag\n * @fires MarkersPlugin#marker-drop\n */\n\n /**\n * Markers 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 {MarkersPluginParams} params parameters use to initialise the plugin\n * @since 4.6.0\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'markers',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n staticProps: {\n addMarker(options) {\n if (!this.initialisedPluginList.markers) {\n this.initPlugin('markers');\n }\n return this.markers.add(options);\n },\n clearMarkers() {\n this.markers && this.markers.clear();\n }\n },\n instance: MarkersPlugin\n };\n }\n\n constructor(params, ws) {\n this.params = params;\n this.wavesurfer = ws;\n this.util = ws.util;\n this.style = this.util.style;\n this.markerLineWidth = 1;\n this.markerWidth = 11;\n this.markerHeight = 22;\n this.dragging = false;\n\n\n this._onResize = () => {\n this._updateMarkerPositions();\n };\n\n this._onBackendCreated = () => {\n this.wrapper = this.wavesurfer.drawer.wrapper;\n if (this.params.markers) {\n this.params.markers.forEach(marker => this.add(marker));\n }\n window.addEventListener('resize', this._onResize, true);\n window.addEventListener('orientationchange', this._onResize, true);\n this.wavesurfer.on('zoom', this._onResize);\n\n if (!this.markers.find(marker => marker.draggable)){\n return;\n }\n\n this.onMouseMove = (e) => this._onMouseMove(e);\n window.addEventListener('mousemove', this.onMouseMove);\n\n this.onMouseUp = (e) => this._onMouseUp(e);\n window.addEventListener(\"mouseup\", this.onMouseUp);\n };\n\n this.markers = [];\n this._onReady = () => {\n this.wrapper = this.wavesurfer.drawer.wrapper;\n this._updateMarkerPositions();\n };\n }\n\n init() {\n // Check if ws is ready\n if (this.wavesurfer.isReady) {\n this._onBackendCreated();\n this._onReady();\n } else {\n this.wavesurfer.once('ready', this._onReady);\n this.wavesurfer.once('backend-created', this._onBackendCreated);\n }\n }\n\n destroy() {\n this.wavesurfer.un('ready', this._onReady);\n this.wavesurfer.un('backend-created', this._onBackendCreated);\n\n this.wavesurfer.un('zoom', this._onResize);\n\n window.removeEventListener('resize', this._onResize, true);\n window.removeEventListener('orientationchange', this._onResize, true);\n\n if (this.onMouseMove) {\n window.removeEventListener('mousemove', this.onMouseMove);\n }\n if (this.onMouseUp) {\n window.removeEventListener(\"mouseup\", this.onMouseUp);\n }\n\n this.clear();\n }\n\n /**\n * Add a marker\n *\n * @param {MarkerParams} params Marker definition\n * @return {object} The created marker\n */\n add(params) {\n let marker = {\n time: params.time,\n label: params.label,\n tooltip: params.tooltip,\n color: params.color || DEFAULT_FILL_COLOR,\n position: params.position || DEFAULT_POSITION,\n draggable: !!params.draggable,\n preventContextMenu: !!params.preventContextMenu\n };\n\n marker.el = this._createMarkerElement(marker, params.markerElement);\n\n this.wrapper.appendChild(marker.el);\n this.markers.push(marker);\n this._updateMarkerPositions();\n\n this._registerEvents();\n\n return marker;\n }\n\n /**\n * Remove a marker\n *\n * @param {number} index Index of the marker to remove\n */\n remove(index) {\n let marker = this.markers[index];\n if (!marker) {\n return;\n }\n let label = marker.el.getElementsByClassName(\"marker-label\")[0];\n if (label) {\n if (label._onContextMenu) {\n label.removeEventListener(\"contextmenu\", label._onContextMenu);\n }\n if (label._onClick) {\n label.removeEventListener(\"click\", label._onClick);\n }\n if (label._onMouseDown) {\n label.removeEventListener(\"mousedown\", label._onMouseDown);\n }\n }\n\n this.wrapper.removeChild(marker.el);\n this.markers.splice(index, 1);\n\n this._unregisterEvents();\n }\n\n _createPointerSVG(color, position) {\n const svgNS = \"http://www.w3.org/2000/svg\";\n\n const el = document.createElementNS(svgNS, \"svg\");\n const polygon = document.createElementNS(svgNS, \"polygon\");\n\n el.setAttribute(\"viewBox\", \"0 0 40 80\");\n\n polygon.setAttribute(\"id\", \"polygon\");\n polygon.setAttribute(\"stroke\", \"#979797\");\n polygon.setAttribute(\"fill\", color);\n polygon.setAttribute(\"points\", \"20 0 40 30 40 80 0 80 0 30\");\n if ( position == \"top\" ) {\n polygon.setAttribute(\"transform\", \"rotate(180, 20 40)\");\n }\n\n el.appendChild(polygon);\n\n this.style(el, {\n width: this.markerWidth + \"px\",\n height: this.markerHeight + \"px\",\n \"min-width\": this.markerWidth + \"px\",\n \"margin-right\": \"5px\",\n \"z-index\": 4\n });\n return el;\n }\n\n _createMarkerElement(marker, markerElement) {\n let label = marker.label;\n let tooltip = marker.tooltip;\n\n const el = document.createElement('marker');\n el.className = \"wavesurfer-marker\";\n\n this.style(el, {\n position: \"absolute\",\n height: \"100%\",\n display: \"flex\",\n overflow: \"hidden\",\n \"flex-direction\": (marker.position == \"top\" ? \"column-reverse\" : \"column\")\n });\n\n const line = document.createElement('div');\n const width = markerElement ? markerElement.width : this.markerWidth;\n marker.offset = (width - this.markerLineWidth) / 2;\n this.style(line, {\n \"flex-grow\": 1,\n \"margin-left\": marker.offset + \"px\",\n background: \"black\",\n width: this.markerLineWidth + \"px\",\n opacity: 0.1\n });\n el.appendChild(line);\n\n const labelDiv = document.createElement('div');\n const point = markerElement || this._createPointerSVG(marker.color, marker.position);\n if (marker.draggable){\n point.draggable = false;\n }\n labelDiv.appendChild(point);\n\n if ( label ) {\n const labelEl = document.createElement('span');\n labelEl.innerText = label;\n labelEl.setAttribute('title', tooltip);\n this.style(labelEl, {\n \"font-family\": \"monospace\",\n \"font-size\": \"90%\"\n });\n labelDiv.appendChild(labelEl);\n }\n\n this.style(labelDiv, {\n display: \"flex\",\n \"align-items\": \"center\",\n cursor: \"pointer\"\n });\n labelDiv.classList.add(\"marker-label\");\n\n el.appendChild(labelDiv);\n\n labelDiv._onClick = (e) => {\n e.stopPropagation();\n // Click event is caught when the marker-drop event was dispatched.\n // Drop event was dispatched at this moment, but this.dragging\n // is waiting for the next tick to set as false\n if (this.dragging){\n return;\n }\n this.wavesurfer.setCurrentTime(marker.time);\n this.wavesurfer.fireEvent(\"marker-click\", marker, e);\n };\n labelDiv.addEventListener(\"click\", labelDiv._onClick);\n\n labelDiv._onContextMenu = (e) => {\n if (marker.preventContextMenu) {\n e.preventDefault();\n }\n this.wavesurfer.fireEvent(\"marker-contextmenu\", marker, e);\n };\n labelDiv.addEventListener(\"contextmenu\", labelDiv._onContextMenu);\n\n if (marker.draggable) {\n labelDiv._onMouseDown = () => {\n this.selectedMarker = marker;\n };\n labelDiv.addEventListener(\"mousedown\", labelDiv._onMouseDown);\n }\n return el;\n }\n\n _updateMarkerPositions() {\n for ( let i = 0 ; i < this.markers.length; i++ ) {\n let marker = this.markers[i];\n this._updateMarkerPosition(marker);\n }\n }\n\n /**\n * Update a marker position based on its time property.\n *\n * @private\n * @param {MarkerParams} params The marker to update.\n * @returns {void}\n */\n _updateMarkerPosition(params) {\n const duration = this.wavesurfer.getDuration();\n const elementWidth =\n this.wavesurfer.drawer.width /\n this.wavesurfer.params.pixelRatio;\n\n const positionPct = Math.min(params.time / duration, 1);\n const leftPx = ((elementWidth * positionPct) - params.offset);\n this.style(params.el, {\n \"left\": leftPx + \"px\",\n \"max-width\": (elementWidth - leftPx) + \"px\"\n });\n }\n\n /**\n * Fires `marker-drag` event, update the `time` property for the\n * selected marker based on the mouse position, and calls to update\n * its position.\n *\n * @private\n * @param {MouseEvent} event The mouse event.\n * @returns {void}\n */\n _onMouseMove(event) {\n if (!this.selectedMarker){\n return;\n }\n if (!this.dragging){\n this.dragging = true;\n this.wavesurfer.fireEvent(\"marker-drag\", this.selectedMarker, event);\n }\n this.selectedMarker.time = this.wavesurfer.drawer.handleEvent(event) * this.wavesurfer.getDuration();\n this._updateMarkerPositions();\n }\n\n /**\n * Fires `marker-drop` event and unselect the dragged marker.\n *\n * @private\n * @param {MouseEvent} event The mouse event.\n * @returns {void}\n */\n _onMouseUp(event) {\n if (this.selectedMarker) {\n setTimeout(() => {\n this.selectedMarker = false;\n this.dragging = false;\n }, 0);\n }\n\n if (!this.dragging) {\n return;\n }\n\n event.stopPropagation();\n const duration = this.wavesurfer.getDuration();\n this.selectedMarker.time = this.wavesurfer.drawer.handleEvent(event) * duration;\n this._updateMarkerPositions();\n this.wavesurfer.fireEvent(\"marker-drop\", this.selectedMarker, event);\n }\n\n _registerEvents() {\n if (!this.markers.find(marker => marker.draggable)) {\n return;\n }\n //we have some draggable markers, check for listeners\n if (!this.onMouseMove) {\n this.onMouseMove = (e) => this._onMouseMove(e);\n window.addEventListener('mousemove', this.onMouseMove);\n }\n\n if (!this.onMouseUp) {\n this.onMouseUp = (e) => this._onMouseUp(e);\n window.addEventListener(\"mouseup\", this.onMouseUp);\n }\n }\n\n _unregisterEvents() {\n if (this.markers.find(marker => marker.draggable)) {\n return;\n }\n //we don't have any draggable markers, unregister listeners\n if (this.onMouseMove) {\n window.removeEventListener('mousemove', this.onMouseMove);\n this.onMouseMove = null;\n }\n if (this.onMouseUp) {\n window.removeEventListener(\"mouseup\", this.onMouseUp);\n this.onMouseUp = null;\n }\n }\n\n /**\n * Remove all markers\n */\n clear() {\n while ( this.markers.length > 0 ) {\n this.remove(0);\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__(188);\n"],"names":["root","factory","exports","module","define","amd","self","MarkersPlugin","params","ws","this","wavesurfer","util","style","markerLineWidth","markerWidth","markerHeight","dragging","_onResize","_updateMarkerPositions","_onBackendCreated","wrapper","drawer","markers","forEach","marker","add","window","addEventListener","on","find","draggable","onMouseMove","e","_onMouseMove","onMouseUp","_onMouseUp","_onReady","name","deferInit","staticProps","addMarker","options","initialisedPluginList","initPlugin","clearMarkers","clear","instance","isReady","once","un","removeEventListener","time","label","tooltip","color","position","preventContextMenu","el","_createMarkerElement","markerElement","appendChild","push","_registerEvents","index","getElementsByClassName","_onContextMenu","_onClick","_onMouseDown","removeChild","splice","_unregisterEvents","svgNS","document","createElementNS","polygon","setAttribute","width","height","createElement","className","display","overflow","line","offset","background","opacity","labelDiv","point","_createPointerSVG","labelEl","innerText","cursor","classList","stopPropagation","setCurrentTime","fireEvent","preventDefault","selectedMarker","i","length","_updateMarkerPosition","duration","getDuration","elementWidth","pixelRatio","leftPx","Math","min","event","handleEvent","setTimeout","remove","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wavesurfer.js mediasession plugin 6.3.0 (2022-10-03)
2
+ * wavesurfer.js mediasession plugin 6.4.0 (2022-11-05)
3
3
  * https://wavesurfer-js.org
4
4
  * @license BSD-3-Clause
5
5
  */
@@ -29,15 +29,10 @@ Object.defineProperty(exports, "__esModule", ({
29
29
  value: true
30
30
  }));
31
31
  exports["default"] = void 0;
32
-
33
32
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
34
-
35
33
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
36
-
37
34
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
38
-
39
35
  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
-
41
36
  /**
42
37
  * @typedef {Object} MediaSessionPluginParams
43
38
  * @property {MediaMetadata} metadata A MediaMetadata object: a representation
@@ -46,7 +41,6 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
46
41
  * @property {?boolean} deferInit Set to true to manually call
47
42
  * `initPlugin('mediasession')`
48
43
  */
49
-
50
44
  /**
51
45
  * Visualize MediaSession information for a wavesurfer instance.
52
46
  *
@@ -75,21 +69,20 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
75
69
  var MediaSessionPlugin = /*#__PURE__*/function () {
76
70
  function MediaSessionPlugin(params, ws) {
77
71
  var _this = this;
78
-
79
72
  _classCallCheck(this, MediaSessionPlugin);
80
-
81
73
  this.params = params;
82
74
  this.wavesurfer = ws;
83
-
84
75
  if ('mediaSession' in navigator) {
85
76
  // update metadata
86
77
  this.metadata = this.params.metadata;
87
- this.update(); // update metadata when playback starts
78
+ this.update();
88
79
 
80
+ // update metadata when playback starts
89
81
  this.wavesurfer.on('play', function () {
90
82
  _this.update();
91
- }); // set playback action handlers
83
+ });
92
84
 
85
+ // set playback action handlers
93
86
  navigator.mediaSession.setActionHandler('play', function () {
94
87
  _this.wavesurfer.play();
95
88
  });
@@ -104,7 +97,6 @@ var MediaSessionPlugin = /*#__PURE__*/function () {
104
97
  });
105
98
  }
106
99
  }
107
-
108
100
  _createClass(MediaSessionPlugin, [{
109
101
  key: "init",
110
102
  value: function init() {}
@@ -140,10 +132,8 @@ var MediaSessionPlugin = /*#__PURE__*/function () {
140
132
  };
141
133
  }
142
134
  }]);
143
-
144
135
  return MediaSessionPlugin;
145
136
  }();
146
-
147
137
  exports["default"] = MediaSessionPlugin;
148
138
  module.exports = exports.default;
149
139
 
@@ -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;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;EAmBjB,4BAAYC,MAAZ,EAAoBC,EAApB,EAAwB;IAAA;;IAAA;;IACpB,KAAKD,MAAL,GAAcA,MAAd;IACA,KAAKE,UAAL,GAAkBD,EAAlB;;IAEA,IAAI,kBAAkBE,SAAtB,EAAiC;MAC7B;MACA,KAAKC,QAAL,GAAgB,KAAKJ,MAAL,CAAYI,QAA5B;MACA,KAAKC,MAAL,GAH6B,CAK7B;;MACA,KAAKH,UAAL,CAAgBI,EAAhB,CAAmB,MAAnB,EAA2B,YAAM;QAC7B,KAAI,CAACD,MAAL;MACH,CAFD,EAN6B,CAU7B;;MACAF,SAAS,CAACI,YAAV,CAAuBC,gBAAvB,CAAwC,MAAxC,EAAgD,YAAM;QAClD,KAAI,CAACN,UAAL,CAAgBO,IAAhB;MACH,CAFD;MAGAN,SAAS,CAACI,YAAV,CAAuBC,gBAAvB,CAAwC,OAAxC,EAAiD,YAAM;QACnD,KAAI,CAACN,UAAL,CAAgBQ,SAAhB;MACH,CAFD;MAGAP,SAAS,CAACI,YAAV,CAAuBC,gBAAvB,CAAwC,cAAxC,EAAwD,YAAM;QAC1D,KAAI,CAACN,UAAL,CAAgBS,YAAhB;MACH,CAFD;MAGAR,SAAS,CAACI,YAAV,CAAuBC,gBAAvB,CAAwC,aAAxC,EAAuD,YAAM;QACzD,KAAI,CAACN,UAAL,CAAgBU,WAAhB;MACH,CAFD;IAGH;EACJ;;;;WAED,gBAAO,CAAE;;;WAET,mBAAU,CAAE;;;WAEZ,kBAAS;MACL,IAAI,QAAOC,aAAP,yCAAOA,aAAP,eAAgCC,QAAhC,yCAAgCA,QAAhC,EAAJ,EAA8C;QAC1C;QACAX,SAAS,CAACI,YAAV,CAAuBH,QAAvB,GAAkC,IAAIS,aAAJ,CAAkB,KAAKT,QAAvB,CAAlC;MACH;IACJ;;;;IAzDD;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACI,gBAAcJ,MAAd,EAAsB;MAClB,OAAO;QACHe,IAAI,EAAE,cADH;QAEHC,SAAS,EAAEhB,MAAM,IAAIA,MAAM,CAACgB,SAAjB,GAA6BhB,MAAM,CAACgB,SAApC,GAAgD,KAFxD;QAGHhB,MAAM,EAAEA,MAHL;QAIHiB,QAAQ,EAAElB;MAJP,CAAP;IAMH;;;;;;;;;;;;;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/webpack/universalModuleDefinition","webpack://WaveSurfer/./src/plugin/mediasession/index.js","webpack://WaveSurfer/webpack/bootstrap","webpack://WaveSurfer/webpack/before-startup","webpack://WaveSurfer/webpack/startup","webpack://WaveSurfer/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, () => {\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
+ {"version":3,"file":"wavesurfer.mediasession.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;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;AAxBA,IAyBqBA,kBAAkB;EAmBnC,4BAAYC,MAAM,EAAEC,EAAE,EAAE;IAAA;IAAA;IACpB,IAAI,CAACD,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACE,UAAU,GAAGD,EAAE;IAEpB,IAAI,cAAc,IAAIE,SAAS,EAAE;MAC7B;MACA,IAAI,CAACC,QAAQ,GAAG,IAAI,CAACJ,MAAM,CAACI,QAAQ;MACpC,IAAI,CAACC,MAAM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AAAA;;;;;;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/webpack/universalModuleDefinition","webpack://WaveSurfer/./src/plugin/mediasession/index.js","webpack://WaveSurfer/webpack/bootstrap","webpack://WaveSurfer/webpack/before-startup","webpack://WaveSurfer/webpack/startup","webpack://WaveSurfer/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, () => {\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.3.0 (2022-10-03)
2
+ * wavesurfer.js mediasession plugin 6.4.0 (2022-11-05)
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,CAAC,EAAGA,EAAiB,WAAgB,aAAIC,IACrF,CATD,CASGK,MAAM,IACT,M,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,QACR,IAGDF,UAAUI,aAAaC,iBAAiB,QAAQ,WAC5C,EAAKN,WAAWO,MACnB,IACDN,UAAUI,aAAaC,iBAAiB,SAAS,WAC7C,EAAKN,WAAWQ,WACnB,IACDP,UAAUI,aAAaC,iBAAiB,gBAAgB,WACpD,EAAKN,WAAWS,cACnB,IACDR,UAAUI,aAAaC,iBAAiB,eAAe,WACnD,EAAKN,WAAWU,aACnB,IAER,C,4CArCD,SAAcb,GACV,MAAO,CACHc,KAAM,eACNC,aAAWf,IAAUA,EAAOe,YAAYf,EAAOe,UAC/Cf,OAAQA,EACRgB,SAAUjB,EAEjB,K,qBAgCD,WAAS,G,qBAET,WAAY,G,oBAEZ,YACQ,oBAAOkB,cAAP,cAAOA,mBAAP,oBAAgCC,SAAhC,cAAgCA,aAEhCd,UAAUI,aAAaH,SAAW,IAAIY,cAAcf,KAAKG,UAEhE,M,gFA1DgBN,G,kCCjCjBoB,EAA2B,CAAC,ECEhC,IAAIC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAa7B,QAGrB,IAAIC,EAASwB,EAAyBG,GAAY,CAGjD5B,QAAS,CAAC,GAOX,OAHA+B,EAAoBH,GAAU3B,EAAQA,EAAOD,QAAS2B,GAG/C1B,EAAOD,OACf,CCnB0B2B,CAAoB,K,UHO9C","sources":["webpack://WaveSurfer/webpack/universalModuleDefinition","webpack://WaveSurfer/./src/plugin/mediasession/index.js","webpack://WaveSurfer/webpack/bootstrap","webpack://WaveSurfer/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, () => {\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
+ {"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,CAAC,EAAGA,EAAiB,WAAgB,aAAIC,IACrF,CATD,CASGK,MAAM,IACT,M,8eCDA,IAyBqBC,EAAkB,WAmBnC,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,QACT,IAGAF,UAAUI,aAAaC,iBAAiB,QAAQ,WAC5C,EAAKN,WAAWO,MACpB,IACAN,UAAUI,aAAaC,iBAAiB,SAAS,WAC7C,EAAKN,WAAWQ,WACpB,IACAP,UAAUI,aAAaC,iBAAiB,gBAAgB,WACpD,EAAKN,WAAWS,cACpB,IACAR,UAAUI,aAAaC,iBAAiB,eAAe,WACnD,EAAKN,WAAWU,aACpB,IAER,C,UA9BC,O,EA8BA,E,EAWA,qBAhDD,SAAcb,GACV,MAAO,CACHc,KAAM,eACNC,aAAWf,IAAUA,EAAOe,YAAYf,EAAOe,UAC/Cf,OAAQA,EACRgB,SAAUjB,EAElB,K,EA8BC,mBAED,WAAQ,GAAC,qBAET,WAAW,GAAC,oBAEZ,YACiC,oBAAlBkB,cAAa,cAAbA,mBAAiC,oBAARC,SAAQ,cAARA,aAEhCd,UAAUI,aAAaH,SAAW,IAAIY,cAAcf,KAAKG,UAEjE,M,8EAzCC,EAjBkC,GAiBlC,+B,GClDDc,EAA2B,CAAC,ECEhC,IAAIC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAa7B,QAGrB,IAAIC,EAASwB,EAAyBG,GAAY,CAGjD5B,QAAS,CAAC,GAOX,OAHA+B,EAAoBH,GAAU3B,EAAQA,EAAOD,QAAS2B,GAG/C1B,EAAOD,OACf,CCnB0B2B,CAAoB,K,UHO9C","sources":["webpack://WaveSurfer/webpack/universalModuleDefinition","webpack://WaveSurfer/./src/plugin/mediasession/index.js","webpack://WaveSurfer/webpack/bootstrap","webpack://WaveSurfer/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, () => {\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":""}