@micromag/element-video 0.3.792 → 0.3.793

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.
Files changed (2) hide show
  1. package/es/index.js +3 -11
  2. package/package.json +4 -4
package/es/index.js CHANGED
@@ -264,31 +264,23 @@ var Video = function Video(_ref) {
264
264
  }
265
265
  }, [ready, onReady]);
266
266
  var finalPreload = shouldLoad ? preload : 'none';
267
- var preloadRef = useRef(finalPreload);
268
- var hasPlayedRef = useRef(false);
269
267
  useEffect(function () {
270
268
  var _ref$current2 = _ref6.current,
271
269
  element = _ref$current2 === void 0 ? null : _ref$current2;
272
- if (element === null) {
270
+ if (element === null || mediaUrl === null) {
273
271
  return;
274
272
  }
275
273
  var isPaused = element.paused;
276
274
  if (paused && !isPaused) {
277
275
  element.pause();
278
276
  } else if (!paused && isPaused) {
279
- if (preloadRef.current === 'none') {
280
- element.load();
281
- preloadRef.current = finalPreload;
282
- }
283
- hasPlayedRef.current = true;
284
277
  element.play()["catch"](function (e) {
285
278
  if (onPlayError !== null) {
286
279
  onPlayError(e);
287
280
  }
288
281
  });
289
282
  }
290
- }, [paused, media, onPlayError]); // test media here for fun
291
-
283
+ }, [paused, media, mediaUrl, onPlayError]);
292
284
  useProgressSteps({
293
285
  currentTime: currentTime,
294
286
  duration: duration,
@@ -317,7 +309,7 @@ var Video = function Video(_ref) {
317
309
  }
318
310
  },
319
311
  src: sources === null && shouldLoad ? "".concat(mediaUrl, "#t=0.001") : null,
320
- autoPlay: autoPlay && !paused && !hasPlayedRef.current && muted,
312
+ autoPlay: autoPlay && !paused,
321
313
  loop: loop,
322
314
  muted: muted,
323
315
  poster: shouldLoad && withPoster && finalThumbnail !== null ? finalThumbnail.url || null : null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-video",
3
- "version": "0.3.792",
3
+ "version": "0.3.793",
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.789",
63
- "@micromag/element-closed-captions": "^0.3.789",
62
+ "@micromag/core": "^0.3.793",
63
+ "@micromag/element-closed-captions": "^0.3.793",
64
64
  "classnames": "^2.2.6",
65
65
  "hls.js": "^1.5.15",
66
66
  "lodash": "^4.17.21",
@@ -72,5 +72,5 @@
72
72
  "access": "public",
73
73
  "registry": "https://registry.npmjs.org/"
74
74
  },
75
- "gitHead": "0212271243811112db66fe3393287da15ff28384"
75
+ "gitHead": "6b83952493a0bc269e2b581050805b1d17d986e6"
76
76
  }