wavesurfer.js 6.5.1 → 7.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +24 -0
- package/.prettierrc +8 -0
- package/README.md +26 -117
- package/dist/base-plugin.d.ts +10 -0
- package/dist/base-plugin.js +13 -0
- package/dist/decoder.d.ts +10 -0
- package/dist/decoder.js +43 -0
- package/dist/event-emitter.d.ts +11 -0
- package/dist/event-emitter.js +21 -0
- package/dist/fetcher.d.ts +4 -0
- package/dist/fetcher.js +17 -0
- package/dist/index.d.ts +92 -0
- package/dist/index.js +166 -0
- package/dist/player-webaudio.d.ts +8 -0
- package/dist/player-webaudio.js +31 -0
- package/dist/player.d.ts +16 -0
- package/dist/player.js +40 -0
- package/dist/plugins/regions.d.ts +48 -0
- package/dist/plugins/regions.js +183 -0
- package/dist/renderer.d.ts +34 -0
- package/dist/renderer.js +193 -0
- package/dist/timer.d.ts +10 -0
- package/dist/timer.js +17 -0
- package/examples/audio.ogg +0 -0
- package/examples/bars.js +19 -0
- package/examples/basic.js +8 -0
- package/examples/gradient.js +28 -0
- package/examples/regions.js +63 -0
- package/examples/video.js +19 -0
- package/examples/webaudio.js +14 -0
- package/package.json +19 -99
- package/src/base-plugin.ts +20 -0
- package/src/decoder.ts +41 -0
- package/src/event-emitter.ts +35 -0
- package/src/fetcher.ts +7 -0
- package/src/index.ts +252 -0
- package/src/player-webaudio.ts +34 -0
- package/src/player.ts +50 -0
- package/src/plugins/regions.ts +240 -0
- package/src/renderer.ts +250 -0
- package/src/timer.ts +27 -0
- package/tsconfig.json +105 -0
- package/tutorial/index.html +47 -0
- package/tutorial/src/editor.js +70 -0
- package/tutorial/src/init.js +66 -0
- package/tutorial/src/url.js +25 -0
- package/tutorial/style.css +211 -0
- package/yarn-error.log +1049 -0
- package/LICENSE +0 -29
- package/dist/plugin/wavesurfer.cursor.js +0 -418
- package/dist/plugin/wavesurfer.cursor.js.map +0 -1
- package/dist/plugin/wavesurfer.cursor.min.js +0 -7
- package/dist/plugin/wavesurfer.cursor.min.js.map +0 -1
- package/dist/plugin/wavesurfer.elan.js +0 -381
- package/dist/plugin/wavesurfer.elan.js.map +0 -1
- package/dist/plugin/wavesurfer.elan.min.js +0 -7
- package/dist/plugin/wavesurfer.elan.min.js.map +0 -1
- package/dist/plugin/wavesurfer.markers.js +0 -520
- package/dist/plugin/wavesurfer.markers.js.map +0 -1
- package/dist/plugin/wavesurfer.markers.min.js +0 -7
- package/dist/plugin/wavesurfer.markers.min.js.map +0 -1
- package/dist/plugin/wavesurfer.mediasession.js +0 -181
- package/dist/plugin/wavesurfer.mediasession.js.map +0 -1
- package/dist/plugin/wavesurfer.mediasession.min.js +0 -7
- package/dist/plugin/wavesurfer.mediasession.min.js.map +0 -1
- package/dist/plugin/wavesurfer.microphone.js +0 -466
- package/dist/plugin/wavesurfer.microphone.js.map +0 -1
- package/dist/plugin/wavesurfer.microphone.min.js +0 -7
- package/dist/plugin/wavesurfer.microphone.min.js.map +0 -1
- package/dist/plugin/wavesurfer.minimap.js +0 -440
- package/dist/plugin/wavesurfer.minimap.js.map +0 -1
- package/dist/plugin/wavesurfer.minimap.min.js +0 -7
- package/dist/plugin/wavesurfer.minimap.min.js.map +0 -1
- package/dist/plugin/wavesurfer.playhead.js +0 -300
- package/dist/plugin/wavesurfer.playhead.js.map +0 -1
- package/dist/plugin/wavesurfer.playhead.min.js +0 -7
- package/dist/plugin/wavesurfer.playhead.min.js.map +0 -1
- package/dist/plugin/wavesurfer.regions.js +0 -1335
- package/dist/plugin/wavesurfer.regions.js.map +0 -1
- package/dist/plugin/wavesurfer.regions.min.js +0 -7
- package/dist/plugin/wavesurfer.regions.min.js.map +0 -1
- package/dist/plugin/wavesurfer.spectrogram.js +0 -736
- package/dist/plugin/wavesurfer.spectrogram.js.map +0 -1
- package/dist/plugin/wavesurfer.spectrogram.min.js +0 -7
- package/dist/plugin/wavesurfer.spectrogram.min.js.map +0 -1
- package/dist/plugin/wavesurfer.timeline.js +0 -649
- package/dist/plugin/wavesurfer.timeline.js.map +0 -1
- package/dist/plugin/wavesurfer.timeline.min.js +0 -7
- package/dist/plugin/wavesurfer.timeline.min.js.map +0 -1
- package/dist/wavesurfer-html-init.js +0 -381
- package/dist/wavesurfer-html-init.js.map +0 -1
- package/dist/wavesurfer-html-init.min.js +0 -7
- package/dist/wavesurfer-html-init.min.js.map +0 -1
- package/dist/wavesurfer.js +0 -6145
- package/dist/wavesurfer.js.map +0 -1
- package/dist/wavesurfer.min.js +0 -7
- package/dist/wavesurfer.min.js.map +0 -1
- package/src/drawer.canvasentry.js +0 -427
- package/src/drawer.js +0 -413
- package/src/drawer.multicanvas.js +0 -617
- package/src/html-init.js +0 -241
- package/src/mediaelement-webaudio.js +0 -77
- package/src/mediaelement.js +0 -443
- package/src/peakcache.js +0 -127
- package/src/plugin/cursor/index.js +0 -350
- package/src/plugin/elan/index.js +0 -307
- package/src/plugin/markers/index.js +0 -436
- package/src/plugin/mediasession/index.js +0 -94
- package/src/plugin/microphone/index.js +0 -415
- package/src/plugin/minimap/index.js +0 -403
- package/src/plugin/playhead/index.js +0 -226
- package/src/plugin/regions/index.js +0 -478
- package/src/plugin/regions/region.js +0 -875
- package/src/plugin/spectrogram/fft.js +0 -222
- package/src/plugin/spectrogram/index.js +0 -522
- package/src/plugin/timeline/index.js +0 -600
- package/src/util/absMax.js +0 -16
- package/src/util/clamp.js +0 -11
- package/src/util/fetch.js +0 -222
- package/src/util/frame.js +0 -13
- package/src/util/get-id.js +0 -22
- package/src/util/index.js +0 -14
- package/src/util/max.js +0 -16
- package/src/util/min.js +0 -16
- package/src/util/observer.js +0 -144
- package/src/util/orientation.js +0 -98
- package/src/util/prevent-click.js +0 -19
- package/src/util/request-animation-frame.js +0 -15
- package/src/util/silence-mode.js +0 -42
- package/src/util/style.js +0 -16
- package/src/wavesurfer.js +0 -1797
- package/src/webaudio.js +0 -779
|
@@ -1,440 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* wavesurfer.js minimap plugin 6.5.1 (2023-03-12)
|
|
3
|
-
* https://wavesurfer-js.org
|
|
4
|
-
* @license BSD-3-Clause
|
|
5
|
-
*/
|
|
6
|
-
(function webpackUniversalModuleDefinition(root, factory) {
|
|
7
|
-
if(typeof exports === 'object' && typeof module === 'object')
|
|
8
|
-
module.exports = factory();
|
|
9
|
-
else if(typeof define === 'function' && define.amd)
|
|
10
|
-
define("WaveSurfer", [], factory);
|
|
11
|
-
else if(typeof exports === 'object')
|
|
12
|
-
exports["WaveSurfer"] = factory();
|
|
13
|
-
else
|
|
14
|
-
root["WaveSurfer"] = root["WaveSurfer"] || {}, root["WaveSurfer"]["minimap"] = factory();
|
|
15
|
-
})(self, () => {
|
|
16
|
-
return /******/ (() => { // webpackBootstrap
|
|
17
|
-
/******/ "use strict";
|
|
18
|
-
/******/ var __webpack_modules__ = ({
|
|
19
|
-
|
|
20
|
-
/***/ "./src/plugin/minimap/index.js":
|
|
21
|
-
/*!*************************************!*\
|
|
22
|
-
!*** ./src/plugin/minimap/index.js ***!
|
|
23
|
-
\*************************************/
|
|
24
|
-
/***/ ((module, exports) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
29
|
-
value: true
|
|
30
|
-
}));
|
|
31
|
-
exports["default"] = void 0;
|
|
32
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
33
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
34
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
35
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
36
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
37
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
38
|
-
/*eslint no-console: ["error", { allow: ["warn"] }] */
|
|
39
|
-
/**
|
|
40
|
-
* @typedef {Object} MinimapPluginParams
|
|
41
|
-
* @desc Extends the `WavesurferParams` wavesurfer was initialised with
|
|
42
|
-
* @property {?string|HTMLElement} container CSS selector or HTML element where
|
|
43
|
-
* the map should be rendered. By default it is simply appended
|
|
44
|
-
* after the waveform.
|
|
45
|
-
* @property {?boolean} deferInit Set to true to manually call
|
|
46
|
-
* `initPlugin('minimap')`
|
|
47
|
-
*/
|
|
48
|
-
/**
|
|
49
|
-
* Renders a smaller version waveform as a minimap of the main waveform.
|
|
50
|
-
*
|
|
51
|
-
* @implements {PluginClass}
|
|
52
|
-
* @extends {Observer}
|
|
53
|
-
* @example
|
|
54
|
-
* // es6
|
|
55
|
-
* import MinimapPlugin from 'wavesurfer.minimap.js';
|
|
56
|
-
*
|
|
57
|
-
* // commonjs
|
|
58
|
-
* var MinimapPlugin = require('wavesurfer.minimap.js');
|
|
59
|
-
*
|
|
60
|
-
* // if you are using <script> tags
|
|
61
|
-
* var MinimapPlugin = window.WaveSurfer.minimap;
|
|
62
|
-
*
|
|
63
|
-
* // ... initialising wavesurfer with the plugin
|
|
64
|
-
* var wavesurfer = WaveSurfer.create({
|
|
65
|
-
* // wavesurfer options ...
|
|
66
|
-
* plugins: [
|
|
67
|
-
* MinimapPlugin.create({
|
|
68
|
-
* // plugin options ...
|
|
69
|
-
* })
|
|
70
|
-
* ]
|
|
71
|
-
* });
|
|
72
|
-
*/
|
|
73
|
-
var MinimapPlugin = /*#__PURE__*/function () {
|
|
74
|
-
function MinimapPlugin(params, ws) {
|
|
75
|
-
var _this = this;
|
|
76
|
-
_classCallCheck(this, MinimapPlugin);
|
|
77
|
-
this.params = Object.assign({}, ws.params, {
|
|
78
|
-
showRegions: false,
|
|
79
|
-
regionsPluginName: params.regionsPluginName || 'regions',
|
|
80
|
-
showOverview: false,
|
|
81
|
-
overviewBorderColor: 'green',
|
|
82
|
-
overviewBorderSize: 2,
|
|
83
|
-
// the container should be different
|
|
84
|
-
container: false,
|
|
85
|
-
height: Math.max(Math.round(ws.params.height / 4), 20)
|
|
86
|
-
}, params, {
|
|
87
|
-
scrollParent: false,
|
|
88
|
-
fillParent: true
|
|
89
|
-
});
|
|
90
|
-
// if container is a selector, get the element
|
|
91
|
-
if (typeof params.container === 'string') {
|
|
92
|
-
var el = document.querySelector(params.container);
|
|
93
|
-
if (!el) {
|
|
94
|
-
console.warn("Wavesurfer minimap container ".concat(params.container, " was not found! The minimap will be automatically appended below the waveform."));
|
|
95
|
-
}
|
|
96
|
-
this.params.container = el;
|
|
97
|
-
}
|
|
98
|
-
// if no container is specified add a new element and insert it
|
|
99
|
-
if (!params.container) {
|
|
100
|
-
this.params.container = ws.util.style(document.createElement('minimap'), {
|
|
101
|
-
display: 'block'
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
this.drawer = new ws.Drawer(this.params.container, this.params);
|
|
105
|
-
this.wavesurfer = ws;
|
|
106
|
-
this.util = ws.util;
|
|
107
|
-
this.cleared = false;
|
|
108
|
-
this.renderEvent = 'redraw';
|
|
109
|
-
this.overviewRegion = null;
|
|
110
|
-
this.regionsPlugin = this.wavesurfer[this.params.regionsPluginName];
|
|
111
|
-
this.drawer.createWrapper();
|
|
112
|
-
this.createElements();
|
|
113
|
-
var isInitialised = false;
|
|
114
|
-
|
|
115
|
-
// ws ready event listener
|
|
116
|
-
this._onShouldRender = function () {
|
|
117
|
-
// only bind the events in the first run
|
|
118
|
-
if (!isInitialised) {
|
|
119
|
-
_this.bindWavesurferEvents();
|
|
120
|
-
_this.bindMinimapEvents();
|
|
121
|
-
isInitialised = true;
|
|
122
|
-
}
|
|
123
|
-
// if there is no such element, append it to the container (below
|
|
124
|
-
// the waveform)
|
|
125
|
-
if (!document.body.contains(_this.params.container)) {
|
|
126
|
-
ws.container.insertBefore(_this.params.container, null);
|
|
127
|
-
}
|
|
128
|
-
if (_this.regionsPlugin && _this.params.showRegions) {
|
|
129
|
-
_this.drawRegions();
|
|
130
|
-
}
|
|
131
|
-
_this.render();
|
|
132
|
-
};
|
|
133
|
-
this._onAudioprocess = function (currentTime) {
|
|
134
|
-
_this.drawer.progress(_this.wavesurfer.backend.getPlayedPercents());
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
// ws seek event listener
|
|
138
|
-
this._onSeek = function () {
|
|
139
|
-
return _this.drawer.progress(ws.backend.getPlayedPercents());
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
// event listeners for the overview region
|
|
143
|
-
this._onScroll = function (e) {
|
|
144
|
-
if (!_this.draggingOverview) {
|
|
145
|
-
var orientedTarget = _this.util.withOrientation(e.target, _this.wavesurfer.params.vertical);
|
|
146
|
-
_this.moveOverviewRegion(orientedTarget.scrollLeft / _this.ratio);
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
this._onMouseover = function (e) {
|
|
150
|
-
if (_this.draggingOverview) {
|
|
151
|
-
_this.draggingOverview = false;
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
var prevWidth = 0;
|
|
155
|
-
this._onResize = ws.util.debounce(function () {
|
|
156
|
-
if (prevWidth != _this.drawer.wrapper.clientWidth) {
|
|
157
|
-
prevWidth = _this.drawer.wrapper.clientWidth;
|
|
158
|
-
_this.render();
|
|
159
|
-
_this.drawer.progress(_this.wavesurfer.backend.getPlayedPercents());
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
this._onLoading = function (percent) {
|
|
163
|
-
if (percent >= 100) {
|
|
164
|
-
_this.cleared = false;
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
if (_this.cleared === true) {
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
var len = _this.drawer.getWidth();
|
|
171
|
-
_this.drawer.drawPeaks([0], len, 0, len);
|
|
172
|
-
_this.cleared = true;
|
|
173
|
-
};
|
|
174
|
-
this._onZoom = function (e) {
|
|
175
|
-
_this.render();
|
|
176
|
-
};
|
|
177
|
-
this.wavesurfer.on('zoom', this._onZoom);
|
|
178
|
-
}
|
|
179
|
-
_createClass(MinimapPlugin, [{
|
|
180
|
-
key: "init",
|
|
181
|
-
value: function init() {
|
|
182
|
-
if (this.wavesurfer.isReady) {
|
|
183
|
-
this._onShouldRender();
|
|
184
|
-
}
|
|
185
|
-
this.wavesurfer.on(this.renderEvent, this._onShouldRender);
|
|
186
|
-
}
|
|
187
|
-
}, {
|
|
188
|
-
key: "destroy",
|
|
189
|
-
value: function destroy() {
|
|
190
|
-
window.removeEventListener('resize', this._onResize, true);
|
|
191
|
-
window.removeEventListener('orientationchange', this._onResize, true);
|
|
192
|
-
this.wavesurfer.drawer.wrapper.removeEventListener('mouseover', this._onMouseover);
|
|
193
|
-
this.wavesurfer.un(this.renderEvent, this._onShouldRender);
|
|
194
|
-
this.wavesurfer.un('seek', this._onSeek);
|
|
195
|
-
this.wavesurfer.un('scroll', this._onScroll);
|
|
196
|
-
this.wavesurfer.un('audioprocess', this._onAudioprocess);
|
|
197
|
-
this.wavesurfer.un('zoom', this._onZoom);
|
|
198
|
-
this.wavesurfer.un('loading', this._onLoading);
|
|
199
|
-
this.drawer.destroy();
|
|
200
|
-
this.overviewRegion = null;
|
|
201
|
-
this.unAll();
|
|
202
|
-
}
|
|
203
|
-
}, {
|
|
204
|
-
key: "drawRegions",
|
|
205
|
-
value: function drawRegions() {
|
|
206
|
-
var _this2 = this;
|
|
207
|
-
this.regions = {};
|
|
208
|
-
this.wavesurfer.on('region-created', function (region) {
|
|
209
|
-
_this2.regions[region.id] = region;
|
|
210
|
-
_this2.drawer.wrapper && _this2.renderRegions();
|
|
211
|
-
});
|
|
212
|
-
this.wavesurfer.on('region-updated', function (region) {
|
|
213
|
-
_this2.regions[region.id] = region;
|
|
214
|
-
_this2.drawer.wrapper && _this2.renderRegions();
|
|
215
|
-
});
|
|
216
|
-
this.wavesurfer.on('region-removed', function (region) {
|
|
217
|
-
delete _this2.regions[region.id];
|
|
218
|
-
_this2.drawer.wrapper && _this2.renderRegions();
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
}, {
|
|
222
|
-
key: "renderRegions",
|
|
223
|
-
value: function renderRegions() {
|
|
224
|
-
var _this3 = this;
|
|
225
|
-
var regionElements = this.drawer.wrapper.querySelectorAll('region');
|
|
226
|
-
var i;
|
|
227
|
-
for (i = 0; i < regionElements.length; ++i) {
|
|
228
|
-
this.drawer.wrapper.removeChild(regionElements[i]);
|
|
229
|
-
}
|
|
230
|
-
Object.keys(this.regions).forEach(function (id) {
|
|
231
|
-
var region = _this3.regions[id];
|
|
232
|
-
var width = _this3.getWidth() * ((region.end - region.start) / _this3.wavesurfer.getDuration());
|
|
233
|
-
var left = _this3.getWidth() * (region.start / _this3.wavesurfer.getDuration());
|
|
234
|
-
var regionElement = _this3.util.style(document.createElement('region'), {
|
|
235
|
-
height: 'inherit',
|
|
236
|
-
backgroundColor: region.color,
|
|
237
|
-
width: width + 'px',
|
|
238
|
-
left: left + 'px',
|
|
239
|
-
display: 'block',
|
|
240
|
-
position: 'absolute'
|
|
241
|
-
});
|
|
242
|
-
regionElement.classList.add(id);
|
|
243
|
-
_this3.drawer.wrapper.appendChild(regionElement);
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
}, {
|
|
247
|
-
key: "createElements",
|
|
248
|
-
value: function createElements() {
|
|
249
|
-
this.drawer.createElements();
|
|
250
|
-
if (this.params.showOverview) {
|
|
251
|
-
this.overviewRegion = this.util.withOrientation(this.drawer.wrapper.appendChild(document.createElement('overview')), this.wavesurfer.params.vertical);
|
|
252
|
-
this.util.style(this.overviewRegion, {
|
|
253
|
-
top: 0,
|
|
254
|
-
bottom: 0,
|
|
255
|
-
width: '0px',
|
|
256
|
-
display: 'block',
|
|
257
|
-
position: 'absolute',
|
|
258
|
-
cursor: 'move',
|
|
259
|
-
border: this.params.overviewBorderSize + 'px solid ' + this.params.overviewBorderColor,
|
|
260
|
-
zIndex: 2,
|
|
261
|
-
opacity: this.params.overviewOpacity
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}, {
|
|
266
|
-
key: "bindWavesurferEvents",
|
|
267
|
-
value: function bindWavesurferEvents() {
|
|
268
|
-
window.addEventListener('resize', this._onResize, true);
|
|
269
|
-
window.addEventListener('orientationchange', this._onResize, true);
|
|
270
|
-
this.wavesurfer.on('audioprocess', this._onAudioprocess);
|
|
271
|
-
this.wavesurfer.on('seek', this._onSeek);
|
|
272
|
-
this.wavesurfer.on('loading', this._onLoading);
|
|
273
|
-
if (this.params.showOverview) {
|
|
274
|
-
this.wavesurfer.on('scroll', this._onScroll);
|
|
275
|
-
this.wavesurfer.drawer.wrapper.addEventListener('mouseover', this._onMouseover);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}, {
|
|
279
|
-
key: "bindMinimapEvents",
|
|
280
|
-
value: function bindMinimapEvents() {
|
|
281
|
-
var _this4 = this;
|
|
282
|
-
var positionMouseDown = {
|
|
283
|
-
clientX: 0,
|
|
284
|
-
clientY: 0
|
|
285
|
-
};
|
|
286
|
-
var relativePositionX = 0;
|
|
287
|
-
var seek = true;
|
|
288
|
-
|
|
289
|
-
// the following event listeners will be destroyed by using
|
|
290
|
-
// this.unAll() and nullifying the DOM node references after
|
|
291
|
-
// removing them
|
|
292
|
-
if (this.params.interact) {
|
|
293
|
-
this.drawer.wrapper.addEventListener('click', function (event) {
|
|
294
|
-
_this4.fireEvent('click', event, _this4.drawer.handleEvent(event));
|
|
295
|
-
});
|
|
296
|
-
this.on('click', function (event, position) {
|
|
297
|
-
if (seek) {
|
|
298
|
-
_this4.drawer.progress(position);
|
|
299
|
-
_this4.wavesurfer.seekAndCenter(position);
|
|
300
|
-
} else {
|
|
301
|
-
seek = true;
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
if (this.params.showOverview) {
|
|
306
|
-
this.overviewRegion.domElement.addEventListener('mousedown', function (e) {
|
|
307
|
-
var event = _this4.util.withOrientation(e, _this4.wavesurfer.params.vertical);
|
|
308
|
-
_this4.draggingOverview = true;
|
|
309
|
-
relativePositionX = event.layerX;
|
|
310
|
-
positionMouseDown.clientX = event.clientX;
|
|
311
|
-
positionMouseDown.clientY = event.clientY;
|
|
312
|
-
});
|
|
313
|
-
this.drawer.wrapper.addEventListener('mousemove', function (e) {
|
|
314
|
-
if (_this4.draggingOverview) {
|
|
315
|
-
var event = _this4.util.withOrientation(e, _this4.wavesurfer.params.vertical);
|
|
316
|
-
_this4.moveOverviewRegion(event.clientX - _this4.drawer.container.getBoundingClientRect().left - relativePositionX);
|
|
317
|
-
}
|
|
318
|
-
});
|
|
319
|
-
this.drawer.wrapper.addEventListener('mouseup', function (e) {
|
|
320
|
-
var event = _this4.util.withOrientation(e, _this4.wavesurfer.params.vertical);
|
|
321
|
-
if (positionMouseDown.clientX - event.clientX === 0 && positionMouseDown.clientX - event.clientX === 0) {
|
|
322
|
-
seek = true;
|
|
323
|
-
_this4.draggingOverview = false;
|
|
324
|
-
} else if (_this4.draggingOverview) {
|
|
325
|
-
seek = false;
|
|
326
|
-
_this4.draggingOverview = false;
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}, {
|
|
332
|
-
key: "render",
|
|
333
|
-
value: function render() {
|
|
334
|
-
var len = this.drawer.getWidth();
|
|
335
|
-
var peaks = this.wavesurfer.backend.getPeaks(len, 0, len);
|
|
336
|
-
this.drawer.drawPeaks(peaks, len, 0, len);
|
|
337
|
-
this.drawer.progress(this.wavesurfer.backend.getPlayedPercents());
|
|
338
|
-
if (this.params.showOverview) {
|
|
339
|
-
//get proportional width of overview region considering the respective
|
|
340
|
-
//width of the drawers
|
|
341
|
-
this.ratio = this.wavesurfer.drawer.width / this.drawer.width;
|
|
342
|
-
this.waveShowedWidth = this.wavesurfer.drawer.width / this.ratio;
|
|
343
|
-
this.waveWidth = this.wavesurfer.drawer.width;
|
|
344
|
-
this.overviewWidth = this.drawer.container.offsetWidth / this.ratio;
|
|
345
|
-
this.overviewPosition = 0;
|
|
346
|
-
this.moveOverviewRegion(this.wavesurfer.drawer.wrapper.scrollLeft / this.ratio);
|
|
347
|
-
this.util.style(this.overviewRegion, {
|
|
348
|
-
width: this.overviewWidth + 'px'
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
}, {
|
|
353
|
-
key: "moveOverviewRegion",
|
|
354
|
-
value: function moveOverviewRegion(pixels) {
|
|
355
|
-
if (pixels < 0) {
|
|
356
|
-
this.overviewPosition = 0;
|
|
357
|
-
} else if (pixels + this.overviewWidth < this.drawer.container.offsetWidth) {
|
|
358
|
-
this.overviewPosition = pixels;
|
|
359
|
-
} else {
|
|
360
|
-
this.overviewPosition = this.drawer.container.offsetWidth - this.overviewWidth;
|
|
361
|
-
}
|
|
362
|
-
this.util.style(this.overviewRegion, {
|
|
363
|
-
left: this.overviewPosition + 'px'
|
|
364
|
-
});
|
|
365
|
-
if (this.draggingOverview) {
|
|
366
|
-
this.wavesurfer.drawer.wrapper.scrollLeft = this.overviewPosition * this.ratio;
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}, {
|
|
370
|
-
key: "getWidth",
|
|
371
|
-
value: function getWidth() {
|
|
372
|
-
return this.drawer.width / this.params.pixelRatio;
|
|
373
|
-
}
|
|
374
|
-
}], [{
|
|
375
|
-
key: "create",
|
|
376
|
-
value:
|
|
377
|
-
/**
|
|
378
|
-
* Minimap plugin definition factory
|
|
379
|
-
*
|
|
380
|
-
* This function must be used to create a plugin definition which can be
|
|
381
|
-
* used by wavesurfer to correctly instantiate the plugin.
|
|
382
|
-
*
|
|
383
|
-
* @param {MinimapPluginParams} params parameters use to initialise the plugin
|
|
384
|
-
* @return {PluginDefinition} an object representing the plugin
|
|
385
|
-
*/
|
|
386
|
-
function create(params) {
|
|
387
|
-
return {
|
|
388
|
-
name: 'minimap',
|
|
389
|
-
deferInit: params && params.deferInit ? params.deferInit : false,
|
|
390
|
-
params: params,
|
|
391
|
-
staticProps: {},
|
|
392
|
-
instance: MinimapPlugin
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
}]);
|
|
396
|
-
return MinimapPlugin;
|
|
397
|
-
}();
|
|
398
|
-
exports["default"] = MinimapPlugin;
|
|
399
|
-
module.exports = exports.default;
|
|
400
|
-
|
|
401
|
-
/***/ })
|
|
402
|
-
|
|
403
|
-
/******/ });
|
|
404
|
-
/************************************************************************/
|
|
405
|
-
/******/ // The module cache
|
|
406
|
-
/******/ var __webpack_module_cache__ = {};
|
|
407
|
-
/******/
|
|
408
|
-
/******/ // The require function
|
|
409
|
-
/******/ function __webpack_require__(moduleId) {
|
|
410
|
-
/******/ // Check if module is in cache
|
|
411
|
-
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
412
|
-
/******/ if (cachedModule !== undefined) {
|
|
413
|
-
/******/ return cachedModule.exports;
|
|
414
|
-
/******/ }
|
|
415
|
-
/******/ // Create a new module (and put it into the cache)
|
|
416
|
-
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
417
|
-
/******/ // no module.id needed
|
|
418
|
-
/******/ // no module.loaded needed
|
|
419
|
-
/******/ exports: {}
|
|
420
|
-
/******/ };
|
|
421
|
-
/******/
|
|
422
|
-
/******/ // Execute the module function
|
|
423
|
-
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
424
|
-
/******/
|
|
425
|
-
/******/ // Return the exports of the module
|
|
426
|
-
/******/ return module.exports;
|
|
427
|
-
/******/ }
|
|
428
|
-
/******/
|
|
429
|
-
/************************************************************************/
|
|
430
|
-
/******/
|
|
431
|
-
/******/ // startup
|
|
432
|
-
/******/ // Load entry module and return exports
|
|
433
|
-
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
434
|
-
/******/ var __webpack_exports__ = __webpack_require__("./src/plugin/minimap/index.js");
|
|
435
|
-
/******/
|
|
436
|
-
/******/ return __webpack_exports__;
|
|
437
|
-
/******/ })()
|
|
438
|
-
;
|
|
439
|
-
});
|
|
440
|
-
//# sourceMappingURL=wavesurfer.minimap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wavesurfer.minimap.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;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxBA,IAyBqBA,aAAa;EAoB9B,SAAAA,cAAYC,MAAM,EAAEC,EAAE,EAAE;IAAA,IAAAC,KAAA;IAAAC,eAAA,OAAAJ,aAAA;IACpB,IAAI,CAACC,MAAM,GAAGI,MAAM,CAACC,MAAM,CACvB,CAAC,CAAC,EACFJ,EAAE,CAACD,MAAM,EACT;MACIM,WAAW,EAAE,KAAK;MAClBC,iBAAiB,EAAEP,MAAM,CAACO,iBAAiB,IAAI,SAAS;MACxDC,YAAY,EAAE,KAAK;MACnBC,m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AAAAmJ,kBAAA,GAAAnJ,aAAA;AAAAqJ,MAAA,CAAAF,OAAA,GAAAA,OAAA,CAAAC,OAAA;;;;;;UCtDL;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;UEtBA;UACA;UACA;UACA","sources":["webpack://WaveSurfer/webpack/universalModuleDefinition","webpack://WaveSurfer/./src/plugin/minimap/index.js","webpack://WaveSurfer/webpack/bootstrap","webpack://WaveSurfer/webpack/before-startup","webpack://WaveSurfer/webpack/startup","webpack://WaveSurfer/webpack/after-startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"minimap\"] = factory();\n})(self, () => {\nreturn ","/*eslint no-console: [\"error\", { allow: [\"warn\"] }] */\n/**\n * @typedef {Object} MinimapPluginParams\n * @desc Extends the `WavesurferParams` wavesurfer was initialised with\n * @property {?string|HTMLElement} container CSS selector or HTML element where\n * the map should be rendered. By default it is simply appended\n * after the waveform.\n * @property {?boolean} deferInit Set to true to manually call\n * `initPlugin('minimap')`\n */\n\n/**\n * Renders a smaller version waveform as a minimap of the main waveform.\n *\n * @implements {PluginClass}\n * @extends {Observer}\n * @example\n * // es6\n * import MinimapPlugin from 'wavesurfer.minimap.js';\n *\n * // commonjs\n * var MinimapPlugin = require('wavesurfer.minimap.js');\n *\n * // if you are using <script> tags\n * var MinimapPlugin = window.WaveSurfer.minimap;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * MinimapPlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\nexport default class MinimapPlugin {\n /**\n * Minimap 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 {MinimapPluginParams} params parameters use to initialise the plugin\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'minimap',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n staticProps: {},\n instance: MinimapPlugin\n };\n }\n\n constructor(params, ws) {\n this.params = Object.assign(\n {},\n ws.params,\n {\n showRegions: false,\n regionsPluginName: params.regionsPluginName || 'regions',\n showOverview: false,\n overviewBorderColor: 'green',\n overviewBorderSize: 2,\n // the container should be different\n container: false,\n height: Math.max(Math.round(ws.params.height / 4), 20)\n },\n params,\n {\n scrollParent: false,\n fillParent: true\n }\n );\n // if container is a selector, get the element\n if (typeof params.container === 'string') {\n const el = document.querySelector(params.container);\n if (!el) {\n console.warn(\n `Wavesurfer minimap container ${params.container} was not found! The minimap will be automatically appended below the waveform.`\n );\n }\n this.params.container = el;\n }\n // if no container is specified add a new element and insert it\n if (!params.container) {\n this.params.container = ws.util.style(\n document.createElement('minimap'),\n {\n display: 'block'\n }\n );\n }\n this.drawer = new ws.Drawer(this.params.container, this.params);\n this.wavesurfer = ws;\n this.util = ws.util;\n this.cleared = false;\n this.renderEvent = 'redraw';\n this.overviewRegion = null;\n this.regionsPlugin = this.wavesurfer[this.params.regionsPluginName];\n\n this.drawer.createWrapper();\n this.createElements();\n let isInitialised = false;\n\n // ws ready event listener\n this._onShouldRender = () => {\n // only bind the events in the first run\n if (!isInitialised) {\n this.bindWavesurferEvents();\n this.bindMinimapEvents();\n isInitialised = true;\n }\n // if there is no such element, append it to the container (below\n // the waveform)\n if (!document.body.contains(this.params.container)) {\n ws.container.insertBefore(this.params.container, null);\n }\n\n if (this.regionsPlugin && this.params.showRegions) {\n this.drawRegions();\n }\n this.render();\n };\n\n this._onAudioprocess = currentTime => {\n this.drawer.progress(this.wavesurfer.backend.getPlayedPercents());\n };\n\n // ws seek event listener\n this._onSeek = () =>\n this.drawer.progress(ws.backend.getPlayedPercents());\n\n // event listeners for the overview region\n this._onScroll = e => {\n if (!this.draggingOverview) {\n const orientedTarget = this.util.withOrientation(e.target, this.wavesurfer.params.vertical);\n this.moveOverviewRegion(orientedTarget.scrollLeft / this.ratio);\n }\n };\n this._onMouseover = e => {\n if (this.draggingOverview) {\n this.draggingOverview = false;\n }\n };\n let prevWidth = 0;\n this._onResize = ws.util.debounce(() => {\n if (prevWidth != this.drawer.wrapper.clientWidth) {\n prevWidth = this.drawer.wrapper.clientWidth;\n this.render();\n this.drawer.progress(\n this.wavesurfer.backend.getPlayedPercents()\n );\n }\n });\n this._onLoading = percent => {\n if (percent >= 100) {\n this.cleared = false;\n return;\n }\n if (this.cleared === true) {\n return;\n }\n const len = this.drawer.getWidth();\n this.drawer.drawPeaks([0], len, 0, len);\n this.cleared = true;\n };\n this._onZoom = e => {\n this.render();\n };\n this.wavesurfer.on('zoom', this._onZoom);\n }\n\n init() {\n if (this.wavesurfer.isReady) {\n this._onShouldRender();\n }\n this.wavesurfer.on(this.renderEvent, this._onShouldRender);\n }\n\n destroy() {\n window.removeEventListener('resize', this._onResize, true);\n window.removeEventListener('orientationchange', this._onResize, true);\n this.wavesurfer.drawer.wrapper.removeEventListener(\n 'mouseover',\n this._onMouseover\n );\n this.wavesurfer.un(this.renderEvent, this._onShouldRender);\n this.wavesurfer.un('seek', this._onSeek);\n this.wavesurfer.un('scroll', this._onScroll);\n this.wavesurfer.un('audioprocess', this._onAudioprocess);\n this.wavesurfer.un('zoom', this._onZoom);\n this.wavesurfer.un('loading', this._onLoading);\n this.drawer.destroy();\n this.overviewRegion = null;\n this.unAll();\n }\n\n drawRegions() {\n this.regions = {};\n\n this.wavesurfer.on('region-created', region => {\n this.regions[region.id] = region;\n this.drawer.wrapper && this.renderRegions();\n });\n\n this.wavesurfer.on('region-updated', region => {\n this.regions[region.id] = region;\n this.drawer.wrapper && this.renderRegions();\n });\n\n this.wavesurfer.on('region-removed', region => {\n delete this.regions[region.id];\n this.drawer.wrapper && this.renderRegions();\n });\n }\n\n renderRegions() {\n const regionElements = this.drawer.wrapper.querySelectorAll('region');\n let i;\n for (i = 0; i < regionElements.length; ++i) {\n this.drawer.wrapper.removeChild(regionElements[i]);\n }\n\n Object.keys(this.regions).forEach(id => {\n const region = this.regions[id];\n const width =\n this.getWidth() *\n ((region.end - region.start) / this.wavesurfer.getDuration());\n const left =\n this.getWidth() *\n (region.start / this.wavesurfer.getDuration());\n const regionElement = this.util.style(\n document.createElement('region'),\n {\n height: 'inherit',\n backgroundColor: region.color,\n width: width + 'px',\n left: left + 'px',\n display: 'block',\n position: 'absolute'\n }\n );\n regionElement.classList.add(id);\n this.drawer.wrapper.appendChild(regionElement);\n });\n }\n\n createElements() {\n this.drawer.createElements();\n if (this.params.showOverview) {\n this.overviewRegion = this.util.withOrientation(\n this.drawer.wrapper.appendChild(document.createElement('overview')),\n this.wavesurfer.params.vertical\n );\n\n this.util.style(\n this.overviewRegion,\n {\n top: 0,\n bottom: 0,\n width: '0px',\n display: 'block',\n position: 'absolute',\n cursor: 'move',\n border:\n this.params.overviewBorderSize +\n 'px solid ' +\n this.params.overviewBorderColor,\n zIndex: 2,\n opacity: this.params.overviewOpacity\n }\n );\n }\n }\n\n bindWavesurferEvents() {\n window.addEventListener('resize', this._onResize, true);\n window.addEventListener('orientationchange', this._onResize, true);\n this.wavesurfer.on('audioprocess', this._onAudioprocess);\n this.wavesurfer.on('seek', this._onSeek);\n this.wavesurfer.on('loading', this._onLoading);\n if (this.params.showOverview) {\n this.wavesurfer.on('scroll', this._onScroll);\n this.wavesurfer.drawer.wrapper.addEventListener(\n 'mouseover',\n this._onMouseover\n );\n }\n }\n\n bindMinimapEvents() {\n const positionMouseDown = {\n clientX: 0,\n clientY: 0\n };\n let relativePositionX = 0;\n let seek = true;\n\n // the following event listeners will be destroyed by using\n // this.unAll() and nullifying the DOM node references after\n // removing them\n if (this.params.interact) {\n this.drawer.wrapper.addEventListener('click', event => {\n this.fireEvent('click', event, this.drawer.handleEvent(event));\n });\n\n this.on('click', (event, position) => {\n if (seek) {\n this.drawer.progress(position);\n this.wavesurfer.seekAndCenter(position);\n } else {\n seek = true;\n }\n });\n }\n\n if (this.params.showOverview) {\n this.overviewRegion.domElement.addEventListener('mousedown', e => {\n const event = this.util.withOrientation(e, this.wavesurfer.params.vertical);\n this.draggingOverview = true;\n relativePositionX = event.layerX;\n positionMouseDown.clientX = event.clientX;\n positionMouseDown.clientY = event.clientY;\n });\n\n this.drawer.wrapper.addEventListener('mousemove', e => {\n if (this.draggingOverview) {\n const event = this.util.withOrientation(e, this.wavesurfer.params.vertical);\n this.moveOverviewRegion(\n event.clientX -\n this.drawer.container.getBoundingClientRect().left -\n relativePositionX\n );\n }\n });\n\n this.drawer.wrapper.addEventListener('mouseup', e => {\n const event = this.util.withOrientation(e, this.wavesurfer.params.vertical);\n if (\n positionMouseDown.clientX - event.clientX === 0 &&\n positionMouseDown.clientX - event.clientX === 0\n ) {\n seek = true;\n this.draggingOverview = false;\n } else if (this.draggingOverview) {\n seek = false;\n this.draggingOverview = false;\n }\n });\n }\n }\n\n render() {\n const len = this.drawer.getWidth();\n const peaks = this.wavesurfer.backend.getPeaks(len, 0, len);\n this.drawer.drawPeaks(peaks, len, 0, len);\n this.drawer.progress(this.wavesurfer.backend.getPlayedPercents());\n\n if (this.params.showOverview) {\n //get proportional width of overview region considering the respective\n //width of the drawers\n this.ratio = this.wavesurfer.drawer.width / this.drawer.width;\n this.waveShowedWidth = this.wavesurfer.drawer.width / this.ratio;\n this.waveWidth = this.wavesurfer.drawer.width;\n this.overviewWidth = this.drawer.container.offsetWidth / this.ratio;\n this.overviewPosition = 0;\n this.moveOverviewRegion(\n this.wavesurfer.drawer.wrapper.scrollLeft / this.ratio\n );\n this.util.style(this.overviewRegion, {\n width: this.overviewWidth + 'px'\n });\n }\n }\n\n moveOverviewRegion(pixels) {\n if (pixels < 0) {\n this.overviewPosition = 0;\n } else if (\n pixels + this.overviewWidth <\n this.drawer.container.offsetWidth\n ) {\n this.overviewPosition = pixels;\n } else {\n this.overviewPosition =\n this.drawer.container.offsetWidth - this.overviewWidth;\n }\n this.util.style(this.overviewRegion, {\n left: this.overviewPosition + 'px'\n });\n if (this.draggingOverview) {\n this.wavesurfer.drawer.wrapper.scrollLeft =\n this.overviewPosition * this.ratio;\n }\n }\n\n getWidth() {\n return this.drawer.width / this.params.pixelRatio;\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/minimap/index.js\");\n",""],"names":["MinimapPlugin","params","ws","_this","_classCallCheck","Object","assign","showRegions","regionsPluginName","showOverview","overviewBorderColor","overviewBorderSize","container","height","Math","max","round","scrollParent","fillParent","el","document","querySelector","console","warn","concat","util","style","createElement","display","drawer","Drawer","wavesurfer","cleared","renderEvent","overviewRegion","regionsPlugin","createWrapper","createElements","isInitialised","_onShouldRender","bindWavesurferEvents","bindMinimapEvents","body","contains","insertBefore","drawRegions","render","_onAudioprocess","currentTime","progress","backend","getPlayedPercents","_onSeek","_onScroll","e","draggingOverview","orientedTarget","withOrientation","target","vertical","moveOverviewRegion","scrollLeft","ratio","_onMouseover","prevWidth","_onResize","debounce","wrapper","clientWidth","_onLoading","percent","len","getWidth","drawPeaks","_onZoom","on","_createClass","key","value","init","isReady","destroy","window","removeEventListener","un","unAll","_this2","regions","region","id","renderRegions","_this3","regionElements","querySelectorAll","i","length","removeChild","keys","forEach","width","end","start","getDuration","left","regionElement","backgroundColor","color","position","classList","add","appendChild","top","bottom","cursor","border","zIndex","opacity","overviewOpacity","addEventListener","_this4","positionMouseDown","clientX","clientY","relativePositionX","seek","interact","event","fireEvent","handleEvent","seekAndCenter","domElement","layerX","getBoundingClientRect","peaks","getPeaks","waveShowedWidth","waveWidth","overviewWidth","offsetWidth","overviewPosition","pixels","pixelRatio","create","name","deferInit","staticProps","instance","exports","default","module"],"sourceRoot":""}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* wavesurfer.js minimap plugin 6.5.1 (2023-03-12)
|
|
3
|
-
* https://wavesurfer-js.org
|
|
4
|
-
* @license BSD-3-Clause
|
|
5
|
-
*/
|
|
6
|
-
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("WaveSurfer",[],r):"object"==typeof exports?exports.WaveSurfer=r():(e.WaveSurfer=e.WaveSurfer||{},e.WaveSurfer.minimap=r())}(self,(()=>(()=>{"use strict";var e={521:(e,r)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function t(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,s=void 0,s=function(e,r){if("object"!==i(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!==i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(o,"string"),"symbol"===i(s)?s:String(s)),n)}var o,s}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=function(){function e(r,i){var t=this;if(function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),this.params=Object.assign({},i.params,{showRegions:!1,regionsPluginName:r.regionsPluginName||"regions",showOverview:!1,overviewBorderColor:"green",overviewBorderSize:2,container:!1,height:Math.max(Math.round(i.params.height/4),20)},r,{scrollParent:!1,fillParent:!0}),"string"==typeof r.container){var n=document.querySelector(r.container);n||console.warn("Wavesurfer minimap container ".concat(r.container," was not found! The minimap will be automatically appended below the waveform.")),this.params.container=n}r.container||(this.params.container=i.util.style(document.createElement("minimap"),{display:"block"})),this.drawer=new i.Drawer(this.params.container,this.params),this.wavesurfer=i,this.util=i.util,this.cleared=!1,this.renderEvent="redraw",this.overviewRegion=null,this.regionsPlugin=this.wavesurfer[this.params.regionsPluginName],this.drawer.createWrapper(),this.createElements();var o=!1;this._onShouldRender=function(){o||(t.bindWavesurferEvents(),t.bindMinimapEvents(),o=!0),document.body.contains(t.params.container)||i.container.insertBefore(t.params.container,null),t.regionsPlugin&&t.params.showRegions&&t.drawRegions(),t.render()},this._onAudioprocess=function(e){t.drawer.progress(t.wavesurfer.backend.getPlayedPercents())},this._onSeek=function(){return t.drawer.progress(i.backend.getPlayedPercents())},this._onScroll=function(e){if(!t.draggingOverview){var r=t.util.withOrientation(e.target,t.wavesurfer.params.vertical);t.moveOverviewRegion(r.scrollLeft/t.ratio)}},this._onMouseover=function(e){t.draggingOverview&&(t.draggingOverview=!1)};var s=0;this._onResize=i.util.debounce((function(){s!=t.drawer.wrapper.clientWidth&&(s=t.drawer.wrapper.clientWidth,t.render(),t.drawer.progress(t.wavesurfer.backend.getPlayedPercents()))})),this._onLoading=function(e){if(e>=100)t.cleared=!1;else if(!0!==t.cleared){var r=t.drawer.getWidth();t.drawer.drawPeaks([0],r,0,r),t.cleared=!0}},this._onZoom=function(e){t.render()},this.wavesurfer.on("zoom",this._onZoom)}var r,i,n;return r=e,n=[{key:"create",value:function(r){return{name:"minimap",deferInit:!(!r||!r.deferInit)&&r.deferInit,params:r,staticProps:{},instance:e}}}],(i=[{key:"init",value:function(){this.wavesurfer.isReady&&this._onShouldRender(),this.wavesurfer.on(this.renderEvent,this._onShouldRender)}},{key:"destroy",value:function(){window.removeEventListener("resize",this._onResize,!0),window.removeEventListener("orientationchange",this._onResize,!0),this.wavesurfer.drawer.wrapper.removeEventListener("mouseover",this._onMouseover),this.wavesurfer.un(this.renderEvent,this._onShouldRender),this.wavesurfer.un("seek",this._onSeek),this.wavesurfer.un("scroll",this._onScroll),this.wavesurfer.un("audioprocess",this._onAudioprocess),this.wavesurfer.un("zoom",this._onZoom),this.wavesurfer.un("loading",this._onLoading),this.drawer.destroy(),this.overviewRegion=null,this.unAll()}},{key:"drawRegions",value:function(){var e=this;this.regions={},this.wavesurfer.on("region-created",(function(r){e.regions[r.id]=r,e.drawer.wrapper&&e.renderRegions()})),this.wavesurfer.on("region-updated",(function(r){e.regions[r.id]=r,e.drawer.wrapper&&e.renderRegions()})),this.wavesurfer.on("region-removed",(function(r){delete e.regions[r.id],e.drawer.wrapper&&e.renderRegions()}))}},{key:"renderRegions",value:function(){var e,r=this,i=this.drawer.wrapper.querySelectorAll("region");for(e=0;e<i.length;++e)this.drawer.wrapper.removeChild(i[e]);Object.keys(this.regions).forEach((function(e){var i=r.regions[e],t=r.getWidth()*((i.end-i.start)/r.wavesurfer.getDuration()),n=r.getWidth()*(i.start/r.wavesurfer.getDuration()),o=r.util.style(document.createElement("region"),{height:"inherit",backgroundColor:i.color,width:t+"px",left:n+"px",display:"block",position:"absolute"});o.classList.add(e),r.drawer.wrapper.appendChild(o)}))}},{key:"createElements",value:function(){this.drawer.createElements(),this.params.showOverview&&(this.overviewRegion=this.util.withOrientation(this.drawer.wrapper.appendChild(document.createElement("overview")),this.wavesurfer.params.vertical),this.util.style(this.overviewRegion,{top:0,bottom:0,width:"0px",display:"block",position:"absolute",cursor:"move",border:this.params.overviewBorderSize+"px solid "+this.params.overviewBorderColor,zIndex:2,opacity:this.params.overviewOpacity}))}},{key:"bindWavesurferEvents",value:function(){window.addEventListener("resize",this._onResize,!0),window.addEventListener("orientationchange",this._onResize,!0),this.wavesurfer.on("audioprocess",this._onAudioprocess),this.wavesurfer.on("seek",this._onSeek),this.wavesurfer.on("loading",this._onLoading),this.params.showOverview&&(this.wavesurfer.on("scroll",this._onScroll),this.wavesurfer.drawer.wrapper.addEventListener("mouseover",this._onMouseover))}},{key:"bindMinimapEvents",value:function(){var e=this,r={clientX:0,clientY:0},i=0,t=!0;this.params.interact&&(this.drawer.wrapper.addEventListener("click",(function(r){e.fireEvent("click",r,e.drawer.handleEvent(r))})),this.on("click",(function(r,i){t?(e.drawer.progress(i),e.wavesurfer.seekAndCenter(i)):t=!0}))),this.params.showOverview&&(this.overviewRegion.domElement.addEventListener("mousedown",(function(t){var n=e.util.withOrientation(t,e.wavesurfer.params.vertical);e.draggingOverview=!0,i=n.layerX,r.clientX=n.clientX,r.clientY=n.clientY})),this.drawer.wrapper.addEventListener("mousemove",(function(r){if(e.draggingOverview){var t=e.util.withOrientation(r,e.wavesurfer.params.vertical);e.moveOverviewRegion(t.clientX-e.drawer.container.getBoundingClientRect().left-i)}})),this.drawer.wrapper.addEventListener("mouseup",(function(i){var n=e.util.withOrientation(i,e.wavesurfer.params.vertical);r.clientX-n.clientX==0&&r.clientX-n.clientX==0?(t=!0,e.draggingOverview=!1):e.draggingOverview&&(t=!1,e.draggingOverview=!1)})))}},{key:"render",value:function(){var e=this.drawer.getWidth(),r=this.wavesurfer.backend.getPeaks(e,0,e);this.drawer.drawPeaks(r,e,0,e),this.drawer.progress(this.wavesurfer.backend.getPlayedPercents()),this.params.showOverview&&(this.ratio=this.wavesurfer.drawer.width/this.drawer.width,this.waveShowedWidth=this.wavesurfer.drawer.width/this.ratio,this.waveWidth=this.wavesurfer.drawer.width,this.overviewWidth=this.drawer.container.offsetWidth/this.ratio,this.overviewPosition=0,this.moveOverviewRegion(this.wavesurfer.drawer.wrapper.scrollLeft/this.ratio),this.util.style(this.overviewRegion,{width:this.overviewWidth+"px"}))}},{key:"moveOverviewRegion",value:function(e){e<0?this.overviewPosition=0:e+this.overviewWidth<this.drawer.container.offsetWidth?this.overviewPosition=e:this.overviewPosition=this.drawer.container.offsetWidth-this.overviewWidth,this.util.style(this.overviewRegion,{left:this.overviewPosition+"px"}),this.draggingOverview&&(this.wavesurfer.drawer.wrapper.scrollLeft=this.overviewPosition*this.ratio)}},{key:"getWidth",value:function(){return this.drawer.width/this.params.pixelRatio}}])&&t(r.prototype,i),n&&t(r,n),Object.defineProperty(r,"prototype",{writable:!1}),e}();r.default=n,e.exports=r.default}},r={};var i=function i(t){var n=r[t];if(void 0!==n)return n.exports;var o=r[t]={exports:{}};return e[t](o,o.exports,i),o.exports}(521);return i})()));
|
|
7
|
-
//# sourceMappingURL=wavesurfer.minimap.min.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wavesurfer.minimap.min.js","mappings":";;;;;CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,aAAc,GAAIH,GACC,iBAAZC,QACdA,QAAoB,WAAID,KAExBD,EAAiB,WAAIA,EAAiB,YAAK,CAAC,EAAGA,EAAiB,WAAW,QAAIC,IAChF,CATD,CASGK,MAAM,IACT,M,+yBCCA,IAyBqBC,EAAa,WAoB9B,SAAAA,EAAYC,EAAQC,GAAI,IAAAC,EAAA,KAqBpB,G,4FArBoBC,CAAA,KAAAJ,GACpBK,KAAKJ,OAASK,OAAOC,OACjB,CAAC,EACDL,EAAGD,OACH,CACIO,aAAa,EACbC,kBAAmBR,EAAOQ,mBAAqB,UAC/CC,cAAc,EACdC,oBAAqB,QACrBC,mBAAoB,EAEpBC,WAAW,EACXC,OAAQC,KAAKC,IAAID,KAAKE,MAAMf,EAAGD,OAAOa,OAAS,GAAI,KAEvDb,EACA,CACIiB,cAAc,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AAA,EAAAsJ,O,GCrDDC,EAA2B,CAAC,ECEhC,IAAIC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAa3J,QAGrB,IAAIC,EAASsJ,EAAyBG,GAAY,CAGjD1J,QAAS,CAAC,GAOX,OAHA6J,EAAoBH,GAAUzJ,EAAQA,EAAOD,QAASyJ,GAG/CxJ,EAAOD,OACf,CCnB0ByJ,CAAoB,K,UHO9C","sources":["webpack://WaveSurfer/webpack/universalModuleDefinition","webpack://WaveSurfer/./src/plugin/minimap/index.js","webpack://WaveSurfer/webpack/bootstrap","webpack://WaveSurfer/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"minimap\"] = factory();\n})(self, () => {\nreturn ","/*eslint no-console: [\"error\", { allow: [\"warn\"] }] */\n/**\n * @typedef {Object} MinimapPluginParams\n * @desc Extends the `WavesurferParams` wavesurfer was initialised with\n * @property {?string|HTMLElement} container CSS selector or HTML element where\n * the map should be rendered. By default it is simply appended\n * after the waveform.\n * @property {?boolean} deferInit Set to true to manually call\n * `initPlugin('minimap')`\n */\n\n/**\n * Renders a smaller version waveform as a minimap of the main waveform.\n *\n * @implements {PluginClass}\n * @extends {Observer}\n * @example\n * // es6\n * import MinimapPlugin from 'wavesurfer.minimap.js';\n *\n * // commonjs\n * var MinimapPlugin = require('wavesurfer.minimap.js');\n *\n * // if you are using <script> tags\n * var MinimapPlugin = window.WaveSurfer.minimap;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * MinimapPlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\nexport default class MinimapPlugin {\n /**\n * Minimap 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 {MinimapPluginParams} params parameters use to initialise the plugin\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'minimap',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n staticProps: {},\n instance: MinimapPlugin\n };\n }\n\n constructor(params, ws) {\n this.params = Object.assign(\n {},\n ws.params,\n {\n showRegions: false,\n regionsPluginName: params.regionsPluginName || 'regions',\n showOverview: false,\n overviewBorderColor: 'green',\n overviewBorderSize: 2,\n // the container should be different\n container: false,\n height: Math.max(Math.round(ws.params.height / 4), 20)\n },\n params,\n {\n scrollParent: false,\n fillParent: true\n }\n );\n // if container is a selector, get the element\n if (typeof params.container === 'string') {\n const el = document.querySelector(params.container);\n if (!el) {\n console.warn(\n `Wavesurfer minimap container ${params.container} was not found! The minimap will be automatically appended below the waveform.`\n );\n }\n this.params.container = el;\n }\n // if no container is specified add a new element and insert it\n if (!params.container) {\n this.params.container = ws.util.style(\n document.createElement('minimap'),\n {\n display: 'block'\n }\n );\n }\n this.drawer = new ws.Drawer(this.params.container, this.params);\n this.wavesurfer = ws;\n this.util = ws.util;\n this.cleared = false;\n this.renderEvent = 'redraw';\n this.overviewRegion = null;\n this.regionsPlugin = this.wavesurfer[this.params.regionsPluginName];\n\n this.drawer.createWrapper();\n this.createElements();\n let isInitialised = false;\n\n // ws ready event listener\n this._onShouldRender = () => {\n // only bind the events in the first run\n if (!isInitialised) {\n this.bindWavesurferEvents();\n this.bindMinimapEvents();\n isInitialised = true;\n }\n // if there is no such element, append it to the container (below\n // the waveform)\n if (!document.body.contains(this.params.container)) {\n ws.container.insertBefore(this.params.container, null);\n }\n\n if (this.regionsPlugin && this.params.showRegions) {\n this.drawRegions();\n }\n this.render();\n };\n\n this._onAudioprocess = currentTime => {\n this.drawer.progress(this.wavesurfer.backend.getPlayedPercents());\n };\n\n // ws seek event listener\n this._onSeek = () =>\n this.drawer.progress(ws.backend.getPlayedPercents());\n\n // event listeners for the overview region\n this._onScroll = e => {\n if (!this.draggingOverview) {\n const orientedTarget = this.util.withOrientation(e.target, this.wavesurfer.params.vertical);\n this.moveOverviewRegion(orientedTarget.scrollLeft / this.ratio);\n }\n };\n this._onMouseover = e => {\n if (this.draggingOverview) {\n this.draggingOverview = false;\n }\n };\n let prevWidth = 0;\n this._onResize = ws.util.debounce(() => {\n if (prevWidth != this.drawer.wrapper.clientWidth) {\n prevWidth = this.drawer.wrapper.clientWidth;\n this.render();\n this.drawer.progress(\n this.wavesurfer.backend.getPlayedPercents()\n );\n }\n });\n this._onLoading = percent => {\n if (percent >= 100) {\n this.cleared = false;\n return;\n }\n if (this.cleared === true) {\n return;\n }\n const len = this.drawer.getWidth();\n this.drawer.drawPeaks([0], len, 0, len);\n this.cleared = true;\n };\n this._onZoom = e => {\n this.render();\n };\n this.wavesurfer.on('zoom', this._onZoom);\n }\n\n init() {\n if (this.wavesurfer.isReady) {\n this._onShouldRender();\n }\n this.wavesurfer.on(this.renderEvent, this._onShouldRender);\n }\n\n destroy() {\n window.removeEventListener('resize', this._onResize, true);\n window.removeEventListener('orientationchange', this._onResize, true);\n this.wavesurfer.drawer.wrapper.removeEventListener(\n 'mouseover',\n this._onMouseover\n );\n this.wavesurfer.un(this.renderEvent, this._onShouldRender);\n this.wavesurfer.un('seek', this._onSeek);\n this.wavesurfer.un('scroll', this._onScroll);\n this.wavesurfer.un('audioprocess', this._onAudioprocess);\n this.wavesurfer.un('zoom', this._onZoom);\n this.wavesurfer.un('loading', this._onLoading);\n this.drawer.destroy();\n this.overviewRegion = null;\n this.unAll();\n }\n\n drawRegions() {\n this.regions = {};\n\n this.wavesurfer.on('region-created', region => {\n this.regions[region.id] = region;\n this.drawer.wrapper && this.renderRegions();\n });\n\n this.wavesurfer.on('region-updated', region => {\n this.regions[region.id] = region;\n this.drawer.wrapper && this.renderRegions();\n });\n\n this.wavesurfer.on('region-removed', region => {\n delete this.regions[region.id];\n this.drawer.wrapper && this.renderRegions();\n });\n }\n\n renderRegions() {\n const regionElements = this.drawer.wrapper.querySelectorAll('region');\n let i;\n for (i = 0; i < regionElements.length; ++i) {\n this.drawer.wrapper.removeChild(regionElements[i]);\n }\n\n Object.keys(this.regions).forEach(id => {\n const region = this.regions[id];\n const width =\n this.getWidth() *\n ((region.end - region.start) / this.wavesurfer.getDuration());\n const left =\n this.getWidth() *\n (region.start / this.wavesurfer.getDuration());\n const regionElement = this.util.style(\n document.createElement('region'),\n {\n height: 'inherit',\n backgroundColor: region.color,\n width: width + 'px',\n left: left + 'px',\n display: 'block',\n position: 'absolute'\n }\n );\n regionElement.classList.add(id);\n this.drawer.wrapper.appendChild(regionElement);\n });\n }\n\n createElements() {\n this.drawer.createElements();\n if (this.params.showOverview) {\n this.overviewRegion = this.util.withOrientation(\n this.drawer.wrapper.appendChild(document.createElement('overview')),\n this.wavesurfer.params.vertical\n );\n\n this.util.style(\n this.overviewRegion,\n {\n top: 0,\n bottom: 0,\n width: '0px',\n display: 'block',\n position: 'absolute',\n cursor: 'move',\n border:\n this.params.overviewBorderSize +\n 'px solid ' +\n this.params.overviewBorderColor,\n zIndex: 2,\n opacity: this.params.overviewOpacity\n }\n );\n }\n }\n\n bindWavesurferEvents() {\n window.addEventListener('resize', this._onResize, true);\n window.addEventListener('orientationchange', this._onResize, true);\n this.wavesurfer.on('audioprocess', this._onAudioprocess);\n this.wavesurfer.on('seek', this._onSeek);\n this.wavesurfer.on('loading', this._onLoading);\n if (this.params.showOverview) {\n this.wavesurfer.on('scroll', this._onScroll);\n this.wavesurfer.drawer.wrapper.addEventListener(\n 'mouseover',\n this._onMouseover\n );\n }\n }\n\n bindMinimapEvents() {\n const positionMouseDown = {\n clientX: 0,\n clientY: 0\n };\n let relativePositionX = 0;\n let seek = true;\n\n // the following event listeners will be destroyed by using\n // this.unAll() and nullifying the DOM node references after\n // removing them\n if (this.params.interact) {\n this.drawer.wrapper.addEventListener('click', event => {\n this.fireEvent('click', event, this.drawer.handleEvent(event));\n });\n\n this.on('click', (event, position) => {\n if (seek) {\n this.drawer.progress(position);\n this.wavesurfer.seekAndCenter(position);\n } else {\n seek = true;\n }\n });\n }\n\n if (this.params.showOverview) {\n this.overviewRegion.domElement.addEventListener('mousedown', e => {\n const event = this.util.withOrientation(e, this.wavesurfer.params.vertical);\n this.draggingOverview = true;\n relativePositionX = event.layerX;\n positionMouseDown.clientX = event.clientX;\n positionMouseDown.clientY = event.clientY;\n });\n\n this.drawer.wrapper.addEventListener('mousemove', e => {\n if (this.draggingOverview) {\n const event = this.util.withOrientation(e, this.wavesurfer.params.vertical);\n this.moveOverviewRegion(\n event.clientX -\n this.drawer.container.getBoundingClientRect().left -\n relativePositionX\n );\n }\n });\n\n this.drawer.wrapper.addEventListener('mouseup', e => {\n const event = this.util.withOrientation(e, this.wavesurfer.params.vertical);\n if (\n positionMouseDown.clientX - event.clientX === 0 &&\n positionMouseDown.clientX - event.clientX === 0\n ) {\n seek = true;\n this.draggingOverview = false;\n } else if (this.draggingOverview) {\n seek = false;\n this.draggingOverview = false;\n }\n });\n }\n }\n\n render() {\n const len = this.drawer.getWidth();\n const peaks = this.wavesurfer.backend.getPeaks(len, 0, len);\n this.drawer.drawPeaks(peaks, len, 0, len);\n this.drawer.progress(this.wavesurfer.backend.getPlayedPercents());\n\n if (this.params.showOverview) {\n //get proportional width of overview region considering the respective\n //width of the drawers\n this.ratio = this.wavesurfer.drawer.width / this.drawer.width;\n this.waveShowedWidth = this.wavesurfer.drawer.width / this.ratio;\n this.waveWidth = this.wavesurfer.drawer.width;\n this.overviewWidth = this.drawer.container.offsetWidth / this.ratio;\n this.overviewPosition = 0;\n this.moveOverviewRegion(\n this.wavesurfer.drawer.wrapper.scrollLeft / this.ratio\n );\n this.util.style(this.overviewRegion, {\n width: this.overviewWidth + 'px'\n });\n }\n }\n\n moveOverviewRegion(pixels) {\n if (pixels < 0) {\n this.overviewPosition = 0;\n } else if (\n pixels + this.overviewWidth <\n this.drawer.container.offsetWidth\n ) {\n this.overviewPosition = pixels;\n } else {\n this.overviewPosition =\n this.drawer.container.offsetWidth - this.overviewWidth;\n }\n this.util.style(this.overviewRegion, {\n left: this.overviewPosition + 'px'\n });\n if (this.draggingOverview) {\n this.wavesurfer.drawer.wrapper.scrollLeft =\n this.overviewPosition * this.ratio;\n }\n }\n\n getWidth() {\n return this.drawer.width / this.params.pixelRatio;\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__(521);\n"],"names":["root","factory","exports","module","define","amd","self","MinimapPlugin","params","ws","_this","_classCallCheck","this","Object","assign","showRegions","regionsPluginName","showOverview","overviewBorderColor","overviewBorderSize","container","height","Math","max","round","scrollParent","fillParent","el","document","querySelector","console","warn","concat","util","style","createElement","display","drawer","Drawer","wavesurfer","cleared","renderEvent","overviewRegion","regionsPlugin","createWrapper","createElements","isInitialised","_onShouldRender","bindWavesurferEvents","bindMinimapEvents","body","contains","insertBefore","drawRegions","render","_onAudioprocess","currentTime","progress","backend","getPlayedPercents","_onSeek","_onScroll","e","draggingOverview","orientedTarget","withOrientation","target","vertical","moveOverviewRegion","scrollLeft","ratio","_onMouseover","prevWidth","_onResize","debounce","wrapper","clientWidth","_onLoading","percent","len","getWidth","drawPeaks","_onZoom","on","key","value","name","deferInit","staticProps","instance","isReady","window","removeEventListener","un","destroy","unAll","_this2","regions","region","id","renderRegions","i","_this3","regionElements","querySelectorAll","length","removeChild","keys","forEach","width","end","start","getDuration","left","regionElement","backgroundColor","color","position","classList","add","appendChild","top","bottom","cursor","border","zIndex","opacity","overviewOpacity","addEventListener","_this4","positionMouseDown","clientX","clientY","relativePositionX","seek","interact","event","fireEvent","handleEvent","seekAndCenter","domElement","layerX","getBoundingClientRect","peaks","getPeaks","waveShowedWidth","waveWidth","overviewWidth","offsetWidth","overviewPosition","pixels","pixelRatio","default","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
|