@micromag/element-video 0.4.69 → 0.4.71
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 +13 -14
- package/package.json +4 -4
package/es/index.js
CHANGED
|
@@ -6,8 +6,8 @@ import classNames from 'classnames';
|
|
|
6
6
|
import isFunction from 'lodash/isFunction';
|
|
7
7
|
import { useMemo, useState, useEffect, useRef, useCallback } from 'react';
|
|
8
8
|
import { Spinner } from '@micromag/core/components';
|
|
9
|
-
import { useSetting, mediaElementIsPlaying } from '@micromag/core/contexts';
|
|
10
9
|
import { useMediaThumbnail, useMediaCurrentTime, useMediaDuration, useMediaReady, useProgressSteps } from '@micromag/core/hooks';
|
|
10
|
+
import { useSetting } from '@micromag/core/contexts';
|
|
11
11
|
import { getMediaFilesAsArray, getVideoSupportedMimes } from '@micromag/core/utils';
|
|
12
12
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
13
13
|
|
|
@@ -250,40 +250,39 @@ function Video(_ref) {
|
|
|
250
250
|
onReady();
|
|
251
251
|
}
|
|
252
252
|
}, [ready, onReady]);
|
|
253
|
-
var
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
wasPreloaded = _useState8[0],
|
|
259
|
-
setWasPreloaded = _useState8[1];
|
|
253
|
+
var finalPreload = shouldLoad ? preload : 'none';
|
|
254
|
+
var _useState5 = useState(finalPreload === 'auto' || finalPreload === 'metadata'),
|
|
255
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
256
|
+
wasPreloaded = _useState6[0],
|
|
257
|
+
setWasPreloaded = _useState6[1];
|
|
260
258
|
useEffect(function () {
|
|
261
259
|
var _ref$current2 = _ref6.current,
|
|
262
260
|
element = _ref$current2 === void 0 ? null : _ref$current2;
|
|
263
|
-
if (
|
|
261
|
+
if (shouldLoad && !wasPreloaded && element !== null) {
|
|
264
262
|
try {
|
|
265
263
|
element.load();
|
|
266
264
|
} catch (_unused) {}
|
|
267
265
|
setWasPreloaded(true);
|
|
268
266
|
}
|
|
269
|
-
}, [shouldLoad, wasPreloaded
|
|
267
|
+
}, [shouldLoad, wasPreloaded]);
|
|
270
268
|
useEffect(function () {
|
|
271
269
|
var _ref$current3 = _ref6.current,
|
|
272
270
|
element = _ref$current3 === void 0 ? null : _ref$current3;
|
|
273
271
|
if (element === null || mediaUrl === null) {
|
|
274
272
|
return;
|
|
275
273
|
}
|
|
276
|
-
var
|
|
277
|
-
if (paused &&
|
|
274
|
+
var isPaused = element.paused;
|
|
275
|
+
if (paused && !isPaused) {
|
|
278
276
|
element.pause();
|
|
279
|
-
} else if (!paused &&
|
|
277
|
+
} else if (!paused && isPaused && element.dataset.forcePlaying !== 'true') {
|
|
280
278
|
element.play()["catch"](function (e) {
|
|
281
279
|
if (onPlayError !== null) {
|
|
282
280
|
onPlayError(e);
|
|
283
281
|
}
|
|
284
282
|
});
|
|
285
283
|
}
|
|
286
|
-
|
|
284
|
+
element.dataset.forcePlaying = 'false';
|
|
285
|
+
}, [paused, media, mediaUrl, onPlayError]);
|
|
287
286
|
useProgressSteps({
|
|
288
287
|
currentTime: currentTime,
|
|
289
288
|
duration: duration,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-video",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.71",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@babel/runtime": "^7.28.6",
|
|
63
|
-
"@micromag/core": "^0.4.
|
|
64
|
-
"@micromag/element-closed-captions": "^0.4.
|
|
63
|
+
"@micromag/core": "^0.4.71",
|
|
64
|
+
"@micromag/element-closed-captions": "^0.4.71",
|
|
65
65
|
"classnames": "^2.2.6",
|
|
66
66
|
"hls.js": "^1.5.15",
|
|
67
67
|
"lodash": "^4.17.23",
|
|
@@ -72,6 +72,6 @@
|
|
|
72
72
|
"access": "public",
|
|
73
73
|
"registry": "https://registry.npmjs.org/"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "9101554bc5761e32b4a002a10d26800608c69773",
|
|
76
76
|
"types": "es/index.d.ts"
|
|
77
77
|
}
|