@micromag/element-audio 0.3.566 → 0.3.569
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/es/index.js +20 -19
- package/package.json +4 -4
package/es/index.js
CHANGED
|
@@ -269,29 +269,30 @@ var Audio = function Audio(_ref) {
|
|
|
269
269
|
var srcUrl = useMemo(function () {
|
|
270
270
|
if (files) {
|
|
271
271
|
var filesAsEntries = Object.entries(files);
|
|
272
|
-
var
|
|
273
|
-
var
|
|
274
|
-
key =
|
|
272
|
+
var _ref3 = filesAsEntries.find(function (_ref5) {
|
|
273
|
+
var _ref6 = _slicedToArray(_ref5, 1),
|
|
274
|
+
key = _ref6[0];
|
|
275
275
|
return key === 'mp3';
|
|
276
|
-
}),
|
|
277
|
-
|
|
278
|
-
|
|
276
|
+
}) || [],
|
|
277
|
+
_ref4 = _slicedToArray(_ref3, 2),
|
|
278
|
+
_ref4$ = _ref4[1],
|
|
279
|
+
mp3File = _ref4$ === void 0 ? null : _ref4$;
|
|
279
280
|
if (mp3File) {
|
|
280
281
|
return mp3File.url;
|
|
281
282
|
}
|
|
282
283
|
}
|
|
283
284
|
return url;
|
|
284
285
|
}, [files, url]);
|
|
285
|
-
var
|
|
286
|
-
var currentTime = useMediaCurrentTime(
|
|
286
|
+
var _ref8 = useRef(null);
|
|
287
|
+
var currentTime = useMediaCurrentTime(_ref8.current, {
|
|
287
288
|
id: srcUrl,
|
|
288
289
|
disabled: paused || !withWave && onProgressStep === null,
|
|
289
290
|
updateInterval: updateInterval
|
|
290
291
|
});
|
|
291
|
-
var ready = useMediaReady(
|
|
292
|
+
var ready = useMediaReady(_ref8.current, {
|
|
292
293
|
id: srcUrl
|
|
293
294
|
});
|
|
294
|
-
var duration = useMediaDuration(
|
|
295
|
+
var duration = useMediaDuration(_ref8.current, {
|
|
295
296
|
id: srcUrl
|
|
296
297
|
});
|
|
297
298
|
|
|
@@ -300,7 +301,7 @@ var Audio = function Audio(_ref) {
|
|
|
300
301
|
// reduceBufferFactor,
|
|
301
302
|
// });
|
|
302
303
|
|
|
303
|
-
useMediaLoad(
|
|
304
|
+
useMediaLoad(_ref8.current, {
|
|
304
305
|
preload: preload,
|
|
305
306
|
shouldLoad: shouldLoad
|
|
306
307
|
});
|
|
@@ -311,7 +312,7 @@ var Audio = function Audio(_ref) {
|
|
|
311
312
|
}
|
|
312
313
|
}, [duration, customOnDurationChange]);
|
|
313
314
|
var onVolumeChange = useCallback(function () {
|
|
314
|
-
var _ref$current =
|
|
315
|
+
var _ref$current = _ref8.current,
|
|
315
316
|
element = _ref$current === void 0 ? null : _ref$current;
|
|
316
317
|
if (element === null) {
|
|
317
318
|
return;
|
|
@@ -319,17 +320,17 @@ var Audio = function Audio(_ref) {
|
|
|
319
320
|
if (customOnVolumeChange !== null) {
|
|
320
321
|
customOnVolumeChange(element.volume);
|
|
321
322
|
}
|
|
322
|
-
}, [
|
|
323
|
+
}, [_ref8.current, customOnVolumeChange]);
|
|
323
324
|
var onWavePlay = useCallback(function () {
|
|
324
|
-
var _ref$current2 =
|
|
325
|
+
var _ref$current2 = _ref8.current,
|
|
325
326
|
element = _ref$current2 === void 0 ? null : _ref$current2;
|
|
326
327
|
if (element === null) {
|
|
327
328
|
return;
|
|
328
329
|
}
|
|
329
330
|
element.play();
|
|
330
|
-
}, [
|
|
331
|
+
}, [_ref8.current]);
|
|
331
332
|
var onWaveSeek = useCallback(function (newTime) {
|
|
332
|
-
var _ref$current3 =
|
|
333
|
+
var _ref$current3 = _ref8.current,
|
|
333
334
|
element = _ref$current3 === void 0 ? null : _ref$current3;
|
|
334
335
|
if (element === null) {
|
|
335
336
|
return;
|
|
@@ -337,14 +338,14 @@ var Audio = function Audio(_ref) {
|
|
|
337
338
|
if (isNumber(newTime)) {
|
|
338
339
|
element.currentTime = newTime;
|
|
339
340
|
}
|
|
340
|
-
}, [
|
|
341
|
+
}, [_ref8.current]);
|
|
341
342
|
useEffect(function () {
|
|
342
343
|
if (waveReady && onReady !== null) {
|
|
343
344
|
onReady();
|
|
344
345
|
}
|
|
345
346
|
}, [waveReady, onReady]);
|
|
346
347
|
useEffect(function () {
|
|
347
|
-
var _ref$current4 =
|
|
348
|
+
var _ref$current4 = _ref8.current,
|
|
348
349
|
element = _ref$current4 === void 0 ? null : _ref$current4;
|
|
349
350
|
if (element === null) {
|
|
350
351
|
return;
|
|
@@ -372,7 +373,7 @@ var Audio = function Audio(_ref) {
|
|
|
372
373
|
}, /*#__PURE__*/React.createElement("audio", {
|
|
373
374
|
key: srcUrl,
|
|
374
375
|
ref: function ref(newRef) {
|
|
375
|
-
|
|
376
|
+
_ref8.current = newRef;
|
|
376
377
|
if (mediaRef !== null && isFunction(mediaRef)) {
|
|
377
378
|
mediaRef(newRef);
|
|
378
379
|
} else if (mediaRef !== null) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-audio",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.569",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@babel/runtime": "^7.13.10",
|
|
62
|
-
"@micromag/core": "^0.3.
|
|
63
|
-
"@micromag/element-closed-captions": "^0.3.
|
|
62
|
+
"@micromag/core": "^0.3.569",
|
|
63
|
+
"@micromag/element-closed-captions": "^0.3.569",
|
|
64
64
|
"@react-spring/core": "^9.6.1",
|
|
65
65
|
"@react-spring/web": "^9.6.1",
|
|
66
66
|
"@use-gesture/react": "^10.3.0",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"access": "public",
|
|
75
75
|
"registry": "https://registry.npmjs.org/"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "ceb71f23a32ab8df4a1563a1e5cd5598e539de4d"
|
|
78
78
|
}
|