wavesurfer.js 6.5.1 → 7.0.0-alpha.1

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 (132) hide show
  1. package/.eslintrc.json +24 -0
  2. package/.prettierrc +8 -0
  3. package/README.md +26 -117
  4. package/dist/base-plugin.d.ts +10 -0
  5. package/dist/base-plugin.js +13 -0
  6. package/dist/decoder.d.ts +10 -0
  7. package/dist/decoder.js +43 -0
  8. package/dist/event-emitter.d.ts +11 -0
  9. package/dist/event-emitter.js +21 -0
  10. package/dist/fetcher.d.ts +4 -0
  11. package/dist/fetcher.js +17 -0
  12. package/dist/index.d.ts +92 -0
  13. package/dist/index.js +166 -0
  14. package/dist/player-webaudio.d.ts +8 -0
  15. package/dist/player-webaudio.js +31 -0
  16. package/dist/player.d.ts +16 -0
  17. package/dist/player.js +40 -0
  18. package/dist/plugins/regions.d.ts +48 -0
  19. package/dist/plugins/regions.js +183 -0
  20. package/dist/renderer.d.ts +34 -0
  21. package/dist/renderer.js +193 -0
  22. package/dist/timer.d.ts +10 -0
  23. package/dist/timer.js +17 -0
  24. package/examples/audio.ogg +0 -0
  25. package/examples/bars.js +19 -0
  26. package/examples/basic.js +8 -0
  27. package/examples/gradient.js +28 -0
  28. package/examples/regions.js +63 -0
  29. package/examples/video.js +19 -0
  30. package/examples/webaudio.js +14 -0
  31. package/package.json +19 -99
  32. package/src/base-plugin.ts +20 -0
  33. package/src/decoder.ts +41 -0
  34. package/src/event-emitter.ts +35 -0
  35. package/src/fetcher.ts +7 -0
  36. package/src/index.ts +252 -0
  37. package/src/player-webaudio.ts +34 -0
  38. package/src/player.ts +50 -0
  39. package/src/plugins/regions.ts +240 -0
  40. package/src/renderer.ts +250 -0
  41. package/src/timer.ts +27 -0
  42. package/tsconfig.json +105 -0
  43. package/tutorial/index.html +47 -0
  44. package/tutorial/src/editor.js +70 -0
  45. package/tutorial/src/init.js +66 -0
  46. package/tutorial/src/url.js +25 -0
  47. package/tutorial/style.css +211 -0
  48. package/yarn-error.log +1049 -0
  49. package/LICENSE +0 -29
  50. package/dist/plugin/wavesurfer.cursor.js +0 -418
  51. package/dist/plugin/wavesurfer.cursor.js.map +0 -1
  52. package/dist/plugin/wavesurfer.cursor.min.js +0 -7
  53. package/dist/plugin/wavesurfer.cursor.min.js.map +0 -1
  54. package/dist/plugin/wavesurfer.elan.js +0 -381
  55. package/dist/plugin/wavesurfer.elan.js.map +0 -1
  56. package/dist/plugin/wavesurfer.elan.min.js +0 -7
  57. package/dist/plugin/wavesurfer.elan.min.js.map +0 -1
  58. package/dist/plugin/wavesurfer.markers.js +0 -520
  59. package/dist/plugin/wavesurfer.markers.js.map +0 -1
  60. package/dist/plugin/wavesurfer.markers.min.js +0 -7
  61. package/dist/plugin/wavesurfer.markers.min.js.map +0 -1
  62. package/dist/plugin/wavesurfer.mediasession.js +0 -181
  63. package/dist/plugin/wavesurfer.mediasession.js.map +0 -1
  64. package/dist/plugin/wavesurfer.mediasession.min.js +0 -7
  65. package/dist/plugin/wavesurfer.mediasession.min.js.map +0 -1
  66. package/dist/plugin/wavesurfer.microphone.js +0 -466
  67. package/dist/plugin/wavesurfer.microphone.js.map +0 -1
  68. package/dist/plugin/wavesurfer.microphone.min.js +0 -7
  69. package/dist/plugin/wavesurfer.microphone.min.js.map +0 -1
  70. package/dist/plugin/wavesurfer.minimap.js +0 -440
  71. package/dist/plugin/wavesurfer.minimap.js.map +0 -1
  72. package/dist/plugin/wavesurfer.minimap.min.js +0 -7
  73. package/dist/plugin/wavesurfer.minimap.min.js.map +0 -1
  74. package/dist/plugin/wavesurfer.playhead.js +0 -300
  75. package/dist/plugin/wavesurfer.playhead.js.map +0 -1
  76. package/dist/plugin/wavesurfer.playhead.min.js +0 -7
  77. package/dist/plugin/wavesurfer.playhead.min.js.map +0 -1
  78. package/dist/plugin/wavesurfer.regions.js +0 -1335
  79. package/dist/plugin/wavesurfer.regions.js.map +0 -1
  80. package/dist/plugin/wavesurfer.regions.min.js +0 -7
  81. package/dist/plugin/wavesurfer.regions.min.js.map +0 -1
  82. package/dist/plugin/wavesurfer.spectrogram.js +0 -736
  83. package/dist/plugin/wavesurfer.spectrogram.js.map +0 -1
  84. package/dist/plugin/wavesurfer.spectrogram.min.js +0 -7
  85. package/dist/plugin/wavesurfer.spectrogram.min.js.map +0 -1
  86. package/dist/plugin/wavesurfer.timeline.js +0 -649
  87. package/dist/plugin/wavesurfer.timeline.js.map +0 -1
  88. package/dist/plugin/wavesurfer.timeline.min.js +0 -7
  89. package/dist/plugin/wavesurfer.timeline.min.js.map +0 -1
  90. package/dist/wavesurfer-html-init.js +0 -381
  91. package/dist/wavesurfer-html-init.js.map +0 -1
  92. package/dist/wavesurfer-html-init.min.js +0 -7
  93. package/dist/wavesurfer-html-init.min.js.map +0 -1
  94. package/dist/wavesurfer.js +0 -6145
  95. package/dist/wavesurfer.js.map +0 -1
  96. package/dist/wavesurfer.min.js +0 -7
  97. package/dist/wavesurfer.min.js.map +0 -1
  98. package/src/drawer.canvasentry.js +0 -427
  99. package/src/drawer.js +0 -413
  100. package/src/drawer.multicanvas.js +0 -617
  101. package/src/html-init.js +0 -241
  102. package/src/mediaelement-webaudio.js +0 -77
  103. package/src/mediaelement.js +0 -443
  104. package/src/peakcache.js +0 -127
  105. package/src/plugin/cursor/index.js +0 -350
  106. package/src/plugin/elan/index.js +0 -307
  107. package/src/plugin/markers/index.js +0 -436
  108. package/src/plugin/mediasession/index.js +0 -94
  109. package/src/plugin/microphone/index.js +0 -415
  110. package/src/plugin/minimap/index.js +0 -403
  111. package/src/plugin/playhead/index.js +0 -226
  112. package/src/plugin/regions/index.js +0 -478
  113. package/src/plugin/regions/region.js +0 -875
  114. package/src/plugin/spectrogram/fft.js +0 -222
  115. package/src/plugin/spectrogram/index.js +0 -522
  116. package/src/plugin/timeline/index.js +0 -600
  117. package/src/util/absMax.js +0 -16
  118. package/src/util/clamp.js +0 -11
  119. package/src/util/fetch.js +0 -222
  120. package/src/util/frame.js +0 -13
  121. package/src/util/get-id.js +0 -22
  122. package/src/util/index.js +0 -14
  123. package/src/util/max.js +0 -16
  124. package/src/util/min.js +0 -16
  125. package/src/util/observer.js +0 -144
  126. package/src/util/orientation.js +0 -98
  127. package/src/util/prevent-click.js +0 -19
  128. package/src/util/request-animation-frame.js +0 -15
  129. package/src/util/silence-mode.js +0 -42
  130. package/src/util/style.js +0 -16
  131. package/src/wavesurfer.js +0 -1797
  132. package/src/webaudio.js +0 -779
@@ -1 +0,0 @@
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,+yBC4BA,IAGqBC,EAAa,WAuC9B,SAAAA,EAAYC,EAAQC,GAAI,IAAAC,EAAA,M,4FAAAC,CAAA,KAAAJ,GACpBK,KAAKJ,OAASA,EACdI,KAAKC,WAAaJ,EAClBG,KAAKE,KAAOL,EAAGK,KACfF,KAAKG,MAAQH,KAAKE,KAAKC,MACvBH,KAAKI,gBAAkB,EACvBJ,KAAKK,YAAc,GACnBL,KAAKM,aAAe,GACpBN,KAAKO,UAAW,EAGhBP,KAAKQ,UAAY,WACbV,EAAKW,wBACT,EAEAT,KAAKU,kBAAoB,WACrBZ,EAAKa,QAAUb,EAAKG,WAAWW,OAAOD,QAClCb,EAAKF,OAAOiB,SACZf,EAAKF,OAAOiB,QAAQC,SAAQ,SAAAC,GAAM,OAAIjB,EAAKkB,IAAID,EAAO,IAE1DE,OAAOC,iBAAiB,SAAUpB,EAAKU,WAAW,GAClDS,OAAOC,iBAAiB,oBAAqBpB,EAAKU,WAAW,GAC7DV,EAA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S,GAC1B7F,KAAK2G,OAAO,EAEpB,M,8EApWChH,CAAA,CArC6B,GAqC7BL,EAAAA,QAAAK,EAAAJ,EAAAD,QAAAA,EAAAsH,O,GC7EDC,EAA2B,CAAC,ECEhC,IAAIC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAa3H,QAGrB,IAAIC,EAASsH,EAAyBG,GAAY,CAGjD1H,QAAS,CAAC,GAOX,OAHA6H,EAAoBH,GAAUzH,EAAQA,EAAOD,QAASyH,GAG/CxH,EAAOD,OACf,CCnB0ByH,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\": \"inherit\",\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","_classCallCheck","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","key","value","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","_this2","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","_this3","setTimeout","_this4","remove","default","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
@@ -1,181 +0,0 @@
1
- /*!
2
- * wavesurfer.js mediasession plugin 6.5.1 (2023-03-12)
3
- * https://wavesurfer-js.org
4
- * @license BSD-3-Clause
5
- */
6
- (function webpackUniversalModuleDefinition(root, factory) {
7
- if(typeof exports === 'object' && typeof module === 'object')
8
- module.exports = factory();
9
- else if(typeof define === 'function' && define.amd)
10
- define("WaveSurfer", [], factory);
11
- else if(typeof exports === 'object')
12
- exports["WaveSurfer"] = factory();
13
- else
14
- root["WaveSurfer"] = root["WaveSurfer"] || {}, root["WaveSurfer"]["mediasession"] = factory();
15
- })(self, () => {
16
- return /******/ (() => { // webpackBootstrap
17
- /******/ "use strict";
18
- /******/ var __webpack_modules__ = ({
19
-
20
- /***/ "./src/plugin/mediasession/index.js":
21
- /*!******************************************!*\
22
- !*** ./src/plugin/mediasession/index.js ***!
23
- \******************************************/
24
- /***/ ((module, exports) => {
25
-
26
-
27
-
28
- Object.defineProperty(exports, "__esModule", ({
29
- value: true
30
- }));
31
- exports["default"] = void 0;
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); }
33
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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, _toPropertyKey(descriptor.key), descriptor); } }
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; }
36
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
37
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
38
- /**
39
- * @typedef {Object} MediaSessionPluginParams
40
- * @property {MediaMetadata} metadata A MediaMetadata object: a representation
41
- * of the metadata associated with a MediaSession that can be used by user agents
42
- * to provide a customized user interface.
43
- * @property {?boolean} deferInit Set to true to manually call
44
- * `initPlugin('mediasession')`
45
- */
46
- /**
47
- * Visualize MediaSession information for a wavesurfer instance.
48
- *
49
- * @implements {PluginClass}
50
- * @extends {Observer}
51
- * @example
52
- * // es6
53
- * import MediaSessionPlugin from 'wavesurfer.mediasession.js';
54
- *
55
- * // commonjs
56
- * var MediaSessionPlugin = require('wavesurfer.mediasession.js');
57
- *
58
- * // if you are using <script> tags
59
- * var MediaSessionPlugin = window.WaveSurfer.mediasession;
60
- *
61
- * // ... initialising wavesurfer with the plugin
62
- * var wavesurfer = WaveSurfer.create({
63
- * // wavesurfer options ...
64
- * plugins: [
65
- * MediaSessionPlugin.create({
66
- * // plugin options ...
67
- * })
68
- * ]
69
- * });
70
- */
71
- var MediaSessionPlugin = /*#__PURE__*/function () {
72
- function MediaSessionPlugin(params, ws) {
73
- var _this = this;
74
- _classCallCheck(this, MediaSessionPlugin);
75
- this.params = params;
76
- this.wavesurfer = ws;
77
- if ('mediaSession' in navigator) {
78
- // update metadata
79
- this.metadata = this.params.metadata;
80
- this.update();
81
-
82
- // update metadata when playback starts
83
- this.wavesurfer.on('play', function () {
84
- _this.update();
85
- });
86
-
87
- // set playback action handlers
88
- navigator.mediaSession.setActionHandler('play', function () {
89
- _this.wavesurfer.play();
90
- });
91
- navigator.mediaSession.setActionHandler('pause', function () {
92
- _this.wavesurfer.playPause();
93
- });
94
- navigator.mediaSession.setActionHandler('seekbackward', function () {
95
- _this.wavesurfer.skipBackward();
96
- });
97
- navigator.mediaSession.setActionHandler('seekforward', function () {
98
- _this.wavesurfer.skipForward();
99
- });
100
- }
101
- }
102
- _createClass(MediaSessionPlugin, [{
103
- key: "init",
104
- value: function init() {}
105
- }, {
106
- key: "destroy",
107
- value: function destroy() {}
108
- }, {
109
- key: "update",
110
- value: function update() {
111
- if ((typeof MediaMetadata === "undefined" ? "undefined" : _typeof(MediaMetadata)) === (typeof Function === "undefined" ? "undefined" : _typeof(Function))) {
112
- // set metadata
113
- navigator.mediaSession.metadata = new MediaMetadata(this.metadata);
114
- }
115
- }
116
- }], [{
117
- key: "create",
118
- value:
119
- /**
120
- * MediaSession plugin definition factory
121
- *
122
- * This function must be used to create a plugin definition which can be
123
- * used by wavesurfer to correctly instantiate the plugin.
124
- *
125
- * @param {MediaSessionPluginParams} params parameters use to initialise the plugin
126
- * @return {PluginDefinition} an object representing the plugin
127
- */
128
- function create(params) {
129
- return {
130
- name: 'mediasession',
131
- deferInit: params && params.deferInit ? params.deferInit : false,
132
- params: params,
133
- instance: MediaSessionPlugin
134
- };
135
- }
136
- }]);
137
- return MediaSessionPlugin;
138
- }();
139
- exports["default"] = MediaSessionPlugin;
140
- module.exports = exports.default;
141
-
142
- /***/ })
143
-
144
- /******/ });
145
- /************************************************************************/
146
- /******/ // The module cache
147
- /******/ var __webpack_module_cache__ = {};
148
- /******/
149
- /******/ // The require function
150
- /******/ function __webpack_require__(moduleId) {
151
- /******/ // Check if module is in cache
152
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
153
- /******/ if (cachedModule !== undefined) {
154
- /******/ return cachedModule.exports;
155
- /******/ }
156
- /******/ // Create a new module (and put it into the cache)
157
- /******/ var module = __webpack_module_cache__[moduleId] = {
158
- /******/ // no module.id needed
159
- /******/ // no module.loaded needed
160
- /******/ exports: {}
161
- /******/ };
162
- /******/
163
- /******/ // Execute the module function
164
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
165
- /******/
166
- /******/ // Return the exports of the module
167
- /******/ return module.exports;
168
- /******/ }
169
- /******/
170
- /************************************************************************/
171
- /******/
172
- /******/ // startup
173
- /******/ // Load entry module and return exports
174
- /******/ // This entry module is referenced by other modules so it can't be inlined
175
- /******/ var __webpack_exports__ = __webpack_require__("./src/plugin/mediasession/index.js");
176
- /******/
177
- /******/ return __webpack_exports__;
178
- /******/ })()
179
- ;
180
- });
181
- //# sourceMappingURL=wavesurfer.mediasession.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wavesurfer.mediasession.js","mappings":";;;;;AAAA;AACA;AAC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,kBAAA;IAAAiB,GAAA;IAAAC,KAAA,EAED,SAAAC,KAAA,EAAO,CAAC;EAAC;IAAAF,GAAA;IAAAC,KAAA,EAET,SAAAE,QAAA,EAAU,CAAC;EAAC;IAAAH,GAAA;IAAAC,KAAA,EAEZ,SAAAV,OAAA,EAAS;MACL,IAAI,QAAOa,aAAa,iCAAAC,OAAA,CAAbD,aAAa,eAAYE,QAAQ,iCAAAD,OAAA,CAARC,QAAQ,IAAE;QAC1C;QACAjB,SAAS,CAACI,YAAY,CAACH,QAAQ,GAAG,IAAIc,aAAa,CAAC,IAAI,CAACd,QAAQ,CAAC;MACtE;IACJ;EAAC;IAAAU,GAAA;IAAAC,KAAA;IAzDD;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACI,SAAAM,OAAcvB,MAAM,EAAE;MAClB,OAAO;QACHwB,IAAI,EAAE,cAAc;QACpBC,SAAS,EAAEzB,MAAM,IAAIA,MAAM,CAACyB,SAAS,GAAGzB,MAAM,CAACyB,SAAS,GAAG,KAAK;QAChEzB,MAAM,EAAEA,MAAM;QACd0B,QAAQ,EAAE3B;MACd,CAAC;IACL;EAAC;EAAA,OAAAA,kBAAA;AAAA;AAAA4B,kBAAA,GAAA5B,kBAAA;AAAA8B,MAAA,CAAAF,OAAA,GAAAA,OAAA,CAAAC,OAAA;;;;;;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","_this","_classCallCheck","wavesurfer","navigator","metadata","update","on","mediaSession","setActionHandler","play","playPause","skipBackward","skipForward","_createClass","key","value","init","destroy","MediaMetadata","_typeof","Function","create","name","deferInit","instance","exports","default","module"],"sourceRoot":""}
@@ -1,7 +0,0 @@
1
- /*!
2
- * wavesurfer.js mediasession plugin 6.5.1 (2023-03-12)
3
- * https://wavesurfer-js.org
4
- * @license BSD-3-Clause
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.mediasession=t())}(self,(()=>(()=>{"use strict";var e={511:(e,t)=>{function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function n(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,(i=a.key,o=void 0,o=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!==r(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(i,"string"),"symbol"===r(o)?o:String(o)),a)}var i,o}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function(){function e(t,r){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.params=t,this.wavesurfer=r,"mediaSession"in navigator&&(this.metadata=this.params.metadata,this.update(),this.wavesurfer.on("play",(function(){n.update()})),navigator.mediaSession.setActionHandler("play",(function(){n.wavesurfer.play()})),navigator.mediaSession.setActionHandler("pause",(function(){n.wavesurfer.playPause()})),navigator.mediaSession.setActionHandler("seekbackward",(function(){n.wavesurfer.skipBackward()})),navigator.mediaSession.setActionHandler("seekforward",(function(){n.wavesurfer.skipForward()})))}var t,a,i;return t=e,i=[{key:"create",value:function(t){return{name:"mediasession",deferInit:!(!t||!t.deferInit)&&t.deferInit,params:t,instance:e}}}],(a=[{key:"init",value:function(){}},{key:"destroy",value:function(){}},{key:"update",value:function(){("undefined"==typeof MediaMetadata?"undefined":r(MediaMetadata))===("undefined"==typeof Function?"undefined":r(Function))&&(navigator.mediaSession.metadata=new MediaMetadata(this.metadata))}}])&&n(t.prototype,a),i&&n(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.default=a,e.exports=t.default}},t={};var r=function r(n){var a=t[n];if(void 0!==a)return a.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}(511);return r})()));
7
- //# sourceMappingURL=wavesurfer.mediasession.min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CjB,UAAUI,aAAaH,SAAW,IAAIc,cAAcjB,KAAKG,UAEjE,M,8EAzCCR,CAAA,CAjBkC,GAiBlCL,EAAAA,QAAAK,EAAAJ,EAAAD,QAAAA,EAAA8B,O,GClDDC,EAA2B,CAAC,ECEhC,IAAIC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAanC,QAGrB,IAAIC,EAAS8B,EAAyBG,GAAY,CAGjDlC,QAAS,CAAC,GAOX,OAHAqC,EAAoBH,GAAUjC,EAAQA,EAAOD,QAASiC,GAG/ChC,EAAOD,OACf,CCnB0BiC,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","_classCallCheck","this","wavesurfer","navigator","metadata","update","on","mediaSession","setActionHandler","play","playPause","skipBackward","skipForward","key","value","name","deferInit","instance","MediaMetadata","_typeof","Function","default","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}