@micromag/screen-video 0.3.134 → 0.3.135

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 (3) hide show
  1. package/es/index.js +7 -10
  2. package/lib/index.js +7 -10
  3. package/package.json +11 -11
package/es/index.js CHANGED
@@ -289,15 +289,11 @@ var VideoScreen = function VideoScreen(_ref) {
289
289
  var onVideoReady = useCallback(function () {
290
290
  setReady(true);
291
291
  }, [setReady]);
292
- useEffect(function () {
293
- var checkPlayStatus = setTimeout(function () {
294
- if (current && ready && autoPlay && !playing && apiMediaRef) {
295
- setShouldCatchFirstTapToPlay(true);
296
- }
297
- }, 200); // @todo?
298
-
299
- return clearTimeout(checkPlayStatus);
300
- }, [current, ready, autoPlay, playing, setShouldCatchFirstTapToPlay]);
292
+ var onSuspended = useCallback(function () {
293
+ if (autoPlay) {
294
+ setShouldCatchFirstTapToPlay(true);
295
+ }
296
+ }, [setShouldCatchFirstTapToPlay]);
301
297
  var visibleControls = !autoPlay && !playing || muted || showMediaControls;
302
298
  var items = [/*#__PURE__*/React.createElement(ScreenElement, {
303
299
  key: "video",
@@ -348,10 +344,11 @@ var VideoScreen = function VideoScreen(_ref) {
348
344
  onDurationChanged: onDurationChanged,
349
345
  onSeeked: onSeeked,
350
346
  onEnded: onEnded,
347
+ onSuspended: onSuspended,
351
348
  onVolumeChanged: onVolumeChanged,
352
349
  focusable: current && isView,
353
350
  shouldLoad: mediaShouldLoad
354
- }))) : null), shouldCatchFirstTapToPlay ? /*#__PURE__*/React.createElement("button", {
351
+ }))) : null), shouldCatchFirstTapToPlay && !playing ? /*#__PURE__*/React.createElement("button", {
355
352
  key: "tap-catcher-button",
356
353
  type: "button",
357
354
  onTouchStart: play,
package/lib/index.js CHANGED
@@ -310,15 +310,11 @@ var VideoScreen = function VideoScreen(_ref) {
310
310
  var onVideoReady = React.useCallback(function () {
311
311
  setReady(true);
312
312
  }, [setReady]);
313
- React.useEffect(function () {
314
- var checkPlayStatus = setTimeout(function () {
315
- if (current && ready && autoPlay && !playing && apiMediaRef) {
316
- setShouldCatchFirstTapToPlay(true);
317
- }
318
- }, 200); // @todo?
319
-
320
- return clearTimeout(checkPlayStatus);
321
- }, [current, ready, autoPlay, playing, setShouldCatchFirstTapToPlay]);
313
+ var onSuspended = React.useCallback(function () {
314
+ if (autoPlay) {
315
+ setShouldCatchFirstTapToPlay(true);
316
+ }
317
+ }, [setShouldCatchFirstTapToPlay]);
322
318
  var visibleControls = !autoPlay && !playing || muted || showMediaControls;
323
319
  var items = [/*#__PURE__*/React__default["default"].createElement(components.ScreenElement, {
324
320
  key: "video",
@@ -369,10 +365,11 @@ var VideoScreen = function VideoScreen(_ref) {
369
365
  onDurationChanged: onDurationChanged,
370
366
  onSeeked: onSeeked,
371
367
  onEnded: onEnded,
368
+ onSuspended: onSuspended,
372
369
  onVolumeChanged: onVolumeChanged,
373
370
  focusable: current && isView,
374
371
  shouldLoad: mediaShouldLoad
375
- }))) : null), shouldCatchFirstTapToPlay ? /*#__PURE__*/React__default["default"].createElement("button", {
372
+ }))) : null), shouldCatchFirstTapToPlay && !playing ? /*#__PURE__*/React__default["default"].createElement("button", {
376
373
  key: "tap-catcher-button",
377
374
  type: "button",
378
375
  onTouchStart: play,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/screen-video",
3
- "version": "0.3.134",
3
+ "version": "0.3.135",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -50,15 +50,15 @@
50
50
  "dependencies": {
51
51
  "@babel/runtime": "^7.13.10",
52
52
  "@folklore/size": "^0.1.20",
53
- "@micromag/core": "^0.3.126",
54
- "@micromag/element-background": "^0.3.134",
55
- "@micromag/element-call-to-action": "^0.3.128",
56
- "@micromag/element-closed-captions": "^0.3.126",
57
- "@micromag/element-container": "^0.3.126",
58
- "@micromag/element-image": "^0.3.126",
59
- "@micromag/element-media-controls": "^0.3.134",
60
- "@micromag/element-video": "^0.3.134",
61
- "@micromag/transforms": "^0.3.126",
53
+ "@micromag/core": "^0.3.135",
54
+ "@micromag/element-background": "^0.3.135",
55
+ "@micromag/element-call-to-action": "^0.3.135",
56
+ "@micromag/element-closed-captions": "^0.3.135",
57
+ "@micromag/element-container": "^0.3.135",
58
+ "@micromag/element-image": "^0.3.135",
59
+ "@micromag/element-media-controls": "^0.3.135",
60
+ "@micromag/element-video": "^0.3.135",
61
+ "@micromag/transforms": "^0.3.135",
62
62
  "classnames": "^2.2.6",
63
63
  "lodash": "^4.17.21",
64
64
  "prop-types": "^15.7.2",
@@ -68,5 +68,5 @@
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
- "gitHead": "3eda132e0f399a773083f6b42a4d1ff7131b7b04"
71
+ "gitHead": "b9bd185aacc16b6fb5540aa113dc7872c822e279"
72
72
  }