@micromag/element-video 0.4.60 → 0.4.63
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 +15 -1
- package/package.json +4 -4
package/es/index.js
CHANGED
|
@@ -251,9 +251,23 @@ function Video(_ref) {
|
|
|
251
251
|
}
|
|
252
252
|
}, [ready, onReady]);
|
|
253
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];
|
|
254
258
|
useEffect(function () {
|
|
255
259
|
var _ref$current2 = _ref6.current,
|
|
256
260
|
element = _ref$current2 === void 0 ? null : _ref$current2;
|
|
261
|
+
if (shouldLoad && !wasPreloaded && element !== null) {
|
|
262
|
+
try {
|
|
263
|
+
element.load();
|
|
264
|
+
} catch (_unused) {}
|
|
265
|
+
setWasPreloaded(true);
|
|
266
|
+
}
|
|
267
|
+
}, [shouldLoad, wasPreloaded]);
|
|
268
|
+
useEffect(function () {
|
|
269
|
+
var _ref$current3 = _ref6.current,
|
|
270
|
+
element = _ref$current3 === void 0 ? null : _ref$current3;
|
|
257
271
|
if (element === null || mediaUrl === null) {
|
|
258
272
|
return;
|
|
259
273
|
}
|
|
@@ -294,7 +308,7 @@ function Video(_ref) {
|
|
|
294
308
|
mediaRef.current = newRef;
|
|
295
309
|
}
|
|
296
310
|
},
|
|
297
|
-
src: sources === null && shouldLoad ? "".concat(mediaUrl, "#t=0.001") :
|
|
311
|
+
src: sources === null && shouldLoad ? "".concat(mediaUrl, "#t=0.001") : undefined,
|
|
298
312
|
autoPlay: autoPlay && !paused,
|
|
299
313
|
loop: loop,
|
|
300
314
|
muted: muted,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-video",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.63",
|
|
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.63",
|
|
64
|
+
"@micromag/element-closed-captions": "^0.4.63",
|
|
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": "0a6df1a5352c067c3296377d26fadb9b71244345",
|
|
76
76
|
"types": "es/index.d.ts"
|
|
77
77
|
}
|