wavesurfer.js 5.1.0 → 6.0.2
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.
- package/CHANGES.md +47 -0
- package/README.md +10 -0
- package/dist/plugin/wavesurfer.cursor.js +53 -51
- package/dist/plugin/wavesurfer.cursor.js.map +1 -1
- package/dist/plugin/wavesurfer.cursor.min.js +2 -2
- package/dist/plugin/wavesurfer.cursor.min.js.map +1 -1
- package/dist/plugin/wavesurfer.elan.js +10 -7
- package/dist/plugin/wavesurfer.elan.js.map +1 -1
- package/dist/plugin/wavesurfer.elan.min.js +2 -2
- package/dist/plugin/wavesurfer.elan.min.js.map +1 -1
- package/dist/plugin/wavesurfer.markers.js +142 -26
- package/dist/plugin/wavesurfer.markers.js.map +1 -1
- package/dist/plugin/wavesurfer.markers.min.js +2 -2
- package/dist/plugin/wavesurfer.markers.min.js.map +1 -1
- package/dist/plugin/wavesurfer.mediasession.js +6 -6
- package/dist/plugin/wavesurfer.mediasession.js.map +1 -1
- package/dist/plugin/wavesurfer.mediasession.min.js +2 -2
- package/dist/plugin/wavesurfer.mediasession.min.js.map +1 -1
- package/dist/plugin/wavesurfer.microphone.js +5 -5
- package/dist/plugin/wavesurfer.microphone.js.map +1 -1
- package/dist/plugin/wavesurfer.microphone.min.js +2 -2
- package/dist/plugin/wavesurfer.microphone.min.js.map +1 -1
- package/dist/plugin/wavesurfer.minimap.js +26 -23
- package/dist/plugin/wavesurfer.minimap.js.map +1 -1
- package/dist/plugin/wavesurfer.minimap.min.js +2 -2
- package/dist/plugin/wavesurfer.minimap.min.js.map +1 -1
- package/dist/plugin/wavesurfer.playhead.js +5 -5
- package/dist/plugin/wavesurfer.playhead.js.map +1 -1
- package/dist/plugin/wavesurfer.playhead.min.js +2 -2
- package/dist/plugin/wavesurfer.playhead.min.js.map +1 -1
- package/dist/plugin/wavesurfer.regions.js +88 -21
- package/dist/plugin/wavesurfer.regions.js.map +1 -1
- package/dist/plugin/wavesurfer.regions.min.js +2 -2
- package/dist/plugin/wavesurfer.regions.min.js.map +1 -1
- package/dist/plugin/wavesurfer.spectrogram.js +71 -58
- package/dist/plugin/wavesurfer.spectrogram.js.map +1 -1
- package/dist/plugin/wavesurfer.spectrogram.min.js +2 -2
- package/dist/plugin/wavesurfer.spectrogram.min.js.map +1 -1
- package/dist/plugin/wavesurfer.timeline.js +52 -54
- package/dist/plugin/wavesurfer.timeline.js.map +1 -1
- package/dist/plugin/wavesurfer.timeline.min.js +2 -2
- package/dist/plugin/wavesurfer.timeline.min.js.map +1 -1
- package/dist/wavesurfer-html-init.js +6 -6
- package/dist/wavesurfer-html-init.js.map +1 -1
- package/dist/wavesurfer-html-init.min.js +2 -2
- package/dist/wavesurfer-html-init.min.js.map +1 -1
- package/dist/wavesurfer.js +302 -133
- package/dist/wavesurfer.js.map +1 -1
- package/dist/wavesurfer.min.js +2 -2
- package/dist/wavesurfer.min.js.map +1 -1
- package/package.json +23 -23
- package/src/drawer.canvasentry.js +33 -6
- package/src/drawer.js +1 -0
- package/src/drawer.multicanvas.js +19 -8
- package/src/mediaelement.js +1 -1
- package/src/plugin/cursor/index.js +68 -70
- package/src/plugin/markers/index.js +112 -23
- package/src/plugin/minimap/index.js +24 -21
- package/src/plugin/regions/index.js +31 -4
- package/src/plugin/regions/region.js +45 -8
- package/src/plugin/spectrogram/index.js +65 -50
- package/src/plugin/timeline/index.js +11 -9
- package/src/util/index.js +1 -0
- package/src/util/silence-mode.js +35 -0
- package/src/wavesurfer.js +54 -23
- package/src/webaudio.js +10 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* wavesurfer.js timeline plugin
|
|
2
|
+
* wavesurfer.js timeline plugin 6.0.2 (2022-02-20)
|
|
3
3
|
* https://wavesurfer-js.org
|
|
4
4
|
* @license BSD-3-Clause
|
|
5
5
|
*/
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
exports["WaveSurfer"] = factory();
|
|
13
13
|
else
|
|
14
14
|
root["WaveSurfer"] = root["WaveSurfer"] || {}, root["WaveSurfer"]["timeline"] = factory();
|
|
15
|
-
})(
|
|
15
|
+
})(self, function() {
|
|
16
16
|
return /******/ (() => { // webpackBootstrap
|
|
17
17
|
/******/ "use strict";
|
|
18
18
|
/******/ var __webpack_modules__ = ({
|
|
@@ -28,13 +28,15 @@ return /******/ (() => { // webpackBootstrap
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", ({
|
|
29
29
|
value: true
|
|
30
30
|
}));
|
|
31
|
-
exports
|
|
31
|
+
exports["default"] = void 0;
|
|
32
32
|
|
|
33
33
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
34
34
|
|
|
35
35
|
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); } }
|
|
36
36
|
|
|
37
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
37
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
38
|
+
|
|
39
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
38
40
|
|
|
39
41
|
/**
|
|
40
42
|
* @typedef {Object} TimelinePluginParams
|
|
@@ -104,12 +106,41 @@ var TimelinePlugin = /*#__PURE__*/function () {
|
|
|
104
106
|
* @param {TimelinePluginParams} params Plugin parameters
|
|
105
107
|
* @param {object} ws Wavesurfer instance
|
|
106
108
|
*/
|
|
107
|
-
function TimelinePlugin(params,
|
|
109
|
+
function TimelinePlugin(params, _ws) {
|
|
108
110
|
var _this = this;
|
|
109
111
|
|
|
110
112
|
_classCallCheck(this, TimelinePlugin);
|
|
111
113
|
|
|
112
|
-
|
|
114
|
+
_defineProperty(this, "_onScroll", function () {
|
|
115
|
+
if (_this.wrapper && _this.drawer.wrapper) {
|
|
116
|
+
_this.wrapper.scrollLeft = _this.drawer.wrapper.scrollLeft;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
_defineProperty(this, "_onRedraw", function () {
|
|
121
|
+
return _this.render();
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
_defineProperty(this, "_onReady", function () {
|
|
125
|
+
var ws = _this.wavesurfer;
|
|
126
|
+
_this.drawer = ws.drawer;
|
|
127
|
+
_this.pixelRatio = ws.drawer.params.pixelRatio;
|
|
128
|
+
_this.maxCanvasWidth = ws.drawer.maxCanvasWidth || ws.drawer.width;
|
|
129
|
+
_this.maxCanvasElementWidth = ws.drawer.maxCanvasElementWidth || Math.round(_this.maxCanvasWidth / _this.pixelRatio); // add listeners
|
|
130
|
+
|
|
131
|
+
ws.drawer.wrapper.addEventListener('scroll', _this._onScroll);
|
|
132
|
+
ws.on('redraw', _this._onRedraw);
|
|
133
|
+
ws.on('zoom', _this._onZoom);
|
|
134
|
+
|
|
135
|
+
_this.render();
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
_defineProperty(this, "_onWrapperClick", function (e) {
|
|
139
|
+
e.preventDefault();
|
|
140
|
+
var relX = 'offsetX' in e ? e.offsetX : e.layerX;
|
|
141
|
+
|
|
142
|
+
_this.fireEvent('click', relX / _this.wrapper.scrollWidth || 0);
|
|
143
|
+
});
|
|
113
144
|
|
|
114
145
|
this.container = 'string' == typeof params.container ? document.querySelector(params.container) : params.container;
|
|
115
146
|
|
|
@@ -117,8 +148,8 @@ var TimelinePlugin = /*#__PURE__*/function () {
|
|
|
117
148
|
throw new Error('No container for wavesurfer timeline');
|
|
118
149
|
}
|
|
119
150
|
|
|
120
|
-
this.wavesurfer =
|
|
121
|
-
this.util =
|
|
151
|
+
this.wavesurfer = _ws;
|
|
152
|
+
this.util = _ws.util;
|
|
122
153
|
this.params = Object.assign({}, {
|
|
123
154
|
height: 20,
|
|
124
155
|
notchPercentHeight: 90,
|
|
@@ -481,18 +512,21 @@ var TimelinePlugin = /*#__PURE__*/function () {
|
|
|
481
512
|
var xOffset = 0;
|
|
482
513
|
this.canvases.forEach(function (canvas) {
|
|
483
514
|
var context = canvas.getContext('2d');
|
|
484
|
-
var canvasWidth = context.canvas.width;
|
|
485
515
|
|
|
486
|
-
if (
|
|
487
|
-
|
|
488
|
-
}
|
|
516
|
+
if (context) {
|
|
517
|
+
var canvasWidth = context.canvas.width;
|
|
489
518
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
}
|
|
519
|
+
if (xOffset > x + textWidth) {
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
494
522
|
|
|
495
|
-
|
|
523
|
+
if (xOffset + canvasWidth > x && context) {
|
|
524
|
+
textWidth = context.measureText(text).width;
|
|
525
|
+
context.fillText(text, x - xOffset, y);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
xOffset += canvasWidth;
|
|
529
|
+
}
|
|
496
530
|
});
|
|
497
531
|
}
|
|
498
532
|
/**
|
|
@@ -603,43 +637,7 @@ var TimelinePlugin = /*#__PURE__*/function () {
|
|
|
603
637
|
return TimelinePlugin;
|
|
604
638
|
}();
|
|
605
639
|
|
|
606
|
-
exports
|
|
607
|
-
|
|
608
|
-
var _initialiseProps = function _initialiseProps() {
|
|
609
|
-
var _this5 = this;
|
|
610
|
-
|
|
611
|
-
this._onScroll = function () {
|
|
612
|
-
if (_this5.wrapper && _this5.drawer.wrapper) {
|
|
613
|
-
_this5.wrapper.scrollLeft = _this5.drawer.wrapper.scrollLeft;
|
|
614
|
-
}
|
|
615
|
-
};
|
|
616
|
-
|
|
617
|
-
this._onRedraw = function () {
|
|
618
|
-
return _this5.render();
|
|
619
|
-
};
|
|
620
|
-
|
|
621
|
-
this._onReady = function () {
|
|
622
|
-
var ws = _this5.wavesurfer;
|
|
623
|
-
_this5.drawer = ws.drawer;
|
|
624
|
-
_this5.pixelRatio = ws.drawer.params.pixelRatio;
|
|
625
|
-
_this5.maxCanvasWidth = ws.drawer.maxCanvasWidth || ws.drawer.width;
|
|
626
|
-
_this5.maxCanvasElementWidth = ws.drawer.maxCanvasElementWidth || Math.round(_this5.maxCanvasWidth / _this5.pixelRatio); // add listeners
|
|
627
|
-
|
|
628
|
-
ws.drawer.wrapper.addEventListener('scroll', _this5._onScroll);
|
|
629
|
-
ws.on('redraw', _this5._onRedraw);
|
|
630
|
-
ws.on('zoom', _this5._onZoom);
|
|
631
|
-
|
|
632
|
-
_this5.render();
|
|
633
|
-
};
|
|
634
|
-
|
|
635
|
-
this._onWrapperClick = function (e) {
|
|
636
|
-
e.preventDefault();
|
|
637
|
-
var relX = 'offsetX' in e ? e.offsetX : e.layerX;
|
|
638
|
-
|
|
639
|
-
_this5.fireEvent('click', relX / _this5.wrapper.scrollWidth || 0);
|
|
640
|
-
};
|
|
641
|
-
};
|
|
642
|
-
|
|
640
|
+
exports["default"] = TimelinePlugin;
|
|
643
641
|
module.exports = exports.default;
|
|
644
642
|
|
|
645
643
|
/***/ })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://WaveSurfer.[name]/webpack/universalModuleDefinition","webpack://WaveSurfer.[name]/./src/plugin/timeline/index.js","webpack://WaveSurfer.[name]/webpack/bootstrap","webpack://WaveSurfer.[name]/webpack/startup"],"names":["TimelinePlugin","params","ws","container","document","querySelector","Error","wavesurfer","util","Object","assign","height","notchPercentHeight","labelPadding","unlabeledNotchColor","primaryColor","secondaryColor","primaryFontColor","secondaryFontColor","fontFamily","fontSize","duration","zoomDebounce","formatTimeCallback","defaultFormatTimeCallback","timeInterval","defaultTimeInterval","primaryLabelInterval","defaultPrimaryLabelInterval","secondaryLabelInterval","defaultSecondaryLabelInterval","offset","canvases","wrapper","drawer","pixelRatio","maxCanvasWidth","maxCanvasElementWidth","_onZoom","debounce","render","isReady","_onReady","once","unAll","un","_onRedraw","removeEventListener","_onScroll","parentNode","_onWrapperClick","removeChild","wsParams","innerHTML","appendChild","createElement","style","display","position","userSelect","webkitUserSelect","fillParent","scrollParent","width","overflowX","overflowY","addEventListener","createWrapper","updateCanvases","updateCanvasesPositioning","renderCanvases","canvas","push","zIndex","pop","parentElement","totalWidth","Math","round","scrollWidth","requiredCanvases","ceil","length","addCanvas","removeCanvas","canvasesLength","forEach","i","canvasWidth","left","backend","getDuration","totalSeconds","parseInt","getWidth","height1","height2","pixelsPerSecond","formatTime","intervalFnOrVal","option","curPixel","curSeconds","positioning","renderPositions","cb","pos","setFillStyles","setFonts","fillRect","fillText","fillStyle","context","getContext","font","x","y","leftOffset","intersection","x1","max","y1","x2","min","y2","text","textWidth","xOffset","measureText","seconds","pxPerSec","minutes","name","deferInit","instance","scrollLeft","on","e","preventDefault","relX","offsetX","layerX","fireEvent"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C,CAAC;AACD,O;;;;;;;;;;;;;;;;;;;;;;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACqBA,c;AAyDjB;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACI,0BAAYC,MAAZ,EAAoBC,EAApB,EAAwB;AAAA;;AAAA;;AAAA;;AACpB,SAAKC,SAAL,GACI,YAAY,OAAOF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DU,e,GAAkB,UAAAuF,CAAC,EAAI;AACnBA,KAAC,CAACC,cAAF;AACA,QAAMC,IAAI,GAAG,aAAaF,CAAb,GAAiBA,CAAC,CAACG,OAAnB,GAA6BH,CAAC,CAACI,MAA5C;;AACA,UAAI,CAACC,SAAL,CAAe,OAAf,EAAwBH,IAAI,GAAG,MAAI,CAAC1G,OAAL,CAAa8C,WAApB,IAAmC,CAA3D;AACH,G;;;;;;;;;UClHL;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;UCtBA;UACA;UACA;UACA","file":"wavesurfer.timeline.js","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\"][\"timeline\"] = factory();\n})(this, function() {\nreturn ","/**\n * @typedef {Object} TimelinePluginParams\n * @desc Extends the `WavesurferParams` wavesurfer was initialised with\n * @property {!string|HTMLElement} container CSS selector or HTML element where\n * the timeline should be drawn. This is the only required parameter.\n * @property {number} notchPercentHeight=90 Height of notches in percent\n * @property {string} unlabeledNotchColor='#c0c0c0' The colour of the notches\n * that do not have labels\n * @property {string} primaryColor='#000' The colour of the main notches\n * @property {string} secondaryColor='#c0c0c0' The colour of the secondary\n * notches\n * @property {string} primaryFontColor='#000' The colour of the labels next to\n * the main notches\n * @property {string} secondaryFontColor='#000' The colour of the labels next to\n * the secondary notches\n * @property {number} labelPadding=5 The padding between the label and the notch\n * @property {?number} zoomDebounce A debounce timeout to increase rendering\n * performance for large files\n * @property {string} fontFamily='Arial'\n * @property {number} fontSize=10 Font size of labels in pixels\n * @property {?number} duration Length of the track in seconds. Overrides\n * getDuration() for setting length of timeline\n * @property {function} formatTimeCallback (sec, pxPerSec) -> label\n * @property {function} timeInterval (pxPerSec) -> seconds between notches\n * @property {function} primaryLabelInterval (pxPerSec) -> cadence between\n * labels in primary color\n * @property {function} secondaryLabelInterval (pxPerSec) -> cadence between\n * labels in secondary color\n * @property {?number} offset Offset for the timeline start in seconds. May also be\n * negative.\n * @property {?boolean} deferInit Set to true to manually call\n * `initPlugin('timeline')`\n */\n\n/**\n * Adds a timeline to the waveform.\n *\n * @implements {PluginClass}\n * @extends {Observer}\n * @example\n * // es6\n * import TimelinePlugin from 'wavesurfer.timeline.js';\n *\n * // commonjs\n * var TimelinePlugin = require('wavesurfer.timeline.js');\n *\n * // if you are using <script> tags\n * var TimelinePlugin = window.WaveSurfer.timeline;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * TimelinePlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\nexport default class TimelinePlugin {\n /**\n * Timeline 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 {TimelinePluginParams} params parameters use to initialise the plugin\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'timeline',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n instance: TimelinePlugin\n };\n }\n\n // event handlers\n _onScroll = () => {\n if (this.wrapper && this.drawer.wrapper) {\n this.wrapper.scrollLeft = this.drawer.wrapper.scrollLeft;\n }\n };\n\n /**\n * @returns {void}\n */\n _onRedraw = () => this.render();\n\n _onReady = () => {\n const ws = this.wavesurfer;\n this.drawer = ws.drawer;\n this.pixelRatio = ws.drawer.params.pixelRatio;\n this.maxCanvasWidth = ws.drawer.maxCanvasWidth || ws.drawer.width;\n this.maxCanvasElementWidth =\n ws.drawer.maxCanvasElementWidth ||\n Math.round(this.maxCanvasWidth / this.pixelRatio);\n\n // add listeners\n ws.drawer.wrapper.addEventListener('scroll', this._onScroll);\n ws.on('redraw', this._onRedraw);\n ws.on('zoom', this._onZoom);\n\n this.render();\n };\n\n /**\n * @param {object} e Click event\n */\n _onWrapperClick = e => {\n e.preventDefault();\n const relX = 'offsetX' in e ? e.offsetX : e.layerX;\n this.fireEvent('click', relX / this.wrapper.scrollWidth || 0);\n };\n\n /**\n * Creates an instance of TimelinePlugin.\n *\n * You probably want to use TimelinePlugin.create()\n *\n * @param {TimelinePluginParams} params Plugin parameters\n * @param {object} ws Wavesurfer instance\n */\n constructor(params, ws) {\n this.container =\n 'string' == typeof params.container\n ? document.querySelector(params.container)\n : params.container;\n\n if (!this.container) {\n throw new Error('No container for wavesurfer timeline');\n }\n\n this.wavesurfer = ws;\n this.util = ws.util;\n this.params = Object.assign(\n {},\n {\n height: 20,\n notchPercentHeight: 90,\n labelPadding: 5,\n unlabeledNotchColor: '#c0c0c0',\n primaryColor: '#000',\n secondaryColor: '#c0c0c0',\n primaryFontColor: '#000',\n secondaryFontColor: '#000',\n fontFamily: 'Arial',\n fontSize: 10,\n duration: null,\n zoomDebounce: false,\n formatTimeCallback: this.defaultFormatTimeCallback,\n timeInterval: this.defaultTimeInterval,\n primaryLabelInterval: this.defaultPrimaryLabelInterval,\n secondaryLabelInterval: this.defaultSecondaryLabelInterval,\n offset: 0\n },\n params\n );\n\n this.canvases = [];\n this.wrapper = null;\n this.drawer = null;\n this.pixelRatio = null;\n this.maxCanvasWidth = null;\n this.maxCanvasElementWidth = null;\n /**\n * This event handler has to be in the constructor function because it\n * relies on the debounce function which is only available after\n * instantiation\n *\n * Use a debounced function if `params.zoomDebounce` is defined\n *\n * @returns {void}\n */\n this._onZoom = this.params.zoomDebounce\n ? this.wavesurfer.util.debounce(\n () => this.render(),\n this.params.zoomDebounce\n )\n : () => this.render();\n }\n\n /**\n * Initialisation function used by the plugin API\n */\n init() {\n // Check if ws is ready\n if (this.wavesurfer.isReady) {\n this._onReady();\n } else {\n this.wavesurfer.once('ready', this._onReady);\n }\n }\n\n /**\n * Destroy function used by the plugin API\n */\n destroy() {\n this.unAll();\n this.wavesurfer.un('redraw', this._onRedraw);\n this.wavesurfer.un('zoom', this._onZoom);\n this.wavesurfer.un('ready', this._onReady);\n this.wavesurfer.drawer.wrapper.removeEventListener(\n 'scroll',\n this._onScroll\n );\n if (this.wrapper && this.wrapper.parentNode) {\n this.wrapper.removeEventListener('click', this._onWrapperClick);\n this.wrapper.parentNode.removeChild(this.wrapper);\n this.wrapper = null;\n }\n }\n\n /**\n * Create a timeline element to wrap the canvases drawn by this plugin\n *\n */\n createWrapper() {\n const wsParams = this.wavesurfer.params;\n this.container.innerHTML = '';\n this.wrapper = this.container.appendChild(\n document.createElement('timeline')\n );\n this.util.style(this.wrapper, {\n display: 'block',\n position: 'relative',\n userSelect: 'none',\n webkitUserSelect: 'none',\n height: `${this.params.height}px`\n });\n\n if (wsParams.fillParent || wsParams.scrollParent) {\n this.util.style(this.wrapper, {\n width: '100%',\n overflowX: 'hidden',\n overflowY: 'hidden'\n });\n }\n\n this.wrapper.addEventListener('click', this._onWrapperClick);\n }\n\n /**\n * Render the timeline (also updates the already rendered timeline)\n *\n */\n render() {\n if (!this.wrapper) {\n this.createWrapper();\n }\n this.updateCanvases();\n this.updateCanvasesPositioning();\n this.renderCanvases();\n }\n\n /**\n * Add new timeline canvas\n *\n */\n addCanvas() {\n const canvas = this.wrapper.appendChild(\n document.createElement('canvas')\n );\n this.canvases.push(canvas);\n this.util.style(canvas, {\n position: 'absolute',\n zIndex: 4\n });\n }\n\n /**\n * Remove timeline canvas\n *\n */\n removeCanvas() {\n const canvas = this.canvases.pop();\n canvas.parentElement.removeChild(canvas);\n }\n\n /**\n * Make sure the correct of timeline canvas elements exist and are cached in\n * this.canvases\n *\n */\n updateCanvases() {\n const totalWidth = Math.round(this.drawer.wrapper.scrollWidth);\n const requiredCanvases = Math.ceil(\n totalWidth / this.maxCanvasElementWidth\n );\n\n while (this.canvases.length < requiredCanvases) {\n this.addCanvas();\n }\n\n while (this.canvases.length > requiredCanvases) {\n this.removeCanvas();\n }\n }\n\n /**\n * Update the dimensions and positioning style for all the timeline canvases\n *\n */\n updateCanvasesPositioning() {\n // cache length for performance\n const canvasesLength = this.canvases.length;\n this.canvases.forEach((canvas, i) => {\n // canvas width is the max element width, or if it is the last the\n // required width\n const canvasWidth =\n i === canvasesLength - 1\n ? this.drawer.wrapper.scrollWidth -\n this.maxCanvasElementWidth * (canvasesLength - 1)\n : this.maxCanvasElementWidth;\n // set dimensions and style\n canvas.width = canvasWidth * this.pixelRatio;\n // on certain pixel ratios the canvas appears cut off at the bottom,\n // therefore leave 1px extra\n canvas.height = (this.params.height + 1) * this.pixelRatio;\n this.util.style(canvas, {\n width: `${canvasWidth}px`,\n height: `${this.params.height}px`,\n left: `${i * this.maxCanvasElementWidth}px`\n });\n });\n }\n\n /**\n * Render the timeline labels and notches\n *\n */\n renderCanvases() {\n const duration =\n this.params.duration ||\n this.wavesurfer.backend.getDuration();\n\n if (duration <= 0) {\n return;\n }\n const wsParams = this.wavesurfer.params;\n const fontSize = this.params.fontSize * wsParams.pixelRatio;\n const totalSeconds = parseInt(duration, 10) + 1;\n const width =\n wsParams.fillParent && !wsParams.scrollParent\n ? this.drawer.getWidth()\n : this.drawer.wrapper.scrollWidth * wsParams.pixelRatio;\n const height1 = this.params.height * this.pixelRatio;\n const height2 =\n this.params.height *\n (this.params.notchPercentHeight / 100) *\n this.pixelRatio;\n const pixelsPerSecond = width / duration;\n\n const formatTime = this.params.formatTimeCallback;\n // if parameter is function, call the function with\n // pixelsPerSecond, otherwise simply take the value as-is\n const intervalFnOrVal = option =>\n typeof option === 'function' ? option(pixelsPerSecond) : option;\n const timeInterval = intervalFnOrVal(this.params.timeInterval);\n const primaryLabelInterval = intervalFnOrVal(\n this.params.primaryLabelInterval\n );\n const secondaryLabelInterval = intervalFnOrVal(\n this.params.secondaryLabelInterval\n );\n\n let curPixel = pixelsPerSecond * this.params.offset;\n let curSeconds = 0;\n let i;\n // build an array of position data with index, second and pixel data,\n // this is then used multiple times below\n const positioning = [];\n for (i = 0; i < totalSeconds / timeInterval; i++) {\n positioning.push([i, curSeconds, curPixel]);\n curSeconds += timeInterval;\n curPixel += pixelsPerSecond * timeInterval;\n }\n\n // iterate over each position\n const renderPositions = cb => {\n positioning.forEach(pos => {\n cb(pos[0], pos[1], pos[2]);\n });\n };\n\n // render primary labels\n this.setFillStyles(this.params.primaryColor);\n this.setFonts(`${fontSize}px ${this.params.fontFamily}`);\n this.setFillStyles(this.params.primaryFontColor);\n renderPositions((i, curSeconds, curPixel) => {\n if (i % primaryLabelInterval === 0) {\n this.fillRect(curPixel, 0, 1, height1);\n this.fillText(\n formatTime(curSeconds, pixelsPerSecond),\n curPixel + this.params.labelPadding * this.pixelRatio,\n height1\n );\n }\n });\n\n // render secondary labels\n this.setFillStyles(this.params.secondaryColor);\n this.setFonts(`${fontSize}px ${this.params.fontFamily}`);\n this.setFillStyles(this.params.secondaryFontColor);\n renderPositions((i, curSeconds, curPixel) => {\n if (i % secondaryLabelInterval === 0) {\n this.fillRect(curPixel, 0, 1, height1);\n this.fillText(\n formatTime(curSeconds, pixelsPerSecond),\n curPixel + this.params.labelPadding * this.pixelRatio,\n height1\n );\n }\n });\n\n // render the actual notches (when no labels are used)\n this.setFillStyles(this.params.unlabeledNotchColor);\n renderPositions((i, curSeconds, curPixel) => {\n if (\n i % secondaryLabelInterval !== 0 &&\n i % primaryLabelInterval !== 0\n ) {\n this.fillRect(curPixel, 0, 1, height2);\n }\n });\n }\n\n /**\n * Set the canvas fill style\n *\n * @param {DOMString|CanvasGradient|CanvasPattern} fillStyle Fill style to\n * use\n */\n setFillStyles(fillStyle) {\n this.canvases.forEach(canvas => {\n const context = canvas.getContext('2d');\n if (context) {\n context.fillStyle = fillStyle;\n }\n });\n }\n\n /**\n * Set the canvas font\n *\n * @param {DOMString} font Font to use\n */\n setFonts(font) {\n this.canvases.forEach(canvas => {\n const context = canvas.getContext('2d');\n if (context) {\n context.font = font;\n }\n });\n }\n\n /**\n * Draw a rectangle on the canvases\n *\n * (it figures out the offset for each canvas)\n *\n * @param {number} x X-position\n * @param {number} y Y-position\n * @param {number} width Width\n * @param {number} height Height\n */\n fillRect(x, y, width, height) {\n this.canvases.forEach((canvas, i) => {\n const leftOffset = i * this.maxCanvasWidth;\n\n const intersection = {\n x1: Math.max(x, i * this.maxCanvasWidth),\n y1: y,\n x2: Math.min(x + width, i * this.maxCanvasWidth + canvas.width),\n y2: y + height\n };\n\n if (intersection.x1 < intersection.x2) {\n const context = canvas\n .getContext('2d');\n if (context) {\n context\n .fillRect(\n intersection.x1 - leftOffset,\n intersection.y1,\n intersection.x2 - intersection.x1,\n intersection.y2 - intersection.y1\n );\n }\n }\n });\n }\n\n /**\n * Fill a given text on the canvases\n *\n * @param {string} text Text to render\n * @param {number} x X-position\n * @param {number} y Y-position\n */\n fillText(text, x, y) {\n let textWidth;\n let xOffset = 0;\n\n this.canvases.forEach(canvas => {\n const context = canvas.getContext('2d');\n const canvasWidth = context.canvas.width;\n\n if (xOffset > x + textWidth) {\n return;\n }\n\n if (xOffset + canvasWidth > x && context) {\n textWidth = context.measureText(text).width;\n context.fillText(text, x - xOffset, y);\n }\n\n xOffset += canvasWidth;\n });\n }\n\n /**\n * Turn the time into a suitable label for the time.\n *\n * @param {number} seconds Seconds to format\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Time\n */\n defaultFormatTimeCallback(seconds, pxPerSec) {\n if (seconds / 60 > 1) {\n // calculate minutes and seconds from seconds count\n const minutes = parseInt(seconds / 60, 10);\n seconds = parseInt(seconds % 60, 10);\n // fill up seconds with zeroes\n seconds = seconds < 10 ? '0' + seconds : seconds;\n return `${minutes}:${seconds}`;\n }\n return Math.round(seconds * 1000) / 1000;\n }\n\n /**\n * Return how many seconds should be between each notch\n *\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Time\n */\n defaultTimeInterval(pxPerSec) {\n if (pxPerSec >= 25) {\n return 1;\n } else if (pxPerSec * 5 >= 25) {\n return 5;\n } else if (pxPerSec * 15 >= 25) {\n return 15;\n }\n return Math.ceil(0.5 / pxPerSec) * 60;\n }\n\n /**\n * Return the cadence of notches that get labels in the primary color.\n *\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Cadence\n */\n defaultPrimaryLabelInterval(pxPerSec) {\n if (pxPerSec >= 25) {\n return 10;\n } else if (pxPerSec * 5 >= 25) {\n return 6;\n } else if (pxPerSec * 15 >= 25) {\n return 4;\n }\n return 4;\n }\n\n /**\n * Return the cadence of notches that get labels in the secondary color.\n *\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Cadence\n */\n defaultSecondaryLabelInterval(pxPerSec) {\n if (pxPerSec >= 25) {\n return 5;\n } else if (pxPerSec * 5 >= 25) {\n return 2;\n } else if (pxPerSec * 15 >= 25) {\n return 2;\n }\n return 2;\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/timeline/index.js\");\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"wavesurfer.timeline.js","mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C,CAAC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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UACA;UACA;UACA","sources":["webpack://WaveSurfer.[name]/webpack/universalModuleDefinition","webpack://WaveSurfer.[name]/./src/plugin/timeline/index.js","webpack://WaveSurfer.[name]/webpack/bootstrap","webpack://WaveSurfer.[name]/webpack/before-startup","webpack://WaveSurfer.[name]/webpack/startup","webpack://WaveSurfer.[name]/webpack/after-startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"timeline\"] = factory();\n})(self, function() {\nreturn ","/**\n * @typedef {Object} TimelinePluginParams\n * @desc Extends the `WavesurferParams` wavesurfer was initialised with\n * @property {!string|HTMLElement} container CSS selector or HTML element where\n * the timeline should be drawn. This is the only required parameter.\n * @property {number} notchPercentHeight=90 Height of notches in percent\n * @property {string} unlabeledNotchColor='#c0c0c0' The colour of the notches\n * that do not have labels\n * @property {string} primaryColor='#000' The colour of the main notches\n * @property {string} secondaryColor='#c0c0c0' The colour of the secondary\n * notches\n * @property {string} primaryFontColor='#000' The colour of the labels next to\n * the main notches\n * @property {string} secondaryFontColor='#000' The colour of the labels next to\n * the secondary notches\n * @property {number} labelPadding=5 The padding between the label and the notch\n * @property {?number} zoomDebounce A debounce timeout to increase rendering\n * performance for large files\n * @property {string} fontFamily='Arial'\n * @property {number} fontSize=10 Font size of labels in pixels\n * @property {?number} duration Length of the track in seconds. Overrides\n * getDuration() for setting length of timeline\n * @property {function} formatTimeCallback (sec, pxPerSec) -> label\n * @property {function} timeInterval (pxPerSec) -> seconds between notches\n * @property {function} primaryLabelInterval (pxPerSec) -> cadence between\n * labels in primary color\n * @property {function} secondaryLabelInterval (pxPerSec) -> cadence between\n * labels in secondary color\n * @property {?number} offset Offset for the timeline start in seconds. May also be\n * negative.\n * @property {?boolean} deferInit Set to true to manually call\n * `initPlugin('timeline')`\n */\n\n/**\n * Adds a timeline to the waveform.\n *\n * @implements {PluginClass}\n * @extends {Observer}\n * @example\n * // es6\n * import TimelinePlugin from 'wavesurfer.timeline.js';\n *\n * // commonjs\n * var TimelinePlugin = require('wavesurfer.timeline.js');\n *\n * // if you are using <script> tags\n * var TimelinePlugin = window.WaveSurfer.timeline;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * TimelinePlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\nexport default class TimelinePlugin {\n /**\n * Timeline 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 {TimelinePluginParams} params parameters use to initialise the plugin\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'timeline',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n instance: TimelinePlugin\n };\n }\n\n // event handlers\n _onScroll = () => {\n if (this.wrapper && this.drawer.wrapper) {\n this.wrapper.scrollLeft = this.drawer.wrapper.scrollLeft;\n }\n };\n\n /**\n * @returns {void}\n */\n _onRedraw = () => this.render();\n\n _onReady = () => {\n const ws = this.wavesurfer;\n this.drawer = ws.drawer;\n this.pixelRatio = ws.drawer.params.pixelRatio;\n this.maxCanvasWidth = ws.drawer.maxCanvasWidth || ws.drawer.width;\n this.maxCanvasElementWidth =\n ws.drawer.maxCanvasElementWidth ||\n Math.round(this.maxCanvasWidth / this.pixelRatio);\n\n // add listeners\n ws.drawer.wrapper.addEventListener('scroll', this._onScroll);\n ws.on('redraw', this._onRedraw);\n ws.on('zoom', this._onZoom);\n\n this.render();\n };\n\n /**\n * @param {object} e Click event\n */\n _onWrapperClick = e => {\n e.preventDefault();\n const relX = 'offsetX' in e ? e.offsetX : e.layerX;\n this.fireEvent('click', relX / this.wrapper.scrollWidth || 0);\n };\n\n /**\n * Creates an instance of TimelinePlugin.\n *\n * You probably want to use TimelinePlugin.create()\n *\n * @param {TimelinePluginParams} params Plugin parameters\n * @param {object} ws Wavesurfer instance\n */\n constructor(params, ws) {\n this.container =\n 'string' == typeof params.container\n ? document.querySelector(params.container)\n : params.container;\n\n if (!this.container) {\n throw new Error('No container for wavesurfer timeline');\n }\n\n this.wavesurfer = ws;\n this.util = ws.util;\n this.params = Object.assign(\n {},\n {\n height: 20,\n notchPercentHeight: 90,\n labelPadding: 5,\n unlabeledNotchColor: '#c0c0c0',\n primaryColor: '#000',\n secondaryColor: '#c0c0c0',\n primaryFontColor: '#000',\n secondaryFontColor: '#000',\n fontFamily: 'Arial',\n fontSize: 10,\n duration: null,\n zoomDebounce: false,\n formatTimeCallback: this.defaultFormatTimeCallback,\n timeInterval: this.defaultTimeInterval,\n primaryLabelInterval: this.defaultPrimaryLabelInterval,\n secondaryLabelInterval: this.defaultSecondaryLabelInterval,\n offset: 0\n },\n params\n );\n\n this.canvases = [];\n this.wrapper = null;\n this.drawer = null;\n this.pixelRatio = null;\n this.maxCanvasWidth = null;\n this.maxCanvasElementWidth = null;\n /**\n * This event handler has to be in the constructor function because it\n * relies on the debounce function which is only available after\n * instantiation\n *\n * Use a debounced function if `params.zoomDebounce` is defined\n *\n * @returns {void}\n */\n this._onZoom = this.params.zoomDebounce\n ? this.wavesurfer.util.debounce(\n () => this.render(),\n this.params.zoomDebounce\n )\n : () => this.render();\n }\n\n /**\n * Initialisation function used by the plugin API\n */\n init() {\n // Check if ws is ready\n if (this.wavesurfer.isReady) {\n this._onReady();\n } else {\n this.wavesurfer.once('ready', this._onReady);\n }\n }\n\n /**\n * Destroy function used by the plugin API\n */\n destroy() {\n this.unAll();\n this.wavesurfer.un('redraw', this._onRedraw);\n this.wavesurfer.un('zoom', this._onZoom);\n this.wavesurfer.un('ready', this._onReady);\n this.wavesurfer.drawer.wrapper.removeEventListener(\n 'scroll',\n this._onScroll\n );\n if (this.wrapper && this.wrapper.parentNode) {\n this.wrapper.removeEventListener('click', this._onWrapperClick);\n this.wrapper.parentNode.removeChild(this.wrapper);\n this.wrapper = null;\n }\n }\n\n /**\n * Create a timeline element to wrap the canvases drawn by this plugin\n *\n */\n createWrapper() {\n const wsParams = this.wavesurfer.params;\n this.container.innerHTML = '';\n this.wrapper = this.container.appendChild(\n document.createElement('timeline')\n );\n this.util.style(this.wrapper, {\n display: 'block',\n position: 'relative',\n userSelect: 'none',\n webkitUserSelect: 'none',\n height: `${this.params.height}px`\n });\n\n if (wsParams.fillParent || wsParams.scrollParent) {\n this.util.style(this.wrapper, {\n width: '100%',\n overflowX: 'hidden',\n overflowY: 'hidden'\n });\n }\n\n this.wrapper.addEventListener('click', this._onWrapperClick);\n }\n\n /**\n * Render the timeline (also updates the already rendered timeline)\n *\n */\n render() {\n if (!this.wrapper) {\n this.createWrapper();\n }\n this.updateCanvases();\n this.updateCanvasesPositioning();\n this.renderCanvases();\n }\n\n /**\n * Add new timeline canvas\n *\n */\n addCanvas() {\n const canvas = this.wrapper.appendChild(\n document.createElement('canvas')\n );\n this.canvases.push(canvas);\n this.util.style(canvas, {\n position: 'absolute',\n zIndex: 4\n });\n }\n\n /**\n * Remove timeline canvas\n *\n */\n removeCanvas() {\n const canvas = this.canvases.pop();\n canvas.parentElement.removeChild(canvas);\n }\n\n /**\n * Make sure the correct of timeline canvas elements exist and are cached in\n * this.canvases\n *\n */\n updateCanvases() {\n const totalWidth = Math.round(this.drawer.wrapper.scrollWidth);\n const requiredCanvases = Math.ceil(\n totalWidth / this.maxCanvasElementWidth\n );\n\n while (this.canvases.length < requiredCanvases) {\n this.addCanvas();\n }\n\n while (this.canvases.length > requiredCanvases) {\n this.removeCanvas();\n }\n }\n\n /**\n * Update the dimensions and positioning style for all the timeline canvases\n *\n */\n updateCanvasesPositioning() {\n // cache length for performance\n const canvasesLength = this.canvases.length;\n this.canvases.forEach((canvas, i) => {\n // canvas width is the max element width, or if it is the last the\n // required width\n const canvasWidth =\n i === canvasesLength - 1\n ? this.drawer.wrapper.scrollWidth -\n this.maxCanvasElementWidth * (canvasesLength - 1)\n : this.maxCanvasElementWidth;\n // set dimensions and style\n canvas.width = canvasWidth * this.pixelRatio;\n // on certain pixel ratios the canvas appears cut off at the bottom,\n // therefore leave 1px extra\n canvas.height = (this.params.height + 1) * this.pixelRatio;\n this.util.style(canvas, {\n width: `${canvasWidth}px`,\n height: `${this.params.height}px`,\n left: `${i * this.maxCanvasElementWidth}px`\n });\n });\n }\n\n /**\n * Render the timeline labels and notches\n *\n */\n renderCanvases() {\n const duration =\n this.params.duration ||\n this.wavesurfer.backend.getDuration();\n\n if (duration <= 0) {\n return;\n }\n const wsParams = this.wavesurfer.params;\n const fontSize = this.params.fontSize * wsParams.pixelRatio;\n const totalSeconds = parseInt(duration, 10) + 1;\n const width =\n wsParams.fillParent && !wsParams.scrollParent\n ? this.drawer.getWidth()\n : this.drawer.wrapper.scrollWidth * wsParams.pixelRatio;\n const height1 = this.params.height * this.pixelRatio;\n const height2 =\n this.params.height *\n (this.params.notchPercentHeight / 100) *\n this.pixelRatio;\n const pixelsPerSecond = width / duration;\n\n const formatTime = this.params.formatTimeCallback;\n // if parameter is function, call the function with\n // pixelsPerSecond, otherwise simply take the value as-is\n const intervalFnOrVal = option =>\n typeof option === 'function' ? option(pixelsPerSecond) : option;\n const timeInterval = intervalFnOrVal(this.params.timeInterval);\n const primaryLabelInterval = intervalFnOrVal(\n this.params.primaryLabelInterval\n );\n const secondaryLabelInterval = intervalFnOrVal(\n this.params.secondaryLabelInterval\n );\n\n let curPixel = pixelsPerSecond * this.params.offset;\n let curSeconds = 0;\n let i;\n // build an array of position data with index, second and pixel data,\n // this is then used multiple times below\n const positioning = [];\n for (i = 0; i < totalSeconds / timeInterval; i++) {\n positioning.push([i, curSeconds, curPixel]);\n curSeconds += timeInterval;\n curPixel += pixelsPerSecond * timeInterval;\n }\n\n // iterate over each position\n const renderPositions = cb => {\n positioning.forEach(pos => {\n cb(pos[0], pos[1], pos[2]);\n });\n };\n\n // render primary labels\n this.setFillStyles(this.params.primaryColor);\n this.setFonts(`${fontSize}px ${this.params.fontFamily}`);\n this.setFillStyles(this.params.primaryFontColor);\n renderPositions((i, curSeconds, curPixel) => {\n if (i % primaryLabelInterval === 0) {\n this.fillRect(curPixel, 0, 1, height1);\n this.fillText(\n formatTime(curSeconds, pixelsPerSecond),\n curPixel + this.params.labelPadding * this.pixelRatio,\n height1\n );\n }\n });\n\n // render secondary labels\n this.setFillStyles(this.params.secondaryColor);\n this.setFonts(`${fontSize}px ${this.params.fontFamily}`);\n this.setFillStyles(this.params.secondaryFontColor);\n renderPositions((i, curSeconds, curPixel) => {\n if (i % secondaryLabelInterval === 0) {\n this.fillRect(curPixel, 0, 1, height1);\n this.fillText(\n formatTime(curSeconds, pixelsPerSecond),\n curPixel + this.params.labelPadding * this.pixelRatio,\n height1\n );\n }\n });\n\n // render the actual notches (when no labels are used)\n this.setFillStyles(this.params.unlabeledNotchColor);\n renderPositions((i, curSeconds, curPixel) => {\n if (\n i % secondaryLabelInterval !== 0 &&\n i % primaryLabelInterval !== 0\n ) {\n this.fillRect(curPixel, 0, 1, height2);\n }\n });\n }\n\n /**\n * Set the canvas fill style\n *\n * @param {DOMString|CanvasGradient|CanvasPattern} fillStyle Fill style to\n * use\n */\n setFillStyles(fillStyle) {\n this.canvases.forEach(canvas => {\n const context = canvas.getContext('2d');\n if (context) {\n context.fillStyle = fillStyle;\n }\n });\n }\n\n /**\n * Set the canvas font\n *\n * @param {DOMString} font Font to use\n */\n setFonts(font) {\n this.canvases.forEach(canvas => {\n const context = canvas.getContext('2d');\n if (context) {\n context.font = font;\n }\n });\n }\n\n /**\n * Draw a rectangle on the canvases\n *\n * (it figures out the offset for each canvas)\n *\n * @param {number} x X-position\n * @param {number} y Y-position\n * @param {number} width Width\n * @param {number} height Height\n */\n fillRect(x, y, width, height) {\n this.canvases.forEach((canvas, i) => {\n const leftOffset = i * this.maxCanvasWidth;\n\n const intersection = {\n x1: Math.max(x, i * this.maxCanvasWidth),\n y1: y,\n x2: Math.min(x + width, i * this.maxCanvasWidth + canvas.width),\n y2: y + height\n };\n\n if (intersection.x1 < intersection.x2) {\n const context = canvas\n .getContext('2d');\n if (context) {\n context\n .fillRect(\n intersection.x1 - leftOffset,\n intersection.y1,\n intersection.x2 - intersection.x1,\n intersection.y2 - intersection.y1\n );\n }\n }\n });\n }\n\n /**\n * Fill a given text on the canvases\n *\n * @param {string} text Text to render\n * @param {number} x X-position\n * @param {number} y Y-position\n */\n fillText(text, x, y) {\n let textWidth;\n let xOffset = 0;\n\n this.canvases.forEach(canvas => {\n const context = canvas.getContext('2d');\n if (context) {\n const canvasWidth = context.canvas.width;\n\n if (xOffset > x + textWidth) {\n return;\n }\n\n if (xOffset + canvasWidth > x && context) {\n textWidth = context.measureText(text).width;\n context.fillText(text, x - xOffset, y);\n }\n\n xOffset += canvasWidth;\n }\n });\n }\n\n /**\n * Turn the time into a suitable label for the time.\n *\n * @param {number} seconds Seconds to format\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Time\n */\n defaultFormatTimeCallback(seconds, pxPerSec) {\n if (seconds / 60 > 1) {\n // calculate minutes and seconds from seconds count\n const minutes = parseInt(seconds / 60, 10);\n seconds = parseInt(seconds % 60, 10);\n // fill up seconds with zeroes\n seconds = seconds < 10 ? '0' + seconds : seconds;\n return `${minutes}:${seconds}`;\n }\n return Math.round(seconds * 1000) / 1000;\n }\n\n /**\n * Return how many seconds should be between each notch\n *\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Time\n */\n defaultTimeInterval(pxPerSec) {\n if (pxPerSec >= 25) {\n return 1;\n } else if (pxPerSec * 5 >= 25) {\n return 5;\n } else if (pxPerSec * 15 >= 25) {\n return 15;\n }\n return Math.ceil(0.5 / pxPerSec) * 60;\n }\n\n /**\n * Return the cadence of notches that get labels in the primary color.\n *\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Cadence\n */\n defaultPrimaryLabelInterval(pxPerSec) {\n if (pxPerSec >= 25) {\n return 10;\n } else if (pxPerSec * 5 >= 25) {\n return 6;\n } else if (pxPerSec * 15 >= 25) {\n return 4;\n }\n return 4;\n }\n\n /**\n * Return the cadence of notches that get labels in the secondary color.\n *\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Cadence\n */\n defaultSecondaryLabelInterval(pxPerSec) {\n if (pxPerSec >= 25) {\n return 5;\n } else if (pxPerSec * 5 >= 25) {\n return 2;\n } else if (pxPerSec * 15 >= 25) {\n return 2;\n }\n return 2;\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/timeline/index.js\");\n",""],"names":["TimelinePlugin","params","ws","wrapper","drawer","scrollLeft","render","wavesurfer","pixelRatio","maxCanvasWidth","width","maxCanvasElementWidth","Math","round","addEventListener","_onScroll","on","_onRedraw","_onZoom","e","preventDefault","relX","offsetX","layerX","fireEvent","scrollWidth","container","document","querySelector","Error","util","Object","assign","height","notchPercentHeight","labelPadding","unlabeledNotchColor","primaryColor","secondaryColor","primaryFontColor","secondaryFontColor","fontFamily","fontSize","duration","zoomDebounce","formatTimeCallback","defaultFormatTimeCallback","timeInterval","defaultTimeInterval","primaryLabelInterval","defaultPrimaryLabelInterval","secondaryLabelInterval","defaultSecondaryLabelInterval","offset","canvases","debounce","isReady","_onReady","once","unAll","un","removeEventListener","parentNode","_onWrapperClick","removeChild","wsParams","innerHTML","appendChild","createElement","style","display","position","userSelect","webkitUserSelect","fillParent","scrollParent","overflowX","overflowY","createWrapper","updateCanvases","updateCanvasesPositioning","renderCanvases","canvas","push","zIndex","pop","parentElement","totalWidth","requiredCanvases","ceil","length","addCanvas","removeCanvas","canvasesLength","forEach","i","canvasWidth","left","backend","getDuration","totalSeconds","parseInt","getWidth","height1","height2","pixelsPerSecond","formatTime","intervalFnOrVal","option","curPixel","curSeconds","positioning","renderPositions","cb","pos","setFillStyles","setFonts","fillRect","fillText","fillStyle","context","getContext","font","x","y","leftOffset","intersection","x1","max","y1","x2","min","y2","text","textWidth","xOffset","measureText","seconds","pxPerSec","minutes","name","deferInit","instance"],"sourceRoot":""}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* wavesurfer.js timeline plugin
|
|
2
|
+
* wavesurfer.js timeline plugin 6.0.2 (2022-02-20)
|
|
3
3
|
* https://wavesurfer-js.org
|
|
4
4
|
* @license BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("WaveSurfer",[],t):"object"==typeof exports?exports.WaveSurfer=t():(e.WaveSurfer=e.WaveSurfer||{},e.WaveSurfer.timeline=t())}(
|
|
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.timeline=t())}(self,(function(){return(()=>{"use strict";var e={171:(e,t)=>{function a(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=function(){function e(t,a){var i=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),r(this,"_onScroll",(function(){i.wrapper&&i.drawer.wrapper&&(i.wrapper.scrollLeft=i.drawer.wrapper.scrollLeft)})),r(this,"_onRedraw",(function(){return i.render()})),r(this,"_onReady",(function(){var e=i.wavesurfer;i.drawer=e.drawer,i.pixelRatio=e.drawer.params.pixelRatio,i.maxCanvasWidth=e.drawer.maxCanvasWidth||e.drawer.width,i.maxCanvasElementWidth=e.drawer.maxCanvasElementWidth||Math.round(i.maxCanvasWidth/i.pixelRatio),e.drawer.wrapper.addEventListener("scroll",i._onScroll),e.on("redraw",i._onRedraw),e.on("zoom",i._onZoom),i.render()})),r(this,"_onWrapperClick",(function(e){e.preventDefault();var t="offsetX"in e?e.offsetX:e.layerX;i.fireEvent("click",t/i.wrapper.scrollWidth||0)})),this.container="string"==typeof t.container?document.querySelector(t.container):t.container,!this.container)throw new Error("No container for wavesurfer timeline");this.wavesurfer=a,this.util=a.util,this.params=Object.assign({},{height:20,notchPercentHeight:90,labelPadding:5,unlabeledNotchColor:"#c0c0c0",primaryColor:"#000",secondaryColor:"#c0c0c0",primaryFontColor:"#000",secondaryFontColor:"#000",fontFamily:"Arial",fontSize:10,duration:null,zoomDebounce:!1,formatTimeCallback:this.defaultFormatTimeCallback,timeInterval:this.defaultTimeInterval,primaryLabelInterval:this.defaultPrimaryLabelInterval,secondaryLabelInterval:this.defaultSecondaryLabelInterval,offset:0},t),this.canvases=[],this.wrapper=null,this.drawer=null,this.pixelRatio=null,this.maxCanvasWidth=null,this.maxCanvasElementWidth=null,this._onZoom=this.params.zoomDebounce?this.wavesurfer.util.debounce((function(){return i.render()}),this.params.zoomDebounce):function(){return i.render()}}var t,i,n;return t=e,n=[{key:"create",value:function(t){return{name:"timeline",deferInit:!(!t||!t.deferInit)&&t.deferInit,params:t,instance:e}}}],(i=[{key:"init",value:function(){this.wavesurfer.isReady?this._onReady():this.wavesurfer.once("ready",this._onReady)}},{key:"destroy",value:function(){this.unAll(),this.wavesurfer.un("redraw",this._onRedraw),this.wavesurfer.un("zoom",this._onZoom),this.wavesurfer.un("ready",this._onReady),this.wavesurfer.drawer.wrapper.removeEventListener("scroll",this._onScroll),this.wrapper&&this.wrapper.parentNode&&(this.wrapper.removeEventListener("click",this._onWrapperClick),this.wrapper.parentNode.removeChild(this.wrapper),this.wrapper=null)}},{key:"createWrapper",value:function(){var e=this.wavesurfer.params;this.container.innerHTML="",this.wrapper=this.container.appendChild(document.createElement("timeline")),this.util.style(this.wrapper,{display:"block",position:"relative",userSelect:"none",webkitUserSelect:"none",height:"".concat(this.params.height,"px")}),(e.fillParent||e.scrollParent)&&this.util.style(this.wrapper,{width:"100%",overflowX:"hidden",overflowY:"hidden"}),this.wrapper.addEventListener("click",this._onWrapperClick)}},{key:"render",value:function(){this.wrapper||this.createWrapper(),this.updateCanvases(),this.updateCanvasesPositioning(),this.renderCanvases()}},{key:"addCanvas",value:function(){var e=this.wrapper.appendChild(document.createElement("canvas"));this.canvases.push(e),this.util.style(e,{position:"absolute",zIndex:4})}},{key:"removeCanvas",value:function(){var e=this.canvases.pop();e.parentElement.removeChild(e)}},{key:"updateCanvases",value:function(){for(var e=Math.round(this.drawer.wrapper.scrollWidth),t=Math.ceil(e/this.maxCanvasElementWidth);this.canvases.length<t;)this.addCanvas();for(;this.canvases.length>t;)this.removeCanvas()}},{key:"updateCanvasesPositioning",value:function(){var e=this,t=this.canvases.length;this.canvases.forEach((function(a,r){var i=r===t-1?e.drawer.wrapper.scrollWidth-e.maxCanvasElementWidth*(t-1):e.maxCanvasElementWidth;a.width=i*e.pixelRatio,a.height=(e.params.height+1)*e.pixelRatio,e.util.style(a,{width:"".concat(i,"px"),height:"".concat(e.params.height,"px"),left:"".concat(r*e.maxCanvasElementWidth,"px")})}))}},{key:"renderCanvases",value:function(){var e=this,t=this.params.duration||this.wavesurfer.backend.getDuration();if(!(t<=0)){var a,r=this.wavesurfer.params,i=this.params.fontSize*r.pixelRatio,n=parseInt(t,10)+1,s=r.fillParent&&!r.scrollParent?this.drawer.getWidth():this.drawer.wrapper.scrollWidth*r.pixelRatio,o=this.params.height*this.pixelRatio,l=this.params.height*(this.params.notchPercentHeight/100)*this.pixelRatio,h=s/t,c=this.params.formatTimeCallback,u=function(e){return"function"==typeof e?e(h):e},p=u(this.params.timeInterval),f=u(this.params.primaryLabelInterval),d=u(this.params.secondaryLabelInterval),v=h*this.params.offset,m=0,y=[];for(a=0;a<n/p;a++)y.push([a,m,v]),m+=p,v+=h*p;var w=function(e){y.forEach((function(t){e(t[0],t[1],t[2])}))};this.setFillStyles(this.params.primaryColor),this.setFonts("".concat(i,"px ").concat(this.params.fontFamily)),this.setFillStyles(this.params.primaryFontColor),w((function(t,a,r){t%f==0&&(e.fillRect(r,0,1,o),e.fillText(c(a,h),r+e.params.labelPadding*e.pixelRatio,o))})),this.setFillStyles(this.params.secondaryColor),this.setFonts("".concat(i,"px ").concat(this.params.fontFamily)),this.setFillStyles(this.params.secondaryFontColor),w((function(t,a,r){t%d==0&&(e.fillRect(r,0,1,o),e.fillText(c(a,h),r+e.params.labelPadding*e.pixelRatio,o))})),this.setFillStyles(this.params.unlabeledNotchColor),w((function(t,a,r){t%d!=0&&t%f!=0&&e.fillRect(r,0,1,l)}))}}},{key:"setFillStyles",value:function(e){this.canvases.forEach((function(t){var a=t.getContext("2d");a&&(a.fillStyle=e)}))}},{key:"setFonts",value:function(e){this.canvases.forEach((function(t){var a=t.getContext("2d");a&&(a.font=e)}))}},{key:"fillRect",value:function(e,t,a,r){var i=this;this.canvases.forEach((function(n,s){var o=s*i.maxCanvasWidth,l={x1:Math.max(e,s*i.maxCanvasWidth),y1:t,x2:Math.min(e+a,s*i.maxCanvasWidth+n.width),y2:t+r};if(l.x1<l.x2){var h=n.getContext("2d");h&&h.fillRect(l.x1-o,l.y1,l.x2-l.x1,l.y2-l.y1)}}))}},{key:"fillText",value:function(e,t,a){var r,i=0;this.canvases.forEach((function(n){var s=n.getContext("2d");if(s){var o=s.canvas.width;if(i>t+r)return;i+o>t&&s&&(r=s.measureText(e).width,s.fillText(e,t-i,a)),i+=o}}))}},{key:"defaultFormatTimeCallback",value:function(e,t){if(e/60>1){var a=parseInt(e/60,10);return e=(e=parseInt(e%60,10))<10?"0"+e:e,"".concat(a,":").concat(e)}return Math.round(1e3*e)/1e3}},{key:"defaultTimeInterval",value:function(e){return e>=25?1:5*e>=25?5:15*e>=25?15:60*Math.ceil(.5/e)}},{key:"defaultPrimaryLabelInterval",value:function(e){return e>=25?10:5*e>=25?6:4}},{key:"defaultSecondaryLabelInterval",value:function(e){return e>=25?5:2}}])&&a(t.prototype,i),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.default=i,e.exports=t.default}},t={};var a=function a(r){var i=t[r];if(void 0!==i)return i.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,a),n.exports}(171);return a})()}));
|
|
7
7
|
//# sourceMappingURL=wavesurfer.timeline.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://WaveSurfer.[name]/webpack/universalModuleDefinition","webpack://WaveSurfer.[name]/./src/plugin/timeline/index.js","webpack://WaveSurfer.[name]/webpack/bootstrap","webpack://WaveSurfer.[name]/webpack/startup"],"names":["root","factory","exports","module","define","amd","this","TimelinePlugin","params","ws","container","document","querySelector","Error","wavesurfer","util","Object","assign","height","notchPercentHeight","labelPadding","unlabeledNotchColor","primaryColor","secondaryColor","primaryFontColor","secondaryFontColor","fontFamily","fontSize","duration","zoomDebounce","formatTimeCallback","defaultFormatTimeCallback","timeInterval","defaultTimeInterval","primaryLabelInterval","defaultPrimaryLabelInterval","secondaryLabelInterval","defaultSecondaryLabelInterval","offset","canvases","wrapper","drawer","pixelRatio","maxCanvasWidth","maxCanvasElementWidth","_onZoom","debounce","render","name","deferInit","instance","isReady","_onReady","once","unAll","un","_onRedraw","removeEventListener","_onScroll","parentNode","_onWrapperClick","removeChild","wsParams","innerHTML","appendChild","createElement","style","display","position","userSelect","webkitUserSelect","fillParent","scrollParent","width","overflowX","overflowY","addEventListener","createWrapper","updateCanvases","updateCanvasesPositioning","renderCanvases","canvas","push","zIndex","pop","parentElement","totalWidth","Math","round","scrollWidth","requiredCanvases","ceil","length","addCanvas","removeCanvas","canvasesLength","forEach","i","canvasWidth","left","backend","getDuration","totalSeconds","parseInt","getWidth","height1","height2","pixelsPerSecond","formatTime","intervalFnOrVal","option","curPixel","curSeconds","positioning","renderPositions","cb","pos","setFillStyles","setFonts","fillRect","fillText","fillStyle","context","getContext","font","x","y","leftOffset","intersection","x1","max","y1","x2","min","y2","text","textWidth","xOffset","measureText","seconds","pxPerSec","minutes","scrollLeft","on","e","preventDefault","relX","offsetX","layerX","fireEvent","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"mappings":";;;;;CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,aAAc,GAAIH,GACC,iBAAZC,QACdA,QAAoB,WAAID,KAExBD,EAAiB,WAAIA,EAAiB,YAAK,GAAIA,EAAiB,WAAY,SAAIC,KARlF,CASGK,MAAM,WACT,M,kRCiDqBC,E,WAiEjB,WAAYC,EAAQC,GAAI,WAMpB,G,4FANoB,sBACpBH,KAAKI,UACD,iBAAmBF,EAAOE,UACpBC,SAASC,cAAcJ,EAAOE,WAC9BF,EAAOE,WAEZJ,KAAKI,UACN,MAAM,IAAIG,MAAM,wCAGpBP,KAAKQ,WAAaL,EAClBH,KAAKS,KAAON,EAAGM,KACfT,KAAKE,OAASQ,OAAOC,OACjB,GACA,CACIC,OAAQ,GACRC,mBAAoB,GACpBC,aAAc,EACdC,oBAAqB,UACrBC,aAAc,OACdC,eAAgB,UAChBC,iBAAkB,OAClBC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D,QAAQsG,a,KAOtDtF,UAAY,kBAAM,EAAKT,U,KAEvBK,SAAW,WACP,IAAM3C,EAAK,EAAKK,WAChB,EAAK2B,OAAShC,EAAGgC,OACjB,EAAKC,WAAajC,EAAGgC,OAAOjC,OAAOkC,WACnC,EAAKC,eAAiBlC,EAAGgC,OAAOE,gBAAkBlC,EAAGgC,OAAOgC,MAC5D,EAAK7B,sBACDnC,EAAGgC,OAAOG,uBACV2C,KAAKC,MAAM,EAAK7C,eAAiB,EAAKD,YAG1CjC,EAAGgC,OAAOD,QAAQoC,iBAAiB,SAAU,EAAKlB,WAClDjD,EAAGsI,GAAG,SAAU,EAAKvF,WACrB/C,EAAGsI,GAAG,OAAQ,EAAKlG,SAEnB,EAAKE,U,KAMTa,gBAAkB,SAAAoF,GACdA,EAAEC,iBACF,IAAMC,EAAO,YAAaF,EAAIA,EAAEG,QAAUH,EAAEI,OAC5C,EAAKC,UAAU,QAASH,EAAO,EAAK1G,QAAQiD,aAAe,K,sBChH/D6D,EAA2B,G,OAG/B,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAavJ,QAGrB,IAAIC,EAASmJ,EAAyBE,GAAY,CAGjDtJ,QAAS,IAOV,OAHAyJ,EAAoBH,GAAUrJ,EAAQA,EAAOD,QAASqJ,GAG/CpJ,EAAOD,QClBWqJ,CAAoB,M","file":"wavesurfer.timeline.min.js","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\"][\"timeline\"] = factory();\n})(this, function() {\nreturn ","/**\n * @typedef {Object} TimelinePluginParams\n * @desc Extends the `WavesurferParams` wavesurfer was initialised with\n * @property {!string|HTMLElement} container CSS selector or HTML element where\n * the timeline should be drawn. This is the only required parameter.\n * @property {number} notchPercentHeight=90 Height of notches in percent\n * @property {string} unlabeledNotchColor='#c0c0c0' The colour of the notches\n * that do not have labels\n * @property {string} primaryColor='#000' The colour of the main notches\n * @property {string} secondaryColor='#c0c0c0' The colour of the secondary\n * notches\n * @property {string} primaryFontColor='#000' The colour of the labels next to\n * the main notches\n * @property {string} secondaryFontColor='#000' The colour of the labels next to\n * the secondary notches\n * @property {number} labelPadding=5 The padding between the label and the notch\n * @property {?number} zoomDebounce A debounce timeout to increase rendering\n * performance for large files\n * @property {string} fontFamily='Arial'\n * @property {number} fontSize=10 Font size of labels in pixels\n * @property {?number} duration Length of the track in seconds. Overrides\n * getDuration() for setting length of timeline\n * @property {function} formatTimeCallback (sec, pxPerSec) -> label\n * @property {function} timeInterval (pxPerSec) -> seconds between notches\n * @property {function} primaryLabelInterval (pxPerSec) -> cadence between\n * labels in primary color\n * @property {function} secondaryLabelInterval (pxPerSec) -> cadence between\n * labels in secondary color\n * @property {?number} offset Offset for the timeline start in seconds. May also be\n * negative.\n * @property {?boolean} deferInit Set to true to manually call\n * `initPlugin('timeline')`\n */\n\n/**\n * Adds a timeline to the waveform.\n *\n * @implements {PluginClass}\n * @extends {Observer}\n * @example\n * // es6\n * import TimelinePlugin from 'wavesurfer.timeline.js';\n *\n * // commonjs\n * var TimelinePlugin = require('wavesurfer.timeline.js');\n *\n * // if you are using <script> tags\n * var TimelinePlugin = window.WaveSurfer.timeline;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * TimelinePlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\nexport default class TimelinePlugin {\n /**\n * Timeline 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 {TimelinePluginParams} params parameters use to initialise the plugin\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'timeline',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n instance: TimelinePlugin\n };\n }\n\n // event handlers\n _onScroll = () => {\n if (this.wrapper && this.drawer.wrapper) {\n this.wrapper.scrollLeft = this.drawer.wrapper.scrollLeft;\n }\n };\n\n /**\n * @returns {void}\n */\n _onRedraw = () => this.render();\n\n _onReady = () => {\n const ws = this.wavesurfer;\n this.drawer = ws.drawer;\n this.pixelRatio = ws.drawer.params.pixelRatio;\n this.maxCanvasWidth = ws.drawer.maxCanvasWidth || ws.drawer.width;\n this.maxCanvasElementWidth =\n ws.drawer.maxCanvasElementWidth ||\n Math.round(this.maxCanvasWidth / this.pixelRatio);\n\n // add listeners\n ws.drawer.wrapper.addEventListener('scroll', this._onScroll);\n ws.on('redraw', this._onRedraw);\n ws.on('zoom', this._onZoom);\n\n this.render();\n };\n\n /**\n * @param {object} e Click event\n */\n _onWrapperClick = e => {\n e.preventDefault();\n const relX = 'offsetX' in e ? e.offsetX : e.layerX;\n this.fireEvent('click', relX / this.wrapper.scrollWidth || 0);\n };\n\n /**\n * Creates an instance of TimelinePlugin.\n *\n * You probably want to use TimelinePlugin.create()\n *\n * @param {TimelinePluginParams} params Plugin parameters\n * @param {object} ws Wavesurfer instance\n */\n constructor(params, ws) {\n this.container =\n 'string' == typeof params.container\n ? document.querySelector(params.container)\n : params.container;\n\n if (!this.container) {\n throw new Error('No container for wavesurfer timeline');\n }\n\n this.wavesurfer = ws;\n this.util = ws.util;\n this.params = Object.assign(\n {},\n {\n height: 20,\n notchPercentHeight: 90,\n labelPadding: 5,\n unlabeledNotchColor: '#c0c0c0',\n primaryColor: '#000',\n secondaryColor: '#c0c0c0',\n primaryFontColor: '#000',\n secondaryFontColor: '#000',\n fontFamily: 'Arial',\n fontSize: 10,\n duration: null,\n zoomDebounce: false,\n formatTimeCallback: this.defaultFormatTimeCallback,\n timeInterval: this.defaultTimeInterval,\n primaryLabelInterval: this.defaultPrimaryLabelInterval,\n secondaryLabelInterval: this.defaultSecondaryLabelInterval,\n offset: 0\n },\n params\n );\n\n this.canvases = [];\n this.wrapper = null;\n this.drawer = null;\n this.pixelRatio = null;\n this.maxCanvasWidth = null;\n this.maxCanvasElementWidth = null;\n /**\n * This event handler has to be in the constructor function because it\n * relies on the debounce function which is only available after\n * instantiation\n *\n * Use a debounced function if `params.zoomDebounce` is defined\n *\n * @returns {void}\n */\n this._onZoom = this.params.zoomDebounce\n ? this.wavesurfer.util.debounce(\n () => this.render(),\n this.params.zoomDebounce\n )\n : () => this.render();\n }\n\n /**\n * Initialisation function used by the plugin API\n */\n init() {\n // Check if ws is ready\n if (this.wavesurfer.isReady) {\n this._onReady();\n } else {\n this.wavesurfer.once('ready', this._onReady);\n }\n }\n\n /**\n * Destroy function used by the plugin API\n */\n destroy() {\n this.unAll();\n this.wavesurfer.un('redraw', this._onRedraw);\n this.wavesurfer.un('zoom', this._onZoom);\n this.wavesurfer.un('ready', this._onReady);\n this.wavesurfer.drawer.wrapper.removeEventListener(\n 'scroll',\n this._onScroll\n );\n if (this.wrapper && this.wrapper.parentNode) {\n this.wrapper.removeEventListener('click', this._onWrapperClick);\n this.wrapper.parentNode.removeChild(this.wrapper);\n this.wrapper = null;\n }\n }\n\n /**\n * Create a timeline element to wrap the canvases drawn by this plugin\n *\n */\n createWrapper() {\n const wsParams = this.wavesurfer.params;\n this.container.innerHTML = '';\n this.wrapper = this.container.appendChild(\n document.createElement('timeline')\n );\n this.util.style(this.wrapper, {\n display: 'block',\n position: 'relative',\n userSelect: 'none',\n webkitUserSelect: 'none',\n height: `${this.params.height}px`\n });\n\n if (wsParams.fillParent || wsParams.scrollParent) {\n this.util.style(this.wrapper, {\n width: '100%',\n overflowX: 'hidden',\n overflowY: 'hidden'\n });\n }\n\n this.wrapper.addEventListener('click', this._onWrapperClick);\n }\n\n /**\n * Render the timeline (also updates the already rendered timeline)\n *\n */\n render() {\n if (!this.wrapper) {\n this.createWrapper();\n }\n this.updateCanvases();\n this.updateCanvasesPositioning();\n this.renderCanvases();\n }\n\n /**\n * Add new timeline canvas\n *\n */\n addCanvas() {\n const canvas = this.wrapper.appendChild(\n document.createElement('canvas')\n );\n this.canvases.push(canvas);\n this.util.style(canvas, {\n position: 'absolute',\n zIndex: 4\n });\n }\n\n /**\n * Remove timeline canvas\n *\n */\n removeCanvas() {\n const canvas = this.canvases.pop();\n canvas.parentElement.removeChild(canvas);\n }\n\n /**\n * Make sure the correct of timeline canvas elements exist and are cached in\n * this.canvases\n *\n */\n updateCanvases() {\n const totalWidth = Math.round(this.drawer.wrapper.scrollWidth);\n const requiredCanvases = Math.ceil(\n totalWidth / this.maxCanvasElementWidth\n );\n\n while (this.canvases.length < requiredCanvases) {\n this.addCanvas();\n }\n\n while (this.canvases.length > requiredCanvases) {\n this.removeCanvas();\n }\n }\n\n /**\n * Update the dimensions and positioning style for all the timeline canvases\n *\n */\n updateCanvasesPositioning() {\n // cache length for performance\n const canvasesLength = this.canvases.length;\n this.canvases.forEach((canvas, i) => {\n // canvas width is the max element width, or if it is the last the\n // required width\n const canvasWidth =\n i === canvasesLength - 1\n ? this.drawer.wrapper.scrollWidth -\n this.maxCanvasElementWidth * (canvasesLength - 1)\n : this.maxCanvasElementWidth;\n // set dimensions and style\n canvas.width = canvasWidth * this.pixelRatio;\n // on certain pixel ratios the canvas appears cut off at the bottom,\n // therefore leave 1px extra\n canvas.height = (this.params.height + 1) * this.pixelRatio;\n this.util.style(canvas, {\n width: `${canvasWidth}px`,\n height: `${this.params.height}px`,\n left: `${i * this.maxCanvasElementWidth}px`\n });\n });\n }\n\n /**\n * Render the timeline labels and notches\n *\n */\n renderCanvases() {\n const duration =\n this.params.duration ||\n this.wavesurfer.backend.getDuration();\n\n if (duration <= 0) {\n return;\n }\n const wsParams = this.wavesurfer.params;\n const fontSize = this.params.fontSize * wsParams.pixelRatio;\n const totalSeconds = parseInt(duration, 10) + 1;\n const width =\n wsParams.fillParent && !wsParams.scrollParent\n ? this.drawer.getWidth()\n : this.drawer.wrapper.scrollWidth * wsParams.pixelRatio;\n const height1 = this.params.height * this.pixelRatio;\n const height2 =\n this.params.height *\n (this.params.notchPercentHeight / 100) *\n this.pixelRatio;\n const pixelsPerSecond = width / duration;\n\n const formatTime = this.params.formatTimeCallback;\n // if parameter is function, call the function with\n // pixelsPerSecond, otherwise simply take the value as-is\n const intervalFnOrVal = option =>\n typeof option === 'function' ? option(pixelsPerSecond) : option;\n const timeInterval = intervalFnOrVal(this.params.timeInterval);\n const primaryLabelInterval = intervalFnOrVal(\n this.params.primaryLabelInterval\n );\n const secondaryLabelInterval = intervalFnOrVal(\n this.params.secondaryLabelInterval\n );\n\n let curPixel = pixelsPerSecond * this.params.offset;\n let curSeconds = 0;\n let i;\n // build an array of position data with index, second and pixel data,\n // this is then used multiple times below\n const positioning = [];\n for (i = 0; i < totalSeconds / timeInterval; i++) {\n positioning.push([i, curSeconds, curPixel]);\n curSeconds += timeInterval;\n curPixel += pixelsPerSecond * timeInterval;\n }\n\n // iterate over each position\n const renderPositions = cb => {\n positioning.forEach(pos => {\n cb(pos[0], pos[1], pos[2]);\n });\n };\n\n // render primary labels\n this.setFillStyles(this.params.primaryColor);\n this.setFonts(`${fontSize}px ${this.params.fontFamily}`);\n this.setFillStyles(this.params.primaryFontColor);\n renderPositions((i, curSeconds, curPixel) => {\n if (i % primaryLabelInterval === 0) {\n this.fillRect(curPixel, 0, 1, height1);\n this.fillText(\n formatTime(curSeconds, pixelsPerSecond),\n curPixel + this.params.labelPadding * this.pixelRatio,\n height1\n );\n }\n });\n\n // render secondary labels\n this.setFillStyles(this.params.secondaryColor);\n this.setFonts(`${fontSize}px ${this.params.fontFamily}`);\n this.setFillStyles(this.params.secondaryFontColor);\n renderPositions((i, curSeconds, curPixel) => {\n if (i % secondaryLabelInterval === 0) {\n this.fillRect(curPixel, 0, 1, height1);\n this.fillText(\n formatTime(curSeconds, pixelsPerSecond),\n curPixel + this.params.labelPadding * this.pixelRatio,\n height1\n );\n }\n });\n\n // render the actual notches (when no labels are used)\n this.setFillStyles(this.params.unlabeledNotchColor);\n renderPositions((i, curSeconds, curPixel) => {\n if (\n i % secondaryLabelInterval !== 0 &&\n i % primaryLabelInterval !== 0\n ) {\n this.fillRect(curPixel, 0, 1, height2);\n }\n });\n }\n\n /**\n * Set the canvas fill style\n *\n * @param {DOMString|CanvasGradient|CanvasPattern} fillStyle Fill style to\n * use\n */\n setFillStyles(fillStyle) {\n this.canvases.forEach(canvas => {\n const context = canvas.getContext('2d');\n if (context) {\n context.fillStyle = fillStyle;\n }\n });\n }\n\n /**\n * Set the canvas font\n *\n * @param {DOMString} font Font to use\n */\n setFonts(font) {\n this.canvases.forEach(canvas => {\n const context = canvas.getContext('2d');\n if (context) {\n context.font = font;\n }\n });\n }\n\n /**\n * Draw a rectangle on the canvases\n *\n * (it figures out the offset for each canvas)\n *\n * @param {number} x X-position\n * @param {number} y Y-position\n * @param {number} width Width\n * @param {number} height Height\n */\n fillRect(x, y, width, height) {\n this.canvases.forEach((canvas, i) => {\n const leftOffset = i * this.maxCanvasWidth;\n\n const intersection = {\n x1: Math.max(x, i * this.maxCanvasWidth),\n y1: y,\n x2: Math.min(x + width, i * this.maxCanvasWidth + canvas.width),\n y2: y + height\n };\n\n if (intersection.x1 < intersection.x2) {\n const context = canvas\n .getContext('2d');\n if (context) {\n context\n .fillRect(\n intersection.x1 - leftOffset,\n intersection.y1,\n intersection.x2 - intersection.x1,\n intersection.y2 - intersection.y1\n );\n }\n }\n });\n }\n\n /**\n * Fill a given text on the canvases\n *\n * @param {string} text Text to render\n * @param {number} x X-position\n * @param {number} y Y-position\n */\n fillText(text, x, y) {\n let textWidth;\n let xOffset = 0;\n\n this.canvases.forEach(canvas => {\n const context = canvas.getContext('2d');\n const canvasWidth = context.canvas.width;\n\n if (xOffset > x + textWidth) {\n return;\n }\n\n if (xOffset + canvasWidth > x && context) {\n textWidth = context.measureText(text).width;\n context.fillText(text, x - xOffset, y);\n }\n\n xOffset += canvasWidth;\n });\n }\n\n /**\n * Turn the time into a suitable label for the time.\n *\n * @param {number} seconds Seconds to format\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Time\n */\n defaultFormatTimeCallback(seconds, pxPerSec) {\n if (seconds / 60 > 1) {\n // calculate minutes and seconds from seconds count\n const minutes = parseInt(seconds / 60, 10);\n seconds = parseInt(seconds % 60, 10);\n // fill up seconds with zeroes\n seconds = seconds < 10 ? '0' + seconds : seconds;\n return `${minutes}:${seconds}`;\n }\n return Math.round(seconds * 1000) / 1000;\n }\n\n /**\n * Return how many seconds should be between each notch\n *\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Time\n */\n defaultTimeInterval(pxPerSec) {\n if (pxPerSec >= 25) {\n return 1;\n } else if (pxPerSec * 5 >= 25) {\n return 5;\n } else if (pxPerSec * 15 >= 25) {\n return 15;\n }\n return Math.ceil(0.5 / pxPerSec) * 60;\n }\n\n /**\n * Return the cadence of notches that get labels in the primary color.\n *\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Cadence\n */\n defaultPrimaryLabelInterval(pxPerSec) {\n if (pxPerSec >= 25) {\n return 10;\n } else if (pxPerSec * 5 >= 25) {\n return 6;\n } else if (pxPerSec * 15 >= 25) {\n return 4;\n }\n return 4;\n }\n\n /**\n * Return the cadence of notches that get labels in the secondary color.\n *\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Cadence\n */\n defaultSecondaryLabelInterval(pxPerSec) {\n if (pxPerSec >= 25) {\n return 5;\n } else if (pxPerSec * 5 >= 25) {\n return 2;\n } else if (pxPerSec * 15 >= 25) {\n return 2;\n }\n return 2;\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__(171);\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"wavesurfer.timeline.min.js","mappings":";;;;;CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,aAAc,GAAIH,GACC,iBAAZC,QACdA,QAAoB,WAAID,KAExBD,EAAiB,WAAIA,EAAiB,YAAK,GAAIA,EAAiB,WAAY,SAAIC,KARlF,CASGK,MAAM,WACT,Y,oYCiDqBC,EAAAA,WAiEjB,WAAYC,EAAQC,GAAI,WAMpB,G,4FANoB,6BA7CZ,WACJ,EAAKC,SAAW,EAAKC,OAAOD,UAC5B,EAAKA,QAAQE,WAAa,EAAKD,OAAOD,QAAQE,eA2C9B,oBApCZ,kBAAM,EAAKC,YAoCC,mBAlCb,WACP,IAAMJ,EAAK,EAAKK,WAChB,EAAKH,OAASF,EAAGE,OACjB,EAAKI,WAAaN,EAAGE,OAAOH,OAAOO,WACnC,EAAKC,eAAiBP,EAAGE,OAAOK,gBAAkBP,EAAGE,OAAOM,MAC5D,EAAKC,sBACDT,EAAGE,OAAOO,uBACVC,KAAKC,MAAM,EAAKJ,eAAiB,EAAKD,YAG1CN,EAAGE,OAAOD,QAAQW,iBAAiB,SAAU,EAAKC,WAClDb,EAAGc,GAAG,SAAU,EAAKC,WACrBf,EAAGc,GAAG,OAAQ,EAAKE,SAEnB,EAAKZ,YAoBe,0BAdN,SAAAa,GACdA,EAAEC,iBACF,IAAMC,EAAO,YAAaF,EAAIA,EAAEG,QAAUH,EAAEI,OAC5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AAU,GAAI,KAEb,GAAK,IAAMA,EAAUA,EACzC,UAAUE,EAAV,YAAqBF,GAEzB,OAAOjI,KAAKC,MAAgB,IAAVgI,GAAkB,M,iCASxC,SAAoBC,GAChB,OAAIA,GAAY,GACL,EACW,EAAXA,GAAgB,GAChB,EACW,GAAXA,GAAiB,GACjB,GAEwB,GAA5BlI,KAAKiF,KAAK,GAAMiD,K,yCAS3B,SAA4BA,GACxB,OAAIA,GAAY,GACL,GACW,EAAXA,GAAgB,GAChB,EAEA,I,2CAWf,SAA8BA,GAC1B,OAAIA,GAAY,GACL,EAEA,O,gFAhhBE9I,G,kCC1DjBgJ,EAA2B,GCE/B,IAAIC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAazJ,QAGrB,IAAIC,EAASoJ,EAAyBG,GAAY,CAGjDxJ,QAAS,IAOV,OAHA2J,EAAoBH,GAAUvJ,EAAQA,EAAOD,QAASuJ,GAG/CtJ,EAAOD,QClBWuJ,CAAoB,K,UHO9C","sources":["webpack://WaveSurfer.[name]/webpack/universalModuleDefinition","webpack://WaveSurfer.[name]/./src/plugin/timeline/index.js","webpack://WaveSurfer.[name]/webpack/bootstrap","webpack://WaveSurfer.[name]/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"timeline\"] = factory();\n})(self, function() {\nreturn ","/**\n * @typedef {Object} TimelinePluginParams\n * @desc Extends the `WavesurferParams` wavesurfer was initialised with\n * @property {!string|HTMLElement} container CSS selector or HTML element where\n * the timeline should be drawn. This is the only required parameter.\n * @property {number} notchPercentHeight=90 Height of notches in percent\n * @property {string} unlabeledNotchColor='#c0c0c0' The colour of the notches\n * that do not have labels\n * @property {string} primaryColor='#000' The colour of the main notches\n * @property {string} secondaryColor='#c0c0c0' The colour of the secondary\n * notches\n * @property {string} primaryFontColor='#000' The colour of the labels next to\n * the main notches\n * @property {string} secondaryFontColor='#000' The colour of the labels next to\n * the secondary notches\n * @property {number} labelPadding=5 The padding between the label and the notch\n * @property {?number} zoomDebounce A debounce timeout to increase rendering\n * performance for large files\n * @property {string} fontFamily='Arial'\n * @property {number} fontSize=10 Font size of labels in pixels\n * @property {?number} duration Length of the track in seconds. Overrides\n * getDuration() for setting length of timeline\n * @property {function} formatTimeCallback (sec, pxPerSec) -> label\n * @property {function} timeInterval (pxPerSec) -> seconds between notches\n * @property {function} primaryLabelInterval (pxPerSec) -> cadence between\n * labels in primary color\n * @property {function} secondaryLabelInterval (pxPerSec) -> cadence between\n * labels in secondary color\n * @property {?number} offset Offset for the timeline start in seconds. May also be\n * negative.\n * @property {?boolean} deferInit Set to true to manually call\n * `initPlugin('timeline')`\n */\n\n/**\n * Adds a timeline to the waveform.\n *\n * @implements {PluginClass}\n * @extends {Observer}\n * @example\n * // es6\n * import TimelinePlugin from 'wavesurfer.timeline.js';\n *\n * // commonjs\n * var TimelinePlugin = require('wavesurfer.timeline.js');\n *\n * // if you are using <script> tags\n * var TimelinePlugin = window.WaveSurfer.timeline;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * TimelinePlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\nexport default class TimelinePlugin {\n /**\n * Timeline 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 {TimelinePluginParams} params parameters use to initialise the plugin\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'timeline',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n instance: TimelinePlugin\n };\n }\n\n // event handlers\n _onScroll = () => {\n if (this.wrapper && this.drawer.wrapper) {\n this.wrapper.scrollLeft = this.drawer.wrapper.scrollLeft;\n }\n };\n\n /**\n * @returns {void}\n */\n _onRedraw = () => this.render();\n\n _onReady = () => {\n const ws = this.wavesurfer;\n this.drawer = ws.drawer;\n this.pixelRatio = ws.drawer.params.pixelRatio;\n this.maxCanvasWidth = ws.drawer.maxCanvasWidth || ws.drawer.width;\n this.maxCanvasElementWidth =\n ws.drawer.maxCanvasElementWidth ||\n Math.round(this.maxCanvasWidth / this.pixelRatio);\n\n // add listeners\n ws.drawer.wrapper.addEventListener('scroll', this._onScroll);\n ws.on('redraw', this._onRedraw);\n ws.on('zoom', this._onZoom);\n\n this.render();\n };\n\n /**\n * @param {object} e Click event\n */\n _onWrapperClick = e => {\n e.preventDefault();\n const relX = 'offsetX' in e ? e.offsetX : e.layerX;\n this.fireEvent('click', relX / this.wrapper.scrollWidth || 0);\n };\n\n /**\n * Creates an instance of TimelinePlugin.\n *\n * You probably want to use TimelinePlugin.create()\n *\n * @param {TimelinePluginParams} params Plugin parameters\n * @param {object} ws Wavesurfer instance\n */\n constructor(params, ws) {\n this.container =\n 'string' == typeof params.container\n ? document.querySelector(params.container)\n : params.container;\n\n if (!this.container) {\n throw new Error('No container for wavesurfer timeline');\n }\n\n this.wavesurfer = ws;\n this.util = ws.util;\n this.params = Object.assign(\n {},\n {\n height: 20,\n notchPercentHeight: 90,\n labelPadding: 5,\n unlabeledNotchColor: '#c0c0c0',\n primaryColor: '#000',\n secondaryColor: '#c0c0c0',\n primaryFontColor: '#000',\n secondaryFontColor: '#000',\n fontFamily: 'Arial',\n fontSize: 10,\n duration: null,\n zoomDebounce: false,\n formatTimeCallback: this.defaultFormatTimeCallback,\n timeInterval: this.defaultTimeInterval,\n primaryLabelInterval: this.defaultPrimaryLabelInterval,\n secondaryLabelInterval: this.defaultSecondaryLabelInterval,\n offset: 0\n },\n params\n );\n\n this.canvases = [];\n this.wrapper = null;\n this.drawer = null;\n this.pixelRatio = null;\n this.maxCanvasWidth = null;\n this.maxCanvasElementWidth = null;\n /**\n * This event handler has to be in the constructor function because it\n * relies on the debounce function which is only available after\n * instantiation\n *\n * Use a debounced function if `params.zoomDebounce` is defined\n *\n * @returns {void}\n */\n this._onZoom = this.params.zoomDebounce\n ? this.wavesurfer.util.debounce(\n () => this.render(),\n this.params.zoomDebounce\n )\n : () => this.render();\n }\n\n /**\n * Initialisation function used by the plugin API\n */\n init() {\n // Check if ws is ready\n if (this.wavesurfer.isReady) {\n this._onReady();\n } else {\n this.wavesurfer.once('ready', this._onReady);\n }\n }\n\n /**\n * Destroy function used by the plugin API\n */\n destroy() {\n this.unAll();\n this.wavesurfer.un('redraw', this._onRedraw);\n this.wavesurfer.un('zoom', this._onZoom);\n this.wavesurfer.un('ready', this._onReady);\n this.wavesurfer.drawer.wrapper.removeEventListener(\n 'scroll',\n this._onScroll\n );\n if (this.wrapper && this.wrapper.parentNode) {\n this.wrapper.removeEventListener('click', this._onWrapperClick);\n this.wrapper.parentNode.removeChild(this.wrapper);\n this.wrapper = null;\n }\n }\n\n /**\n * Create a timeline element to wrap the canvases drawn by this plugin\n *\n */\n createWrapper() {\n const wsParams = this.wavesurfer.params;\n this.container.innerHTML = '';\n this.wrapper = this.container.appendChild(\n document.createElement('timeline')\n );\n this.util.style(this.wrapper, {\n display: 'block',\n position: 'relative',\n userSelect: 'none',\n webkitUserSelect: 'none',\n height: `${this.params.height}px`\n });\n\n if (wsParams.fillParent || wsParams.scrollParent) {\n this.util.style(this.wrapper, {\n width: '100%',\n overflowX: 'hidden',\n overflowY: 'hidden'\n });\n }\n\n this.wrapper.addEventListener('click', this._onWrapperClick);\n }\n\n /**\n * Render the timeline (also updates the already rendered timeline)\n *\n */\n render() {\n if (!this.wrapper) {\n this.createWrapper();\n }\n this.updateCanvases();\n this.updateCanvasesPositioning();\n this.renderCanvases();\n }\n\n /**\n * Add new timeline canvas\n *\n */\n addCanvas() {\n const canvas = this.wrapper.appendChild(\n document.createElement('canvas')\n );\n this.canvases.push(canvas);\n this.util.style(canvas, {\n position: 'absolute',\n zIndex: 4\n });\n }\n\n /**\n * Remove timeline canvas\n *\n */\n removeCanvas() {\n const canvas = this.canvases.pop();\n canvas.parentElement.removeChild(canvas);\n }\n\n /**\n * Make sure the correct of timeline canvas elements exist and are cached in\n * this.canvases\n *\n */\n updateCanvases() {\n const totalWidth = Math.round(this.drawer.wrapper.scrollWidth);\n const requiredCanvases = Math.ceil(\n totalWidth / this.maxCanvasElementWidth\n );\n\n while (this.canvases.length < requiredCanvases) {\n this.addCanvas();\n }\n\n while (this.canvases.length > requiredCanvases) {\n this.removeCanvas();\n }\n }\n\n /**\n * Update the dimensions and positioning style for all the timeline canvases\n *\n */\n updateCanvasesPositioning() {\n // cache length for performance\n const canvasesLength = this.canvases.length;\n this.canvases.forEach((canvas, i) => {\n // canvas width is the max element width, or if it is the last the\n // required width\n const canvasWidth =\n i === canvasesLength - 1\n ? this.drawer.wrapper.scrollWidth -\n this.maxCanvasElementWidth * (canvasesLength - 1)\n : this.maxCanvasElementWidth;\n // set dimensions and style\n canvas.width = canvasWidth * this.pixelRatio;\n // on certain pixel ratios the canvas appears cut off at the bottom,\n // therefore leave 1px extra\n canvas.height = (this.params.height + 1) * this.pixelRatio;\n this.util.style(canvas, {\n width: `${canvasWidth}px`,\n height: `${this.params.height}px`,\n left: `${i * this.maxCanvasElementWidth}px`\n });\n });\n }\n\n /**\n * Render the timeline labels and notches\n *\n */\n renderCanvases() {\n const duration =\n this.params.duration ||\n this.wavesurfer.backend.getDuration();\n\n if (duration <= 0) {\n return;\n }\n const wsParams = this.wavesurfer.params;\n const fontSize = this.params.fontSize * wsParams.pixelRatio;\n const totalSeconds = parseInt(duration, 10) + 1;\n const width =\n wsParams.fillParent && !wsParams.scrollParent\n ? this.drawer.getWidth()\n : this.drawer.wrapper.scrollWidth * wsParams.pixelRatio;\n const height1 = this.params.height * this.pixelRatio;\n const height2 =\n this.params.height *\n (this.params.notchPercentHeight / 100) *\n this.pixelRatio;\n const pixelsPerSecond = width / duration;\n\n const formatTime = this.params.formatTimeCallback;\n // if parameter is function, call the function with\n // pixelsPerSecond, otherwise simply take the value as-is\n const intervalFnOrVal = option =>\n typeof option === 'function' ? option(pixelsPerSecond) : option;\n const timeInterval = intervalFnOrVal(this.params.timeInterval);\n const primaryLabelInterval = intervalFnOrVal(\n this.params.primaryLabelInterval\n );\n const secondaryLabelInterval = intervalFnOrVal(\n this.params.secondaryLabelInterval\n );\n\n let curPixel = pixelsPerSecond * this.params.offset;\n let curSeconds = 0;\n let i;\n // build an array of position data with index, second and pixel data,\n // this is then used multiple times below\n const positioning = [];\n for (i = 0; i < totalSeconds / timeInterval; i++) {\n positioning.push([i, curSeconds, curPixel]);\n curSeconds += timeInterval;\n curPixel += pixelsPerSecond * timeInterval;\n }\n\n // iterate over each position\n const renderPositions = cb => {\n positioning.forEach(pos => {\n cb(pos[0], pos[1], pos[2]);\n });\n };\n\n // render primary labels\n this.setFillStyles(this.params.primaryColor);\n this.setFonts(`${fontSize}px ${this.params.fontFamily}`);\n this.setFillStyles(this.params.primaryFontColor);\n renderPositions((i, curSeconds, curPixel) => {\n if (i % primaryLabelInterval === 0) {\n this.fillRect(curPixel, 0, 1, height1);\n this.fillText(\n formatTime(curSeconds, pixelsPerSecond),\n curPixel + this.params.labelPadding * this.pixelRatio,\n height1\n );\n }\n });\n\n // render secondary labels\n this.setFillStyles(this.params.secondaryColor);\n this.setFonts(`${fontSize}px ${this.params.fontFamily}`);\n this.setFillStyles(this.params.secondaryFontColor);\n renderPositions((i, curSeconds, curPixel) => {\n if (i % secondaryLabelInterval === 0) {\n this.fillRect(curPixel, 0, 1, height1);\n this.fillText(\n formatTime(curSeconds, pixelsPerSecond),\n curPixel + this.params.labelPadding * this.pixelRatio,\n height1\n );\n }\n });\n\n // render the actual notches (when no labels are used)\n this.setFillStyles(this.params.unlabeledNotchColor);\n renderPositions((i, curSeconds, curPixel) => {\n if (\n i % secondaryLabelInterval !== 0 &&\n i % primaryLabelInterval !== 0\n ) {\n this.fillRect(curPixel, 0, 1, height2);\n }\n });\n }\n\n /**\n * Set the canvas fill style\n *\n * @param {DOMString|CanvasGradient|CanvasPattern} fillStyle Fill style to\n * use\n */\n setFillStyles(fillStyle) {\n this.canvases.forEach(canvas => {\n const context = canvas.getContext('2d');\n if (context) {\n context.fillStyle = fillStyle;\n }\n });\n }\n\n /**\n * Set the canvas font\n *\n * @param {DOMString} font Font to use\n */\n setFonts(font) {\n this.canvases.forEach(canvas => {\n const context = canvas.getContext('2d');\n if (context) {\n context.font = font;\n }\n });\n }\n\n /**\n * Draw a rectangle on the canvases\n *\n * (it figures out the offset for each canvas)\n *\n * @param {number} x X-position\n * @param {number} y Y-position\n * @param {number} width Width\n * @param {number} height Height\n */\n fillRect(x, y, width, height) {\n this.canvases.forEach((canvas, i) => {\n const leftOffset = i * this.maxCanvasWidth;\n\n const intersection = {\n x1: Math.max(x, i * this.maxCanvasWidth),\n y1: y,\n x2: Math.min(x + width, i * this.maxCanvasWidth + canvas.width),\n y2: y + height\n };\n\n if (intersection.x1 < intersection.x2) {\n const context = canvas\n .getContext('2d');\n if (context) {\n context\n .fillRect(\n intersection.x1 - leftOffset,\n intersection.y1,\n intersection.x2 - intersection.x1,\n intersection.y2 - intersection.y1\n );\n }\n }\n });\n }\n\n /**\n * Fill a given text on the canvases\n *\n * @param {string} text Text to render\n * @param {number} x X-position\n * @param {number} y Y-position\n */\n fillText(text, x, y) {\n let textWidth;\n let xOffset = 0;\n\n this.canvases.forEach(canvas => {\n const context = canvas.getContext('2d');\n if (context) {\n const canvasWidth = context.canvas.width;\n\n if (xOffset > x + textWidth) {\n return;\n }\n\n if (xOffset + canvasWidth > x && context) {\n textWidth = context.measureText(text).width;\n context.fillText(text, x - xOffset, y);\n }\n\n xOffset += canvasWidth;\n }\n });\n }\n\n /**\n * Turn the time into a suitable label for the time.\n *\n * @param {number} seconds Seconds to format\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Time\n */\n defaultFormatTimeCallback(seconds, pxPerSec) {\n if (seconds / 60 > 1) {\n // calculate minutes and seconds from seconds count\n const minutes = parseInt(seconds / 60, 10);\n seconds = parseInt(seconds % 60, 10);\n // fill up seconds with zeroes\n seconds = seconds < 10 ? '0' + seconds : seconds;\n return `${minutes}:${seconds}`;\n }\n return Math.round(seconds * 1000) / 1000;\n }\n\n /**\n * Return how many seconds should be between each notch\n *\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Time\n */\n defaultTimeInterval(pxPerSec) {\n if (pxPerSec >= 25) {\n return 1;\n } else if (pxPerSec * 5 >= 25) {\n return 5;\n } else if (pxPerSec * 15 >= 25) {\n return 15;\n }\n return Math.ceil(0.5 / pxPerSec) * 60;\n }\n\n /**\n * Return the cadence of notches that get labels in the primary color.\n *\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Cadence\n */\n defaultPrimaryLabelInterval(pxPerSec) {\n if (pxPerSec >= 25) {\n return 10;\n } else if (pxPerSec * 5 >= 25) {\n return 6;\n } else if (pxPerSec * 15 >= 25) {\n return 4;\n }\n return 4;\n }\n\n /**\n * Return the cadence of notches that get labels in the secondary color.\n *\n * @param {number} pxPerSec Pixels per second\n * @returns {number} Cadence\n */\n defaultSecondaryLabelInterval(pxPerSec) {\n if (pxPerSec >= 25) {\n return 5;\n } else if (pxPerSec * 5 >= 25) {\n return 2;\n } else if (pxPerSec * 15 >= 25) {\n return 2;\n }\n return 2;\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__(171);\n"],"names":["root","factory","exports","module","define","amd","self","TimelinePlugin","params","ws","wrapper","drawer","scrollLeft","render","wavesurfer","pixelRatio","maxCanvasWidth","width","maxCanvasElementWidth","Math","round","addEventListener","_onScroll","on","_onRedraw","_onZoom","e","preventDefault","relX","offsetX","layerX","fireEvent","scrollWidth","this","container","document","querySelector","Error","util","Object","assign","height","notchPercentHeight","labelPadding","unlabeledNotchColor","primaryColor","secondaryColor","primaryFontColor","secondaryFontColor","fontFamily","fontSize","duration","zoomDebounce","formatTimeCallback","defaultFormatTimeCallback","timeInterval","defaultTimeInterval","primaryLabelInterval","defaultPrimaryLabelInterval","secondaryLabelInterval","defaultSecondaryLabelInterval","offset","canvases","debounce","name","deferInit","instance","isReady","_onReady","once","unAll","un","removeEventListener","parentNode","_onWrapperClick","removeChild","wsParams","innerHTML","appendChild","createElement","style","display","position","userSelect","webkitUserSelect","fillParent","scrollParent","overflowX","overflowY","createWrapper","updateCanvases","updateCanvasesPositioning","renderCanvases","canvas","push","zIndex","pop","parentElement","totalWidth","requiredCanvases","ceil","length","addCanvas","removeCanvas","canvasesLength","forEach","i","canvasWidth","left","backend","getDuration","totalSeconds","parseInt","getWidth","height1","height2","pixelsPerSecond","formatTime","intervalFnOrVal","option","curPixel","curSeconds","positioning","renderPositions","cb","pos","setFillStyles","setFonts","fillRect","fillText","fillStyle","context","getContext","font","x","y","leftOffset","intersection","x1","max","y1","x2","min","y2","text","textWidth","xOffset","measureText","seconds","pxPerSec","minutes","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* wavesurfer.js
|
|
2
|
+
* wavesurfer.js 6.0.2 (2022-02-20)
|
|
3
3
|
* https://wavesurfer-js.org
|
|
4
4
|
* @license BSD-3-Clause
|
|
5
5
|
*/
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
exports["WaveSurfer"] = factory();
|
|
13
13
|
else
|
|
14
14
|
root["WaveSurfer"] = root["WaveSurfer"] || {}, root["WaveSurfer"]["html-init"] = factory();
|
|
15
|
-
})(
|
|
15
|
+
})(self, function() {
|
|
16
16
|
return /******/ (() => { // webpackBootstrap
|
|
17
17
|
/******/ var __webpack_modules__ = ({
|
|
18
18
|
|
|
@@ -28,19 +28,19 @@ return /******/ (() => { // webpackBootstrap
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", ({
|
|
29
29
|
value: true
|
|
30
30
|
}));
|
|
31
|
-
exports
|
|
31
|
+
exports["default"] = void 0;
|
|
32
32
|
|
|
33
33
|
var _loadScript = _interopRequireDefault(__webpack_require__(/*! load-script */ "./node_modules/load-script/index.js"));
|
|
34
34
|
|
|
35
35
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
36
36
|
|
|
37
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
37
|
+
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); }
|
|
38
38
|
|
|
39
39
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
40
40
|
|
|
41
41
|
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); } }
|
|
42
42
|
|
|
43
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
43
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* @typedef {Object} InitParams
|
|
@@ -281,7 +281,7 @@ if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object'
|
|
|
281
281
|
|
|
282
282
|
|
|
283
283
|
var _default = Init;
|
|
284
|
-
exports
|
|
284
|
+
exports["default"] = _default;
|
|
285
285
|
module.exports = exports.default;
|
|
286
286
|
|
|
287
287
|
/***/ }),
|