@micromag/element-video 0.3.789 → 0.3.791
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 +10 -2
- package/package.json +2 -2
package/es/index.js
CHANGED
|
@@ -263,6 +263,9 @@ var Video = function Video(_ref) {
|
|
|
263
263
|
onReady();
|
|
264
264
|
}
|
|
265
265
|
}, [ready, onReady]);
|
|
266
|
+
var finalPreload = shouldLoad ? preload : 'none';
|
|
267
|
+
var preloadRef = useRef(finalPreload);
|
|
268
|
+
var hasPlayedRef = useRef(false);
|
|
266
269
|
useEffect(function () {
|
|
267
270
|
var _ref$current2 = _ref6.current,
|
|
268
271
|
element = _ref$current2 === void 0 ? null : _ref$current2;
|
|
@@ -273,6 +276,11 @@ var Video = function Video(_ref) {
|
|
|
273
276
|
if (paused && !isPaused) {
|
|
274
277
|
element.pause();
|
|
275
278
|
} else if (!paused && isPaused) {
|
|
279
|
+
if (preloadRef.current === 'none') {
|
|
280
|
+
element.load();
|
|
281
|
+
preloadRef.current = finalPreload;
|
|
282
|
+
}
|
|
283
|
+
hasPlayedRef.current = true;
|
|
276
284
|
element.play()["catch"](function (e) {
|
|
277
285
|
if (onPlayError !== null) {
|
|
278
286
|
onPlayError(e);
|
|
@@ -309,11 +317,11 @@ var Video = function Video(_ref) {
|
|
|
309
317
|
}
|
|
310
318
|
},
|
|
311
319
|
src: sources === null && shouldLoad ? "".concat(mediaUrl, "#t=0.001") : null,
|
|
312
|
-
autoPlay: autoPlay && !paused,
|
|
320
|
+
autoPlay: autoPlay && !paused && !hasPlayedRef.current,
|
|
313
321
|
loop: loop,
|
|
314
322
|
muted: muted,
|
|
315
323
|
poster: shouldLoad && withPoster && finalThumbnail !== null ? finalThumbnail.url || null : null,
|
|
316
|
-
preload:
|
|
324
|
+
preload: finalPreload,
|
|
317
325
|
playsInline: playsInline,
|
|
318
326
|
crossOrigin: withoutCors ? 'anonymous' : null,
|
|
319
327
|
disablePictureInPicture: disablePictureInPicture,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-video",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.791",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"access": "public",
|
|
73
73
|
"registry": "https://registry.npmjs.org/"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "43b8c9e65fa573fc25b0fe25a10a5b73c015de98"
|
|
76
76
|
}
|