@micromag/element-audio 0.3.311 → 0.3.322
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/assets/css/styles.css +2 -2
- package/es/index.js +101 -138
- package/lib/index.js +101 -138
- package/package.json +8 -8
package/assets/css/styles.css
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
.micromag-element-audio-audio-bars-container .micromag-element-audio-audio-bars-seekButton{
|
|
1
|
+
.micromag-element-audio-audio-bars-container .micromag-element-audio-audio-bars-seekButton{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:0;color:inherit;cursor:pointer;display:inline-block;font-family:inherit;height:100%;left:0;padding:0;position:relative;top:0;width:100%}.micromag-element-audio-audio-bars-container{height:100%;position:relative;width:100%}.micromag-element-audio-audio-bars-container .micromag-element-audio-audio-bars-seekButton{position:absolute;-ms-touch-action:none;touch-action:none}
|
|
2
2
|
.micromag-element-audio-container .micromag-element-audio-wave{height:150px}
|
|
3
|
-
.micromag-element-audio-audio-wave-container .micromag-element-audio-audio-wave-button{
|
|
3
|
+
.micromag-element-audio-audio-wave-container .micromag-element-audio-audio-wave-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:0;color:inherit;cursor:pointer;display:inline-block;font-family:inherit;padding:0;position:relative}.micromag-element-audio-audio-wave-container .micromag-element-audio-audio-wave-button,.micromag-element-audio-audio-wave-container .micromag-element-audio-audio-wave-canvasBackground,.micromag-element-audio-audio-wave-container .micromag-element-audio-audio-wave-canvasProgress{height:100%;left:0;position:absolute;top:0;width:100%}.micromag-element-audio-audio-wave-container{height:100px;position:relative;-ms-touch-action:pan-y;touch-action:pan-y}
|
package/es/index.js
CHANGED
|
@@ -35,32 +35,27 @@ var defaultProps$2 = {
|
|
|
35
35
|
// onReady: null,
|
|
36
36
|
className: null
|
|
37
37
|
};
|
|
38
|
-
|
|
39
38
|
function AudioBars(_ref) {
|
|
40
39
|
var progress = _ref.progress,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
playing = _ref.playing,
|
|
41
|
+
duration = _ref.duration,
|
|
42
|
+
seek = _ref.seek,
|
|
43
|
+
play = _ref.play,
|
|
44
|
+
className = _ref.className;
|
|
46
45
|
var intl = useIntl();
|
|
47
|
-
|
|
48
46
|
var _useDimensionObserver = useDimensionObserver(),
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
elRef = _useDimensionObserver.ref,
|
|
48
|
+
_useDimensionObserver2 = _useDimensionObserver.width,
|
|
49
|
+
elWidth = _useDimensionObserver2 === void 0 ? null : _useDimensionObserver2,
|
|
50
|
+
elHeight = _useDimensionObserver.height;
|
|
54
51
|
var barWidth = 1;
|
|
55
52
|
var barGap = 1;
|
|
56
53
|
var barSize = barWidth + barGap;
|
|
57
54
|
var current = progress * elWidth;
|
|
58
|
-
|
|
59
55
|
var _useState = useState(null),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
57
|
+
currentSeek = _useState2[0],
|
|
58
|
+
setCurrentSeek = _useState2[1];
|
|
64
59
|
var items = useMemo(function () {
|
|
65
60
|
var count = Math.floor(elWidth / barSize);
|
|
66
61
|
return _toConsumableArray(Array(count).keys()).map(function () {
|
|
@@ -69,30 +64,24 @@ function AudioBars(_ref) {
|
|
|
69
64
|
}, [elWidth, barSize]);
|
|
70
65
|
var seekFromX = useCallback(function () {
|
|
71
66
|
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
72
|
-
|
|
73
67
|
if (x === null) {
|
|
74
68
|
return;
|
|
75
69
|
}
|
|
76
|
-
|
|
77
70
|
var _elRef$current$getBou = elRef.current.getBoundingClientRect(),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
71
|
+
elX = _elRef$current$getBou.left,
|
|
72
|
+
width = _elRef$current$getBou.width;
|
|
81
73
|
var distance = Math.max(0, Math.min(1, (x - elX) / width));
|
|
82
|
-
|
|
83
74
|
if (seek !== null && duration !== null) {
|
|
84
75
|
seek(parseFloat(distance * duration, 10));
|
|
85
76
|
}
|
|
86
|
-
|
|
87
77
|
if (!playing && play != null) {
|
|
88
78
|
play();
|
|
89
79
|
}
|
|
90
80
|
}, [elRef.current, elWidth, duration, playing, seek, play]);
|
|
91
81
|
var seekTemporary = useCallback(function (x) {
|
|
92
82
|
var _elRef$current$getBou2 = elRef.current.getBoundingClientRect(),
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
83
|
+
elX = _elRef$current$getBou2.left,
|
|
84
|
+
width = _elRef$current$getBou2.width;
|
|
96
85
|
var distance = Math.max(0, Math.min(1, (x - elX) / width));
|
|
97
86
|
setCurrentSeek(distance * elWidth);
|
|
98
87
|
}, [elRef.current, elWidth, setCurrentSeek]);
|
|
@@ -105,32 +94,27 @@ function AudioBars(_ref) {
|
|
|
105
94
|
var bind = useGesture({
|
|
106
95
|
onDrag: function onDrag(_ref2) {
|
|
107
96
|
var _ref2$xy = _slicedToArray(_ref2.xy, 1),
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
97
|
+
x = _ref2$xy[0],
|
|
98
|
+
elapsedTime = _ref2.elapsedTime,
|
|
99
|
+
active = _ref2.active;
|
|
112
100
|
if (!active && elapsedTime > 300) {
|
|
113
101
|
return;
|
|
114
102
|
}
|
|
115
|
-
|
|
116
103
|
seekTemporary(x);
|
|
117
104
|
},
|
|
118
105
|
onDragStart: function onDragStart(_ref3) {
|
|
119
106
|
var _ref3$xy = _slicedToArray(_ref3.xy, 1),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
107
|
+
x = _ref3$xy[0],
|
|
108
|
+
elapsedTime = _ref3.elapsedTime,
|
|
109
|
+
active = _ref3.active;
|
|
124
110
|
if (!active && elapsedTime > 300) {
|
|
125
111
|
return;
|
|
126
112
|
}
|
|
127
|
-
|
|
128
113
|
seekTemporary(x);
|
|
129
114
|
},
|
|
130
115
|
onDragEnd: function onDragEnd(_ref4) {
|
|
131
116
|
var _ref4$xy = _slicedToArray(_ref4.xy, 1),
|
|
132
|
-
|
|
133
|
-
|
|
117
|
+
x = _ref4$xy[0];
|
|
134
118
|
seekFromX(x);
|
|
135
119
|
setTimeout(function () {
|
|
136
120
|
setCurrentSeek(null);
|
|
@@ -189,7 +173,6 @@ function AudioBars(_ref) {
|
|
|
189
173
|
})
|
|
190
174
|
})));
|
|
191
175
|
}
|
|
192
|
-
|
|
193
176
|
AudioBars.propTypes = propTypes$2;
|
|
194
177
|
AudioBars.defaultProps = defaultProps$2;
|
|
195
178
|
|
|
@@ -249,35 +232,31 @@ var defaultProps$1 = {
|
|
|
249
232
|
onDurationChange: null,
|
|
250
233
|
onVolumeChange: null
|
|
251
234
|
};
|
|
252
|
-
|
|
253
235
|
var Audio = function Audio(_ref) {
|
|
254
236
|
var media = _ref.media,
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
237
|
+
mediaRef = _ref.mediaRef,
|
|
238
|
+
muted = _ref.muted,
|
|
239
|
+
autoPlay = _ref.autoPlay,
|
|
240
|
+
paused = _ref.paused,
|
|
241
|
+
loop = _ref.loop,
|
|
242
|
+
preload = _ref.preload,
|
|
243
|
+
shouldLoad = _ref.shouldLoad,
|
|
244
|
+
waveFake = _ref.waveFake,
|
|
245
|
+
withWave = _ref.withWave,
|
|
246
|
+
className = _ref.className,
|
|
247
|
+
onReady = _ref.onReady,
|
|
248
|
+
onPlay = _ref.onPlay,
|
|
249
|
+
onPause = _ref.onPause,
|
|
250
|
+
onEnded = _ref.onEnded,
|
|
251
|
+
onSeeked = _ref.onSeeked,
|
|
252
|
+
onTimeUpdate = _ref.onTimeUpdate,
|
|
253
|
+
onProgressStep = _ref.onProgressStep,
|
|
254
|
+
customOnDurationChange = _ref.onDurationChange,
|
|
255
|
+
customOnVolumeChange = _ref.onVolumeChange;
|
|
275
256
|
var _ref2 = media || {},
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
257
|
+
_ref2$url = _ref2.url,
|
|
258
|
+
url = _ref2$url === void 0 ? null : _ref2$url;
|
|
279
259
|
var _ref4 = useRef(null);
|
|
280
|
-
|
|
281
260
|
var currentTime = useMediaCurrentTime(_ref4.current, {
|
|
282
261
|
id: url,
|
|
283
262
|
disabled: paused || !withWave && onProgressStep === null
|
|
@@ -287,7 +266,9 @@ var Audio = function Audio(_ref) {
|
|
|
287
266
|
});
|
|
288
267
|
var duration = useMediaDuration(_ref4.current, {
|
|
289
268
|
id: url
|
|
290
|
-
});
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
// const audioLevels = useMediaWaveform(media, {
|
|
291
272
|
// fake: waveFake,
|
|
292
273
|
// reduceBufferFactor,
|
|
293
274
|
// });
|
|
@@ -304,34 +285,28 @@ var Audio = function Audio(_ref) {
|
|
|
304
285
|
}, [duration, customOnDurationChange]);
|
|
305
286
|
var onVolumeChange = useCallback(function () {
|
|
306
287
|
var _ref$current = _ref4.current,
|
|
307
|
-
|
|
308
|
-
|
|
288
|
+
element = _ref$current === void 0 ? null : _ref$current;
|
|
309
289
|
if (element === null) {
|
|
310
290
|
return;
|
|
311
291
|
}
|
|
312
|
-
|
|
313
292
|
if (customOnVolumeChange !== null) {
|
|
314
293
|
customOnVolumeChange(element.volume);
|
|
315
294
|
}
|
|
316
295
|
}, [_ref4.current, customOnVolumeChange]);
|
|
317
296
|
var onWavePlay = useCallback(function () {
|
|
318
297
|
var _ref$current2 = _ref4.current,
|
|
319
|
-
|
|
320
|
-
|
|
298
|
+
element = _ref$current2 === void 0 ? null : _ref$current2;
|
|
321
299
|
if (element === null) {
|
|
322
300
|
return;
|
|
323
301
|
}
|
|
324
|
-
|
|
325
302
|
element.play();
|
|
326
303
|
}, [_ref4.current]);
|
|
327
304
|
var onWaveSeek = useCallback(function (newTime) {
|
|
328
305
|
var _ref$current3 = _ref4.current,
|
|
329
|
-
|
|
330
|
-
|
|
306
|
+
element = _ref$current3 === void 0 ? null : _ref$current3;
|
|
331
307
|
if (element === null) {
|
|
332
308
|
return;
|
|
333
309
|
}
|
|
334
|
-
|
|
335
310
|
if (isNumber(newTime)) {
|
|
336
311
|
element.currentTime = newTime;
|
|
337
312
|
}
|
|
@@ -343,14 +318,11 @@ var Audio = function Audio(_ref) {
|
|
|
343
318
|
}, [waveReady, onReady]);
|
|
344
319
|
useEffect(function () {
|
|
345
320
|
var _ref$current4 = _ref4.current,
|
|
346
|
-
|
|
347
|
-
|
|
321
|
+
element = _ref$current4 === void 0 ? null : _ref$current4;
|
|
348
322
|
if (element === null) {
|
|
349
323
|
return;
|
|
350
324
|
}
|
|
351
|
-
|
|
352
325
|
var isPaused = element.paused;
|
|
353
|
-
|
|
354
326
|
if (paused && !isPaused) {
|
|
355
327
|
element.pause();
|
|
356
328
|
} else if (!paused && isPaused) {
|
|
@@ -370,7 +342,6 @@ var Audio = function Audio(_ref) {
|
|
|
370
342
|
key: url,
|
|
371
343
|
ref: function ref(newRef) {
|
|
372
344
|
_ref4.current = newRef;
|
|
373
|
-
|
|
374
345
|
if (mediaRef !== null && isFunction(mediaRef)) {
|
|
375
346
|
mediaRef(newRef);
|
|
376
347
|
} else if (mediaRef !== null) {
|
|
@@ -391,7 +362,8 @@ var Audio = function Audio(_ref) {
|
|
|
391
362
|
onVolumeChange: onVolumeChange
|
|
392
363
|
}), withWave ? /*#__PURE__*/React.createElement(AudioBars, {
|
|
393
364
|
className: styles$1.wave,
|
|
394
|
-
progress: progress
|
|
365
|
+
progress: progress
|
|
366
|
+
// {...waveProps}
|
|
395
367
|
,
|
|
396
368
|
duration: duration,
|
|
397
369
|
playing: !paused,
|
|
@@ -399,7 +371,6 @@ var Audio = function Audio(_ref) {
|
|
|
399
371
|
play: onWavePlay
|
|
400
372
|
}) : null);
|
|
401
373
|
};
|
|
402
|
-
|
|
403
374
|
Audio.propTypes = propTypes$1;
|
|
404
375
|
Audio.defaultProps = defaultProps$1;
|
|
405
376
|
var Audio$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
@@ -440,58 +411,54 @@ var defaultProps = {
|
|
|
440
411
|
onResume: null,
|
|
441
412
|
onReady: null
|
|
442
413
|
};
|
|
443
|
-
|
|
444
414
|
function AudioWave(_ref) {
|
|
445
415
|
var currentTime = _ref.currentTime,
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
416
|
+
duration = _ref.duration,
|
|
417
|
+
playing = _ref.playing,
|
|
418
|
+
sampleWidth = _ref.sampleWidth,
|
|
419
|
+
sampleMargin = _ref.sampleMargin,
|
|
420
|
+
minSampleHeight = _ref.minSampleHeight,
|
|
421
|
+
backgroundColor = _ref.backgroundColor,
|
|
422
|
+
progressColor = _ref.progressColor,
|
|
423
|
+
audioLevels = _ref.audioLevels,
|
|
424
|
+
className = _ref.className,
|
|
425
|
+
onSeek = _ref.onSeek,
|
|
426
|
+
onResume = _ref.onResume,
|
|
427
|
+
onReady = _ref.onReady;
|
|
458
428
|
var canvasBackgroundRef = useRef(null);
|
|
459
429
|
var canvasProgressRef = useRef(null);
|
|
460
430
|
var mainColor = useMemo(function () {
|
|
461
431
|
var _ref2 = backgroundColor || {},
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
432
|
+
_ref2$color = _ref2.color,
|
|
433
|
+
color = _ref2$color === void 0 ? 'white' : _ref2$color;
|
|
465
434
|
return color;
|
|
466
435
|
}, [backgroundColor]);
|
|
467
436
|
var alternateColor = useMemo(function () {
|
|
468
437
|
return getContrastingColor(backgroundColor, progressColor);
|
|
469
438
|
}, [progressColor, backgroundColor]);
|
|
470
|
-
|
|
471
439
|
var _useDimensionObserver = useDimensionObserver(),
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
440
|
+
elRef = _useDimensionObserver.ref,
|
|
441
|
+
_useDimensionObserver2 = _useDimensionObserver.width,
|
|
442
|
+
elWidth = _useDimensionObserver2 === void 0 ? null : _useDimensionObserver2,
|
|
443
|
+
elHeight = _useDimensionObserver.height;
|
|
476
444
|
|
|
445
|
+
// Linear animation for progress bar
|
|
477
446
|
|
|
478
447
|
var _useSpring = useSpring(function () {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
448
|
+
return {
|
|
449
|
+
x: 0,
|
|
450
|
+
config: {
|
|
451
|
+
duration: 0
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
}),
|
|
455
|
+
_useSpring2 = _slicedToArray(_useSpring, 2),
|
|
456
|
+
springProps = _useSpring2[0],
|
|
457
|
+
setSpringProps = _useSpring2[1];
|
|
490
458
|
useEffect(function () {
|
|
491
459
|
if (currentTime === null || duration === null) {
|
|
492
460
|
return;
|
|
493
461
|
}
|
|
494
|
-
|
|
495
462
|
var progress = currentTime / duration;
|
|
496
463
|
setSpringProps.start({
|
|
497
464
|
reset: true,
|
|
@@ -506,32 +473,35 @@ function AudioWave(_ref) {
|
|
|
506
473
|
duration: (duration - currentTime) * 1000
|
|
507
474
|
}
|
|
508
475
|
});
|
|
509
|
-
}, [playing, duration, currentTime, setSpringProps]);
|
|
476
|
+
}, [playing, duration, currentTime, setSpringProps]);
|
|
477
|
+
|
|
478
|
+
// draw canvas
|
|
510
479
|
|
|
511
480
|
useEffect(function () {
|
|
512
481
|
if (audioLevels === null || audioLevels.length === 0 || elRef.current === null) {
|
|
513
482
|
return;
|
|
514
483
|
}
|
|
515
|
-
|
|
516
484
|
var sampleOuterWidth = sampleWidth + sampleMargin * 2;
|
|
517
|
-
var samplesCount = Math.floor(elWidth / sampleOuterWidth);
|
|
485
|
+
var samplesCount = Math.floor(elWidth / sampleOuterWidth);
|
|
486
|
+
|
|
487
|
+
// const amplitudes = [];
|
|
488
|
+
|
|
518
489
|
// get samples
|
|
519
490
|
|
|
520
491
|
var levelsBySamples = audioLevels.length / samplesCount;
|
|
521
|
-
|
|
522
492
|
var amplitudes = _toConsumableArray(Array(samplesCount).keys()).reduce(function (newAmplitudes, index) {
|
|
523
493
|
var levelStartIndex = index * levelsBySamples;
|
|
524
494
|
var levelEndIndex = levelStartIndex + levelsBySamples;
|
|
525
495
|
var newValues = [];
|
|
526
|
-
|
|
527
496
|
for (var i = Math.floor(levelStartIndex); i < Math.round(levelEndIndex); i += 1) {
|
|
528
497
|
newValues.push(audioLevels[i]);
|
|
529
498
|
}
|
|
530
|
-
|
|
531
499
|
return levelsBySamples >= 1 ? [].concat(_toConsumableArray(newAmplitudes), [newValues.reduce(function (total, value) {
|
|
532
500
|
return total + value;
|
|
533
501
|
}, 0) / newValues.length]) : [].concat(_toConsumableArray(newAmplitudes), newValues);
|
|
534
|
-
}, []);
|
|
502
|
+
}, []);
|
|
503
|
+
|
|
504
|
+
// for (let sampleI = 0; sampleI < samplesCount; sampleI += levelsBySamples) {
|
|
535
505
|
// // if (levelsBySamples >= 1) {
|
|
536
506
|
// // const sampleSize = Math.floor(levelsBySamples);
|
|
537
507
|
// // const sampleStart = sampleSize * sampleI;
|
|
@@ -549,15 +519,14 @@ function AudioWave(_ref) {
|
|
|
549
519
|
// // }
|
|
550
520
|
// // }
|
|
551
521
|
// }
|
|
552
|
-
|
|
553
|
-
|
|
554
522
|
var minAmplitude = Math.min.apply(Math, _toConsumableArray(amplitudes));
|
|
555
523
|
var maxAmplitude = Math.max.apply(Math, _toConsumableArray(amplitudes));
|
|
556
524
|
var delta = maxAmplitude - minAmplitude;
|
|
557
525
|
var normalizedAmplitudes = amplitudes.map(function (n) {
|
|
558
526
|
return (n - minAmplitude) / delta;
|
|
559
|
-
});
|
|
527
|
+
});
|
|
560
528
|
|
|
529
|
+
// draw samples
|
|
561
530
|
var canvasBg = canvasBackgroundRef.current;
|
|
562
531
|
var canvasProgress = canvasProgressRef.current;
|
|
563
532
|
var scale = typeof window !== 'undefined' ? window.devicePixelRatio : 1;
|
|
@@ -579,23 +548,20 @@ function AudioWave(_ref) {
|
|
|
579
548
|
ctxBG.fillRect(Math.round(sampleX), Math.round(sampleY), sampleWidth, Math.round(sampleHeight));
|
|
580
549
|
ctxProgress.fillRect(Math.round(sampleX), Math.round(sampleY), sampleWidth, Math.round(sampleHeight));
|
|
581
550
|
});
|
|
582
|
-
|
|
583
551
|
if (onReady !== null) {
|
|
584
552
|
onReady();
|
|
585
553
|
}
|
|
586
|
-
}, [audioLevels, sampleWidth, sampleMargin, minSampleHeight, elWidth, elHeight, mainColor, alternateColor, onReady]);
|
|
554
|
+
}, [audioLevels, sampleWidth, sampleMargin, minSampleHeight, elWidth, elHeight, mainColor, alternateColor, onReady]);
|
|
587
555
|
|
|
556
|
+
// User events
|
|
588
557
|
var seekFromX = useCallback(function (x) {
|
|
589
558
|
var _elRef$current$getBou = elRef.current.getBoundingClientRect(),
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
559
|
+
elX = _elRef$current$getBou.left,
|
|
560
|
+
width = _elRef$current$getBou.width;
|
|
593
561
|
var progress = Math.max(0, Math.min(1, (x - elX) / width));
|
|
594
|
-
|
|
595
562
|
if (onSeek !== null && duration !== null) {
|
|
596
563
|
onSeek(progress * duration);
|
|
597
564
|
}
|
|
598
|
-
|
|
599
565
|
if (!playing) {
|
|
600
566
|
onResume();
|
|
601
567
|
}
|
|
@@ -603,14 +569,12 @@ function AudioWave(_ref) {
|
|
|
603
569
|
var bind = useGesture({
|
|
604
570
|
onDrag: function onDrag(_ref3) {
|
|
605
571
|
var _ref3$xy = _slicedToArray(_ref3.xy, 1),
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
572
|
+
x = _ref3$xy[0],
|
|
573
|
+
elapsedTime = _ref3.elapsedTime,
|
|
574
|
+
active = _ref3.active;
|
|
610
575
|
if (!active && elapsedTime > 300) {
|
|
611
576
|
return;
|
|
612
577
|
}
|
|
613
|
-
|
|
614
578
|
seekFromX(x);
|
|
615
579
|
}
|
|
616
580
|
}, {
|
|
@@ -635,7 +599,6 @@ function AudioWave(_ref) {
|
|
|
635
599
|
}
|
|
636
600
|
}));
|
|
637
601
|
}
|
|
638
|
-
|
|
639
602
|
AudioWave.propTypes = propTypes;
|
|
640
603
|
AudioWave.defaultProps = defaultProps;
|
|
641
604
|
|
package/lib/index.js
CHANGED
|
@@ -50,32 +50,27 @@ var defaultProps$2 = {
|
|
|
50
50
|
// onReady: null,
|
|
51
51
|
className: null
|
|
52
52
|
};
|
|
53
|
-
|
|
54
53
|
function AudioBars(_ref) {
|
|
55
54
|
var progress = _ref.progress,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
playing = _ref.playing,
|
|
56
|
+
duration = _ref.duration,
|
|
57
|
+
seek = _ref.seek,
|
|
58
|
+
play = _ref.play,
|
|
59
|
+
className = _ref.className;
|
|
61
60
|
var intl = reactIntl.useIntl();
|
|
62
|
-
|
|
63
61
|
var _useDimensionObserver = hooks.useDimensionObserver(),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
elRef = _useDimensionObserver.ref,
|
|
63
|
+
_useDimensionObserver2 = _useDimensionObserver.width,
|
|
64
|
+
elWidth = _useDimensionObserver2 === void 0 ? null : _useDimensionObserver2,
|
|
65
|
+
elHeight = _useDimensionObserver.height;
|
|
69
66
|
var barWidth = 1;
|
|
70
67
|
var barGap = 1;
|
|
71
68
|
var barSize = barWidth + barGap;
|
|
72
69
|
var current = progress * elWidth;
|
|
73
|
-
|
|
74
70
|
var _useState = React.useState(null),
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
71
|
+
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
72
|
+
currentSeek = _useState2[0],
|
|
73
|
+
setCurrentSeek = _useState2[1];
|
|
79
74
|
var items = React.useMemo(function () {
|
|
80
75
|
var count = Math.floor(elWidth / barSize);
|
|
81
76
|
return _toConsumableArray__default["default"](Array(count).keys()).map(function () {
|
|
@@ -84,30 +79,24 @@ function AudioBars(_ref) {
|
|
|
84
79
|
}, [elWidth, barSize]);
|
|
85
80
|
var seekFromX = React.useCallback(function () {
|
|
86
81
|
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
87
|
-
|
|
88
82
|
if (x === null) {
|
|
89
83
|
return;
|
|
90
84
|
}
|
|
91
|
-
|
|
92
85
|
var _elRef$current$getBou = elRef.current.getBoundingClientRect(),
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
elX = _elRef$current$getBou.left,
|
|
87
|
+
width = _elRef$current$getBou.width;
|
|
96
88
|
var distance = Math.max(0, Math.min(1, (x - elX) / width));
|
|
97
|
-
|
|
98
89
|
if (seek !== null && duration !== null) {
|
|
99
90
|
seek(parseFloat(distance * duration, 10));
|
|
100
91
|
}
|
|
101
|
-
|
|
102
92
|
if (!playing && play != null) {
|
|
103
93
|
play();
|
|
104
94
|
}
|
|
105
95
|
}, [elRef.current, elWidth, duration, playing, seek, play]);
|
|
106
96
|
var seekTemporary = React.useCallback(function (x) {
|
|
107
97
|
var _elRef$current$getBou2 = elRef.current.getBoundingClientRect(),
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
98
|
+
elX = _elRef$current$getBou2.left,
|
|
99
|
+
width = _elRef$current$getBou2.width;
|
|
111
100
|
var distance = Math.max(0, Math.min(1, (x - elX) / width));
|
|
112
101
|
setCurrentSeek(distance * elWidth);
|
|
113
102
|
}, [elRef.current, elWidth, setCurrentSeek]);
|
|
@@ -120,32 +109,27 @@ function AudioBars(_ref) {
|
|
|
120
109
|
var bind = react.useGesture({
|
|
121
110
|
onDrag: function onDrag(_ref2) {
|
|
122
111
|
var _ref2$xy = _slicedToArray__default["default"](_ref2.xy, 1),
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
112
|
+
x = _ref2$xy[0],
|
|
113
|
+
elapsedTime = _ref2.elapsedTime,
|
|
114
|
+
active = _ref2.active;
|
|
127
115
|
if (!active && elapsedTime > 300) {
|
|
128
116
|
return;
|
|
129
117
|
}
|
|
130
|
-
|
|
131
118
|
seekTemporary(x);
|
|
132
119
|
},
|
|
133
120
|
onDragStart: function onDragStart(_ref3) {
|
|
134
121
|
var _ref3$xy = _slicedToArray__default["default"](_ref3.xy, 1),
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
122
|
+
x = _ref3$xy[0],
|
|
123
|
+
elapsedTime = _ref3.elapsedTime,
|
|
124
|
+
active = _ref3.active;
|
|
139
125
|
if (!active && elapsedTime > 300) {
|
|
140
126
|
return;
|
|
141
127
|
}
|
|
142
|
-
|
|
143
128
|
seekTemporary(x);
|
|
144
129
|
},
|
|
145
130
|
onDragEnd: function onDragEnd(_ref4) {
|
|
146
131
|
var _ref4$xy = _slicedToArray__default["default"](_ref4.xy, 1),
|
|
147
|
-
|
|
148
|
-
|
|
132
|
+
x = _ref4$xy[0];
|
|
149
133
|
seekFromX(x);
|
|
150
134
|
setTimeout(function () {
|
|
151
135
|
setCurrentSeek(null);
|
|
@@ -204,7 +188,6 @@ function AudioBars(_ref) {
|
|
|
204
188
|
})
|
|
205
189
|
})));
|
|
206
190
|
}
|
|
207
|
-
|
|
208
191
|
AudioBars.propTypes = propTypes$2;
|
|
209
192
|
AudioBars.defaultProps = defaultProps$2;
|
|
210
193
|
|
|
@@ -264,35 +247,31 @@ var defaultProps$1 = {
|
|
|
264
247
|
onDurationChange: null,
|
|
265
248
|
onVolumeChange: null
|
|
266
249
|
};
|
|
267
|
-
|
|
268
250
|
var Audio = function Audio(_ref) {
|
|
269
251
|
var media = _ref.media,
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
252
|
+
mediaRef = _ref.mediaRef,
|
|
253
|
+
muted = _ref.muted,
|
|
254
|
+
autoPlay = _ref.autoPlay,
|
|
255
|
+
paused = _ref.paused,
|
|
256
|
+
loop = _ref.loop,
|
|
257
|
+
preload = _ref.preload,
|
|
258
|
+
shouldLoad = _ref.shouldLoad,
|
|
259
|
+
waveFake = _ref.waveFake,
|
|
260
|
+
withWave = _ref.withWave,
|
|
261
|
+
className = _ref.className,
|
|
262
|
+
onReady = _ref.onReady,
|
|
263
|
+
onPlay = _ref.onPlay,
|
|
264
|
+
onPause = _ref.onPause,
|
|
265
|
+
onEnded = _ref.onEnded,
|
|
266
|
+
onSeeked = _ref.onSeeked,
|
|
267
|
+
onTimeUpdate = _ref.onTimeUpdate,
|
|
268
|
+
onProgressStep = _ref.onProgressStep,
|
|
269
|
+
customOnDurationChange = _ref.onDurationChange,
|
|
270
|
+
customOnVolumeChange = _ref.onVolumeChange;
|
|
290
271
|
var _ref2 = media || {},
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
272
|
+
_ref2$url = _ref2.url,
|
|
273
|
+
url = _ref2$url === void 0 ? null : _ref2$url;
|
|
294
274
|
var _ref4 = React.useRef(null);
|
|
295
|
-
|
|
296
275
|
var currentTime = hooks.useMediaCurrentTime(_ref4.current, {
|
|
297
276
|
id: url,
|
|
298
277
|
disabled: paused || !withWave && onProgressStep === null
|
|
@@ -302,7 +281,9 @@ var Audio = function Audio(_ref) {
|
|
|
302
281
|
});
|
|
303
282
|
var duration = hooks.useMediaDuration(_ref4.current, {
|
|
304
283
|
id: url
|
|
305
|
-
});
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
// const audioLevels = useMediaWaveform(media, {
|
|
306
287
|
// fake: waveFake,
|
|
307
288
|
// reduceBufferFactor,
|
|
308
289
|
// });
|
|
@@ -319,34 +300,28 @@ var Audio = function Audio(_ref) {
|
|
|
319
300
|
}, [duration, customOnDurationChange]);
|
|
320
301
|
var onVolumeChange = React.useCallback(function () {
|
|
321
302
|
var _ref$current = _ref4.current,
|
|
322
|
-
|
|
323
|
-
|
|
303
|
+
element = _ref$current === void 0 ? null : _ref$current;
|
|
324
304
|
if (element === null) {
|
|
325
305
|
return;
|
|
326
306
|
}
|
|
327
|
-
|
|
328
307
|
if (customOnVolumeChange !== null) {
|
|
329
308
|
customOnVolumeChange(element.volume);
|
|
330
309
|
}
|
|
331
310
|
}, [_ref4.current, customOnVolumeChange]);
|
|
332
311
|
var onWavePlay = React.useCallback(function () {
|
|
333
312
|
var _ref$current2 = _ref4.current,
|
|
334
|
-
|
|
335
|
-
|
|
313
|
+
element = _ref$current2 === void 0 ? null : _ref$current2;
|
|
336
314
|
if (element === null) {
|
|
337
315
|
return;
|
|
338
316
|
}
|
|
339
|
-
|
|
340
317
|
element.play();
|
|
341
318
|
}, [_ref4.current]);
|
|
342
319
|
var onWaveSeek = React.useCallback(function (newTime) {
|
|
343
320
|
var _ref$current3 = _ref4.current,
|
|
344
|
-
|
|
345
|
-
|
|
321
|
+
element = _ref$current3 === void 0 ? null : _ref$current3;
|
|
346
322
|
if (element === null) {
|
|
347
323
|
return;
|
|
348
324
|
}
|
|
349
|
-
|
|
350
325
|
if (isNumber__default["default"](newTime)) {
|
|
351
326
|
element.currentTime = newTime;
|
|
352
327
|
}
|
|
@@ -358,14 +333,11 @@ var Audio = function Audio(_ref) {
|
|
|
358
333
|
}, [waveReady, onReady]);
|
|
359
334
|
React.useEffect(function () {
|
|
360
335
|
var _ref$current4 = _ref4.current,
|
|
361
|
-
|
|
362
|
-
|
|
336
|
+
element = _ref$current4 === void 0 ? null : _ref$current4;
|
|
363
337
|
if (element === null) {
|
|
364
338
|
return;
|
|
365
339
|
}
|
|
366
|
-
|
|
367
340
|
var isPaused = element.paused;
|
|
368
|
-
|
|
369
341
|
if (paused && !isPaused) {
|
|
370
342
|
element.pause();
|
|
371
343
|
} else if (!paused && isPaused) {
|
|
@@ -385,7 +357,6 @@ var Audio = function Audio(_ref) {
|
|
|
385
357
|
key: url,
|
|
386
358
|
ref: function ref(newRef) {
|
|
387
359
|
_ref4.current = newRef;
|
|
388
|
-
|
|
389
360
|
if (mediaRef !== null && isFunction__default["default"](mediaRef)) {
|
|
390
361
|
mediaRef(newRef);
|
|
391
362
|
} else if (mediaRef !== null) {
|
|
@@ -406,7 +377,8 @@ var Audio = function Audio(_ref) {
|
|
|
406
377
|
onVolumeChange: onVolumeChange
|
|
407
378
|
}), withWave ? /*#__PURE__*/React__default["default"].createElement(AudioBars, {
|
|
408
379
|
className: styles$1.wave,
|
|
409
|
-
progress: progress
|
|
380
|
+
progress: progress
|
|
381
|
+
// {...waveProps}
|
|
410
382
|
,
|
|
411
383
|
duration: duration,
|
|
412
384
|
playing: !paused,
|
|
@@ -414,7 +386,6 @@ var Audio = function Audio(_ref) {
|
|
|
414
386
|
play: onWavePlay
|
|
415
387
|
}) : null);
|
|
416
388
|
};
|
|
417
|
-
|
|
418
389
|
Audio.propTypes = propTypes$1;
|
|
419
390
|
Audio.defaultProps = defaultProps$1;
|
|
420
391
|
var Audio$1 = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
@@ -455,58 +426,54 @@ var defaultProps = {
|
|
|
455
426
|
onResume: null,
|
|
456
427
|
onReady: null
|
|
457
428
|
};
|
|
458
|
-
|
|
459
429
|
function AudioWave(_ref) {
|
|
460
430
|
var currentTime = _ref.currentTime,
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
431
|
+
duration = _ref.duration,
|
|
432
|
+
playing = _ref.playing,
|
|
433
|
+
sampleWidth = _ref.sampleWidth,
|
|
434
|
+
sampleMargin = _ref.sampleMargin,
|
|
435
|
+
minSampleHeight = _ref.minSampleHeight,
|
|
436
|
+
backgroundColor = _ref.backgroundColor,
|
|
437
|
+
progressColor = _ref.progressColor,
|
|
438
|
+
audioLevels = _ref.audioLevels,
|
|
439
|
+
className = _ref.className,
|
|
440
|
+
onSeek = _ref.onSeek,
|
|
441
|
+
onResume = _ref.onResume,
|
|
442
|
+
onReady = _ref.onReady;
|
|
473
443
|
var canvasBackgroundRef = React.useRef(null);
|
|
474
444
|
var canvasProgressRef = React.useRef(null);
|
|
475
445
|
var mainColor = React.useMemo(function () {
|
|
476
446
|
var _ref2 = backgroundColor || {},
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
447
|
+
_ref2$color = _ref2.color,
|
|
448
|
+
color = _ref2$color === void 0 ? 'white' : _ref2$color;
|
|
480
449
|
return color;
|
|
481
450
|
}, [backgroundColor]);
|
|
482
451
|
var alternateColor = React.useMemo(function () {
|
|
483
452
|
return utils.getContrastingColor(backgroundColor, progressColor);
|
|
484
453
|
}, [progressColor, backgroundColor]);
|
|
485
|
-
|
|
486
454
|
var _useDimensionObserver = hooks.useDimensionObserver(),
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
455
|
+
elRef = _useDimensionObserver.ref,
|
|
456
|
+
_useDimensionObserver2 = _useDimensionObserver.width,
|
|
457
|
+
elWidth = _useDimensionObserver2 === void 0 ? null : _useDimensionObserver2,
|
|
458
|
+
elHeight = _useDimensionObserver.height;
|
|
491
459
|
|
|
460
|
+
// Linear animation for progress bar
|
|
492
461
|
|
|
493
462
|
var _useSpring = core$1.useSpring(function () {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
463
|
+
return {
|
|
464
|
+
x: 0,
|
|
465
|
+
config: {
|
|
466
|
+
duration: 0
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
}),
|
|
470
|
+
_useSpring2 = _slicedToArray__default["default"](_useSpring, 2),
|
|
471
|
+
springProps = _useSpring2[0],
|
|
472
|
+
setSpringProps = _useSpring2[1];
|
|
505
473
|
React.useEffect(function () {
|
|
506
474
|
if (currentTime === null || duration === null) {
|
|
507
475
|
return;
|
|
508
476
|
}
|
|
509
|
-
|
|
510
477
|
var progress = currentTime / duration;
|
|
511
478
|
setSpringProps.start({
|
|
512
479
|
reset: true,
|
|
@@ -521,32 +488,35 @@ function AudioWave(_ref) {
|
|
|
521
488
|
duration: (duration - currentTime) * 1000
|
|
522
489
|
}
|
|
523
490
|
});
|
|
524
|
-
}, [playing, duration, currentTime, setSpringProps]);
|
|
491
|
+
}, [playing, duration, currentTime, setSpringProps]);
|
|
492
|
+
|
|
493
|
+
// draw canvas
|
|
525
494
|
|
|
526
495
|
React.useEffect(function () {
|
|
527
496
|
if (audioLevels === null || audioLevels.length === 0 || elRef.current === null) {
|
|
528
497
|
return;
|
|
529
498
|
}
|
|
530
|
-
|
|
531
499
|
var sampleOuterWidth = sampleWidth + sampleMargin * 2;
|
|
532
|
-
var samplesCount = Math.floor(elWidth / sampleOuterWidth);
|
|
500
|
+
var samplesCount = Math.floor(elWidth / sampleOuterWidth);
|
|
501
|
+
|
|
502
|
+
// const amplitudes = [];
|
|
503
|
+
|
|
533
504
|
// get samples
|
|
534
505
|
|
|
535
506
|
var levelsBySamples = audioLevels.length / samplesCount;
|
|
536
|
-
|
|
537
507
|
var amplitudes = _toConsumableArray__default["default"](Array(samplesCount).keys()).reduce(function (newAmplitudes, index) {
|
|
538
508
|
var levelStartIndex = index * levelsBySamples;
|
|
539
509
|
var levelEndIndex = levelStartIndex + levelsBySamples;
|
|
540
510
|
var newValues = [];
|
|
541
|
-
|
|
542
511
|
for (var i = Math.floor(levelStartIndex); i < Math.round(levelEndIndex); i += 1) {
|
|
543
512
|
newValues.push(audioLevels[i]);
|
|
544
513
|
}
|
|
545
|
-
|
|
546
514
|
return levelsBySamples >= 1 ? [].concat(_toConsumableArray__default["default"](newAmplitudes), [newValues.reduce(function (total, value) {
|
|
547
515
|
return total + value;
|
|
548
516
|
}, 0) / newValues.length]) : [].concat(_toConsumableArray__default["default"](newAmplitudes), newValues);
|
|
549
|
-
}, []);
|
|
517
|
+
}, []);
|
|
518
|
+
|
|
519
|
+
// for (let sampleI = 0; sampleI < samplesCount; sampleI += levelsBySamples) {
|
|
550
520
|
// // if (levelsBySamples >= 1) {
|
|
551
521
|
// // const sampleSize = Math.floor(levelsBySamples);
|
|
552
522
|
// // const sampleStart = sampleSize * sampleI;
|
|
@@ -564,15 +534,14 @@ function AudioWave(_ref) {
|
|
|
564
534
|
// // }
|
|
565
535
|
// // }
|
|
566
536
|
// }
|
|
567
|
-
|
|
568
|
-
|
|
569
537
|
var minAmplitude = Math.min.apply(Math, _toConsumableArray__default["default"](amplitudes));
|
|
570
538
|
var maxAmplitude = Math.max.apply(Math, _toConsumableArray__default["default"](amplitudes));
|
|
571
539
|
var delta = maxAmplitude - minAmplitude;
|
|
572
540
|
var normalizedAmplitudes = amplitudes.map(function (n) {
|
|
573
541
|
return (n - minAmplitude) / delta;
|
|
574
|
-
});
|
|
542
|
+
});
|
|
575
543
|
|
|
544
|
+
// draw samples
|
|
576
545
|
var canvasBg = canvasBackgroundRef.current;
|
|
577
546
|
var canvasProgress = canvasProgressRef.current;
|
|
578
547
|
var scale = typeof window !== 'undefined' ? window.devicePixelRatio : 1;
|
|
@@ -594,23 +563,20 @@ function AudioWave(_ref) {
|
|
|
594
563
|
ctxBG.fillRect(Math.round(sampleX), Math.round(sampleY), sampleWidth, Math.round(sampleHeight));
|
|
595
564
|
ctxProgress.fillRect(Math.round(sampleX), Math.round(sampleY), sampleWidth, Math.round(sampleHeight));
|
|
596
565
|
});
|
|
597
|
-
|
|
598
566
|
if (onReady !== null) {
|
|
599
567
|
onReady();
|
|
600
568
|
}
|
|
601
|
-
}, [audioLevels, sampleWidth, sampleMargin, minSampleHeight, elWidth, elHeight, mainColor, alternateColor, onReady]);
|
|
569
|
+
}, [audioLevels, sampleWidth, sampleMargin, minSampleHeight, elWidth, elHeight, mainColor, alternateColor, onReady]);
|
|
602
570
|
|
|
571
|
+
// User events
|
|
603
572
|
var seekFromX = React.useCallback(function (x) {
|
|
604
573
|
var _elRef$current$getBou = elRef.current.getBoundingClientRect(),
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
574
|
+
elX = _elRef$current$getBou.left,
|
|
575
|
+
width = _elRef$current$getBou.width;
|
|
608
576
|
var progress = Math.max(0, Math.min(1, (x - elX) / width));
|
|
609
|
-
|
|
610
577
|
if (onSeek !== null && duration !== null) {
|
|
611
578
|
onSeek(progress * duration);
|
|
612
579
|
}
|
|
613
|
-
|
|
614
580
|
if (!playing) {
|
|
615
581
|
onResume();
|
|
616
582
|
}
|
|
@@ -618,14 +584,12 @@ function AudioWave(_ref) {
|
|
|
618
584
|
var bind = react.useGesture({
|
|
619
585
|
onDrag: function onDrag(_ref3) {
|
|
620
586
|
var _ref3$xy = _slicedToArray__default["default"](_ref3.xy, 1),
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
587
|
+
x = _ref3$xy[0],
|
|
588
|
+
elapsedTime = _ref3.elapsedTime,
|
|
589
|
+
active = _ref3.active;
|
|
625
590
|
if (!active && elapsedTime > 300) {
|
|
626
591
|
return;
|
|
627
592
|
}
|
|
628
|
-
|
|
629
593
|
seekFromX(x);
|
|
630
594
|
}
|
|
631
595
|
}, {
|
|
@@ -650,7 +614,6 @@ function AudioWave(_ref) {
|
|
|
650
614
|
}
|
|
651
615
|
}));
|
|
652
616
|
}
|
|
653
|
-
|
|
654
617
|
AudioWave.propTypes = propTypes;
|
|
655
618
|
AudioWave.defaultProps = defaultProps;
|
|
656
619
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-audio",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.322",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -52,21 +52,21 @@
|
|
|
52
52
|
"@fortawesome/fontawesome-svg-core": "^1.2.32",
|
|
53
53
|
"@fortawesome/free-solid-svg-icons": "^5.15.1",
|
|
54
54
|
"@fortawesome/react-fontawesome": "^0.1.13",
|
|
55
|
-
"@micromag/core": "^0.3.
|
|
56
|
-
"@micromag/element-closed-captions": "^0.3.
|
|
57
|
-
"@micromag/element-media-controls": "^0.3.
|
|
58
|
-
"@react-spring/core": "^9.
|
|
59
|
-
"@react-spring/web": "^9.
|
|
55
|
+
"@micromag/core": "^0.3.322",
|
|
56
|
+
"@micromag/element-closed-captions": "^0.3.322",
|
|
57
|
+
"@micromag/element-media-controls": "^0.3.322",
|
|
58
|
+
"@react-spring/core": "^9.6.1",
|
|
59
|
+
"@react-spring/web": "^9.6.1",
|
|
60
60
|
"@use-gesture/react": "^10.2.4",
|
|
61
61
|
"classnames": "^2.2.6",
|
|
62
62
|
"lodash": "^4.17.21",
|
|
63
63
|
"prop-types": "^15.7.2",
|
|
64
64
|
"react-intl": "^5.12.1",
|
|
65
|
-
"uuid": "^
|
|
65
|
+
"uuid": "^9.0.0",
|
|
66
66
|
"whatwg-fetch": "^3.6.1"
|
|
67
67
|
},
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "2dfe09ad5a9ac720e4bfbffcb6371fc31c24fa9f"
|
|
72
72
|
}
|