@micromag/screen-video 0.3.158 → 0.3.162

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 +10 -9
  2. package/lib/index.js +9 -8
  3. package/package.json +11 -11
package/es/index.js CHANGED
@@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
8
8
  import React, { useEffect, useState, useCallback, useMemo } from 'react';
9
9
  import { PropTypes as PropTypes$1 } from '@micromag/core';
10
10
  import { ScreenElement, PlaceholderVideo, Empty, Transitions } from '@micromag/core/components';
11
- import { useScreenSize, useScreenRenderContext, useViewerNavigation, useViewerContext, useViewerWebView, usePlaybackContext, usePlaybackMediaRef } from '@micromag/core/contexts';
11
+ import { useScreenSize, useScreenRenderContext, useViewerNavigation, useViewerContext, useViewerWebView, usePlaybackContext, usePlaybackMediaRef, useViewerContainer } from '@micromag/core/contexts';
12
12
  import { useTrackScreenMedia, useActivityDetector, useMediaThumbnail } from '@micromag/core/hooks';
13
13
  import Background from '@micromag/element-background';
14
14
  import CallToAction from '@micromag/element-call-to-action';
@@ -125,13 +125,14 @@ var VideoScreen = function VideoScreen(_ref) {
125
125
  return function () {};
126
126
  }
127
127
 
128
+ setControlsTheme({
129
+ seekBarOnly: withSeekBar && !withControls,
130
+ color: color,
131
+ progressColor: progressColor
132
+ });
133
+
128
134
  if (withControls || withSeekBar) {
129
135
  setControls(true);
130
- setControlsTheme({
131
- seekBarOnly: withSeekBar && !withControls,
132
- color: color,
133
- progressColor: progressColor
134
- });
135
136
  } else {
136
137
  setControls(false);
137
138
  }
@@ -152,12 +153,13 @@ var VideoScreen = function VideoScreen(_ref) {
152
153
  setPlaying(true);
153
154
  }
154
155
  }, [current, autoPlay]);
156
+ var viewerContainer = useViewerContainer();
155
157
 
156
158
  var _useActivityDetector = useActivityDetector({
159
+ element: viewerContainer,
157
160
  disabled: !current || !isView,
158
161
  timeout: 2000
159
162
  }),
160
- activityDetectorRef = _useActivityDetector.ref,
161
163
  activityDetected = _useActivityDetector.detected;
162
164
 
163
165
  useEffect(function () {
@@ -340,8 +342,7 @@ var VideoScreen = function VideoScreen(_ref) {
340
342
  })) : null)) : null];
341
343
  return /*#__PURE__*/React.createElement("div", {
342
344
  className: classNames([styles.container, (_ref7 = {}, _defineProperty(_ref7, className, className !== null), _defineProperty(_ref7, styles.fullscreen, fullscreen), _ref7)]),
343
- "data-screen-ready": isStatic || isCapture || ready,
344
- ref: activityDetectorRef
345
+ "data-screen-ready": isStatic || isCapture || ready
345
346
  }, !isPlaceholder ? /*#__PURE__*/React.createElement(Background, {
346
347
  background: background,
347
348
  width: width,
package/lib/index.js CHANGED
@@ -145,13 +145,14 @@ var VideoScreen = function VideoScreen(_ref) {
145
145
  return function () {};
146
146
  }
147
147
 
148
+ setControlsTheme({
149
+ seekBarOnly: withSeekBar && !withControls,
150
+ color: color,
151
+ progressColor: progressColor
152
+ });
153
+
148
154
  if (withControls || withSeekBar) {
149
155
  setControls(true);
150
- setControlsTheme({
151
- seekBarOnly: withSeekBar && !withControls,
152
- color: color,
153
- progressColor: progressColor
154
- });
155
156
  } else {
156
157
  setControls(false);
157
158
  }
@@ -172,12 +173,13 @@ var VideoScreen = function VideoScreen(_ref) {
172
173
  setPlaying(true);
173
174
  }
174
175
  }, [current, autoPlay]);
176
+ var viewerContainer = contexts.useViewerContainer();
175
177
 
176
178
  var _useActivityDetector = hooks.useActivityDetector({
179
+ element: viewerContainer,
177
180
  disabled: !current || !isView,
178
181
  timeout: 2000
179
182
  }),
180
- activityDetectorRef = _useActivityDetector.ref,
181
183
  activityDetected = _useActivityDetector.detected;
182
184
 
183
185
  React.useEffect(function () {
@@ -360,8 +362,7 @@ var VideoScreen = function VideoScreen(_ref) {
360
362
  })) : null)) : null];
361
363
  return /*#__PURE__*/React__default["default"].createElement("div", {
362
364
  className: classNames__default["default"]([styles.container, (_ref7 = {}, _defineProperty__default["default"](_ref7, className, className !== null), _defineProperty__default["default"](_ref7, styles.fullscreen, fullscreen), _ref7)]),
363
- "data-screen-ready": isStatic || isCapture || ready,
364
- ref: activityDetectorRef
365
+ "data-screen-ready": isStatic || isCapture || ready
365
366
  }, !isPlaceholder ? /*#__PURE__*/React__default["default"].createElement(Background__default["default"], {
366
367
  background: background,
367
368
  width: width,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/screen-video",
3
- "version": "0.3.158",
3
+ "version": "0.3.162",
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.156",
54
- "@micromag/element-background": "^0.3.158",
55
- "@micromag/element-call-to-action": "^0.3.156",
56
- "@micromag/element-closed-captions": "^0.3.156",
57
- "@micromag/element-container": "^0.3.156",
58
- "@micromag/element-image": "^0.3.156",
59
- "@micromag/element-media-controls": "^0.3.156",
60
- "@micromag/element-video": "^0.3.156",
61
- "@micromag/transforms": "^0.3.156",
53
+ "@micromag/core": "^0.3.162",
54
+ "@micromag/element-background": "^0.3.162",
55
+ "@micromag/element-call-to-action": "^0.3.162",
56
+ "@micromag/element-closed-captions": "^0.3.162",
57
+ "@micromag/element-container": "^0.3.162",
58
+ "@micromag/element-image": "^0.3.162",
59
+ "@micromag/element-media-controls": "^0.3.162",
60
+ "@micromag/element-video": "^0.3.162",
61
+ "@micromag/transforms": "^0.3.162",
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": "edf7b21d97eeee8cc13826133a01ff12c0e9a6d9"
71
+ "gitHead": "ffd4deb967b364580d292f0e02af777abac02967"
72
72
  }