@micromag/screen-video 0.3.222 → 0.3.225
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/assets/css/styles.css +1 -1
- package/es/index.js +29 -35
- package/lib/index.js +28 -34
- package/package.json +11 -11
package/assets/css/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.micromag-screen-video-unmuteAndPlayButton{display:inline-block;position:relative;padding:0;background:rgba(0,0,0,0);color:inherit;font-family:inherit;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}.micromag-screen-video-container .micromag-screen-video-content,.micromag-screen-video-container .micromag-screen-video-empty,.micromag-screen-video-container .micromag-screen-video-emptyContainer,.micromag-screen-video-container.micromag-screen-video-fullscreen .micromag-screen-video-image,.micromag-screen-video-container.micromag-screen-video-fullscreen .micromag-screen-video-placeholder,.micromag-screen-video-container.micromag-screen-video-fullscreen .micromag-screen-video-video{position:absolute;top:0;left:0;width:100%;height:100%}.micromag-screen-video-container{position:relative;width:100%;height:100%;overflow:hidden}.micromag-screen-video-disabled.micromag-screen-video-container{overflow:hidden;pointer-events:none}.micromag-screen-video-hidden.micromag-screen-video-container{display:none;visibility:hidden}.micromag-screen-video-placeholder.micromag-screen-video-container .micromag-screen-video-content{position:relative;padding:6px}.micromag-screen-video-container .micromag-screen-video-empty{margin:5px auto;border:2px dashed #343434;color:#343434}.micromag-screen-video-container .micromag-screen-video-emptyContainer{top:50%;height:0;padding-bottom:56.25%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%)}.micromag-screen-video-container .micromag-screen-video-empty{margin:0}.micromag-screen-video-container .micromag-screen-video-content{z-index:1;overflow:hidden}.micromag-screen-video-container .micromag-screen-video-bottom{z-index:2;
|
|
1
|
+
.micromag-screen-video-unmuteAndPlayButton{display:inline-block;position:relative;padding:0;background:rgba(0,0,0,0);color:inherit;font-family:inherit;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}.micromag-screen-video-container .micromag-screen-video-content,.micromag-screen-video-container .micromag-screen-video-empty,.micromag-screen-video-container .micromag-screen-video-emptyContainer,.micromag-screen-video-container.micromag-screen-video-fullscreen .micromag-screen-video-image,.micromag-screen-video-container.micromag-screen-video-fullscreen .micromag-screen-video-placeholder,.micromag-screen-video-container.micromag-screen-video-fullscreen .micromag-screen-video-video{position:absolute;top:0;left:0;width:100%;height:100%}.micromag-screen-video-container{position:relative;width:100%;height:100%;overflow:hidden}.micromag-screen-video-disabled.micromag-screen-video-container{overflow:hidden;pointer-events:none}.micromag-screen-video-hidden.micromag-screen-video-container{display:none;visibility:hidden}.micromag-screen-video-placeholder.micromag-screen-video-container .micromag-screen-video-content{position:relative;padding:6px}.micromag-screen-video-container .micromag-screen-video-empty{margin:5px auto;border:2px dashed #343434;color:#343434}.micromag-screen-video-container .micromag-screen-video-emptyContainer{top:50%;height:0;padding-bottom:56.25%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%)}.micromag-screen-video-container .micromag-screen-video-empty{margin:0}.micromag-screen-video-container .micromag-screen-video-content{z-index:1;overflow:hidden}.micromag-screen-video-container .micromag-screen-video-bottom{position:absolute;z-index:2;bottom:0;left:0;width:100%;-webkit-transition:padding .5s cubic-bezier(.6,0,.4,1),-webkit-transform .5s cubic-bezier(.6,0,.4,1);transition:padding .5s cubic-bezier(.6,0,.4,1),-webkit-transform .5s cubic-bezier(.6,0,.4,1);-o-transition:transform .5s cubic-bezier(.6,0,.4,1),padding .5s cubic-bezier(.6,0,.4,1);transition:transform .5s cubic-bezier(.6,0,.4,1),padding .5s cubic-bezier(.6,0,.4,1);transition:transform .5s cubic-bezier(.6,0,.4,1),padding .5s cubic-bezier(.6,0,.4,1),-webkit-transform .5s cubic-bezier(.6,0,.4,1)}.micromag-screen-video-container .micromag-screen-video-bottom>*{margin-bottom:10px}.micromag-screen-video-container .micromag-screen-video-bottom>:last-child{margin-bottom:0}.micromag-screen-video-container .micromag-screen-video-placeholder{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;height:100%}.micromag-screen-video-container .micromag-screen-video-videoContainer{position:absolute}.micromag-screen-video-container.micromag-screen-video-fullscreen .micromag-screen-video-emptyContainer{top:0;height:100%;padding-bottom:0;-webkit-transform:none;-ms-transform:none;transform:none}.micromag-screen-video-unmuteAndPlayButton{display:block;position:absolute;z-index:3;top:0;right:0;bottom:0;left:0;width:100%;height:100%;border:0;opacity:0;background-color:rgba(0,0,0,0)}
|
package/es/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import React, { useState, useEffect, useCallback, useMemo } from 'react';
|
|
|
9
9
|
import { PropTypes as PropTypes$1 } from '@micromag/core';
|
|
10
10
|
import { ScreenElement, PlaceholderVideo, Empty } from '@micromag/core/components';
|
|
11
11
|
import { useScreenSize, useScreenRenderContext, useViewerNavigation, useViewerContext, useViewerWebView, usePlaybackContext, usePlaybackMediaRef, useViewerContainer } from '@micromag/core/contexts';
|
|
12
|
-
import { useTrackScreenMedia, useActivityDetector, useMediaThumbnail } from '@micromag/core/hooks';
|
|
12
|
+
import { useTrackScreenMedia, useActivityDetector, useDebounce, useMediaThumbnail } from '@micromag/core/hooks';
|
|
13
13
|
import Background from '@micromag/element-background';
|
|
14
14
|
import CallToAction from '@micromag/element-call-to-action';
|
|
15
15
|
import ClosedCaptions from '@micromag/element-closed-captions';
|
|
@@ -57,9 +57,8 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
57
57
|
background = _ref.background,
|
|
58
58
|
callToAction = _ref.callToAction,
|
|
59
59
|
current = _ref.current,
|
|
60
|
-
active = _ref.active
|
|
61
|
-
_ref.
|
|
62
|
-
var spacing = _ref.spacing,
|
|
60
|
+
active = _ref.active,
|
|
61
|
+
spacing = _ref.spacing,
|
|
63
62
|
customMediaRef = _ref.mediaRef,
|
|
64
63
|
className = _ref.className;
|
|
65
64
|
var trackScreenMedia = useTrackScreenMedia('video');
|
|
@@ -127,9 +126,7 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
127
126
|
setHasPlayed = _useState2[1];
|
|
128
127
|
|
|
129
128
|
var backgroundPlaying = current && (isView || isEdit);
|
|
130
|
-
var videoPlaying = current && (isView || isEdit) && playing;
|
|
131
|
-
// isPreview || isCapture || (isView && active && !current && !hasPlayed);
|
|
132
|
-
|
|
129
|
+
var videoPlaying = current && (isView || isEdit) && playing;
|
|
133
130
|
var shouldDisplayPoster = isPreview || isCapture;
|
|
134
131
|
useEffect(function () {
|
|
135
132
|
if (!current) {
|
|
@@ -168,22 +165,19 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
168
165
|
|
|
169
166
|
var _useActivityDetector = useActivityDetector({
|
|
170
167
|
element: viewerContainer,
|
|
171
|
-
disabled: !
|
|
168
|
+
disabled: !isView,
|
|
172
169
|
timeout: 2000
|
|
173
170
|
}),
|
|
174
171
|
activityDetected = _useActivityDetector.detected;
|
|
175
172
|
|
|
176
|
-
|
|
177
|
-
if (!current) {
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
|
|
173
|
+
var toggleControlsVisibility = useCallback(function () {
|
|
181
174
|
if (activityDetected) {
|
|
182
175
|
showControls();
|
|
183
176
|
} else {
|
|
184
177
|
hideControls();
|
|
185
178
|
}
|
|
186
|
-
}, [activityDetected, showControls, hideControls]);
|
|
179
|
+
}, [activityDetected, showControls, hideControls]);
|
|
180
|
+
useDebounce(toggleControlsVisibility, activityDetected, 1000);
|
|
187
181
|
|
|
188
182
|
var _useState3 = useState(null),
|
|
189
183
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
@@ -238,7 +232,8 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
238
232
|
var _useState7 = useState(hasVideo),
|
|
239
233
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
240
234
|
ready = _useState8[0],
|
|
241
|
-
setReady = _useState8[1];
|
|
235
|
+
setReady = _useState8[1];
|
|
236
|
+
|
|
242
237
|
var finalVideo = useMemo(function () {
|
|
243
238
|
return hasVideo ? _objectSpread(_objectSpread({}, video), {}, {
|
|
244
239
|
autoPlay: !isPreview && !isStatic && !isCapture && autoPlay && current
|
|
@@ -285,7 +280,23 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
285
280
|
setPlaying(false);
|
|
286
281
|
}
|
|
287
282
|
}, [current, playing, setPlaying]);
|
|
288
|
-
|
|
283
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
284
|
+
className: classNames([styles.container, (_ref7 = {}, _defineProperty(_ref7, className, className !== null), _defineProperty(_ref7, styles.fullscreen, fullscreen), _ref7)]),
|
|
285
|
+
"data-screen-ready": isStatic || isCapture || ready
|
|
286
|
+
}, !isPlaceholder ? /*#__PURE__*/React.createElement(Background, {
|
|
287
|
+
background: background,
|
|
288
|
+
width: width,
|
|
289
|
+
height: height,
|
|
290
|
+
resolution: resolution,
|
|
291
|
+
playing: backgroundPlaying,
|
|
292
|
+
shouldLoad: mediaShouldLoad,
|
|
293
|
+
withoutVideo: isPreview
|
|
294
|
+
}) : null, /*#__PURE__*/React.createElement(Container, {
|
|
295
|
+
width: width,
|
|
296
|
+
height: height
|
|
297
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
298
|
+
className: styles.content
|
|
299
|
+
}, /*#__PURE__*/React.createElement(ScreenElement, {
|
|
289
300
|
key: "video",
|
|
290
301
|
placeholder: /*#__PURE__*/React.createElement(PlaceholderVideo, Object.assign({
|
|
291
302
|
className: styles.placeholder
|
|
@@ -342,7 +353,7 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
342
353
|
key: "bottom-content",
|
|
343
354
|
className: styles.bottom,
|
|
344
355
|
style: {
|
|
345
|
-
transform: current && !isPreview ? "
|
|
356
|
+
transform: current && !isPreview ? "translate3d(0, -".concat(viewerBottomHeight, "px, 0)") : null,
|
|
346
357
|
paddingLeft: Math.max(spacing / 2, viewerBottomSidesWidth),
|
|
347
358
|
paddingRight: Math.max(spacing / 2, viewerBottomSidesWidth),
|
|
348
359
|
paddingBottom: spacing / 2,
|
|
@@ -357,24 +368,7 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
357
368
|
animationDisabled: isPreview,
|
|
358
369
|
focusable: current && isView,
|
|
359
370
|
openWebView: openWebView
|
|
360
|
-
})) : null) : null
|
|
361
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
362
|
-
className: classNames([styles.container, (_ref7 = {}, _defineProperty(_ref7, className, className !== null), _defineProperty(_ref7, styles.fullscreen, fullscreen), _ref7)]),
|
|
363
|
-
"data-screen-ready": isStatic || isCapture || ready
|
|
364
|
-
}, !isPlaceholder ? /*#__PURE__*/React.createElement(Background, {
|
|
365
|
-
background: background,
|
|
366
|
-
width: width,
|
|
367
|
-
height: height,
|
|
368
|
-
resolution: resolution,
|
|
369
|
-
playing: backgroundPlaying,
|
|
370
|
-
shouldLoad: mediaShouldLoad,
|
|
371
|
-
withoutVideo: isPreview
|
|
372
|
-
}) : null, /*#__PURE__*/React.createElement(Container, {
|
|
373
|
-
width: width,
|
|
374
|
-
height: height
|
|
375
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
376
|
-
className: styles.content
|
|
377
|
-
}, items)));
|
|
371
|
+
})) : null) : null)));
|
|
378
372
|
};
|
|
379
373
|
|
|
380
374
|
VideoScreen.propTypes = propTypes;
|
package/lib/index.js
CHANGED
|
@@ -77,9 +77,8 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
77
77
|
background = _ref.background,
|
|
78
78
|
callToAction = _ref.callToAction,
|
|
79
79
|
current = _ref.current,
|
|
80
|
-
active = _ref.active
|
|
81
|
-
_ref.
|
|
82
|
-
var spacing = _ref.spacing,
|
|
80
|
+
active = _ref.active,
|
|
81
|
+
spacing = _ref.spacing,
|
|
83
82
|
customMediaRef = _ref.mediaRef,
|
|
84
83
|
className = _ref.className;
|
|
85
84
|
var trackScreenMedia = hooks.useTrackScreenMedia('video');
|
|
@@ -147,9 +146,7 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
147
146
|
setHasPlayed = _useState2[1];
|
|
148
147
|
|
|
149
148
|
var backgroundPlaying = current && (isView || isEdit);
|
|
150
|
-
var videoPlaying = current && (isView || isEdit) && playing;
|
|
151
|
-
// isPreview || isCapture || (isView && active && !current && !hasPlayed);
|
|
152
|
-
|
|
149
|
+
var videoPlaying = current && (isView || isEdit) && playing;
|
|
153
150
|
var shouldDisplayPoster = isPreview || isCapture;
|
|
154
151
|
React.useEffect(function () {
|
|
155
152
|
if (!current) {
|
|
@@ -188,22 +185,19 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
188
185
|
|
|
189
186
|
var _useActivityDetector = hooks.useActivityDetector({
|
|
190
187
|
element: viewerContainer,
|
|
191
|
-
disabled: !
|
|
188
|
+
disabled: !isView,
|
|
192
189
|
timeout: 2000
|
|
193
190
|
}),
|
|
194
191
|
activityDetected = _useActivityDetector.detected;
|
|
195
192
|
|
|
196
|
-
React.
|
|
197
|
-
if (!current) {
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
|
|
193
|
+
var toggleControlsVisibility = React.useCallback(function () {
|
|
201
194
|
if (activityDetected) {
|
|
202
195
|
showControls();
|
|
203
196
|
} else {
|
|
204
197
|
hideControls();
|
|
205
198
|
}
|
|
206
|
-
}, [activityDetected, showControls, hideControls]);
|
|
199
|
+
}, [activityDetected, showControls, hideControls]);
|
|
200
|
+
hooks.useDebounce(toggleControlsVisibility, activityDetected, 1000);
|
|
207
201
|
|
|
208
202
|
var _useState3 = React.useState(null),
|
|
209
203
|
_useState4 = _slicedToArray__default["default"](_useState3, 2),
|
|
@@ -258,7 +252,8 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
258
252
|
var _useState7 = React.useState(hasVideo),
|
|
259
253
|
_useState8 = _slicedToArray__default["default"](_useState7, 2),
|
|
260
254
|
ready = _useState8[0],
|
|
261
|
-
setReady = _useState8[1];
|
|
255
|
+
setReady = _useState8[1];
|
|
256
|
+
|
|
262
257
|
var finalVideo = React.useMemo(function () {
|
|
263
258
|
return hasVideo ? _objectSpread__default["default"](_objectSpread__default["default"]({}, video), {}, {
|
|
264
259
|
autoPlay: !isPreview && !isStatic && !isCapture && autoPlay && current
|
|
@@ -305,7 +300,23 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
305
300
|
setPlaying(false);
|
|
306
301
|
}
|
|
307
302
|
}, [current, playing, setPlaying]);
|
|
308
|
-
|
|
303
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
304
|
+
className: classNames__default["default"]([styles.container, (_ref7 = {}, _defineProperty__default["default"](_ref7, className, className !== null), _defineProperty__default["default"](_ref7, styles.fullscreen, fullscreen), _ref7)]),
|
|
305
|
+
"data-screen-ready": isStatic || isCapture || ready
|
|
306
|
+
}, !isPlaceholder ? /*#__PURE__*/React__default["default"].createElement(Background__default["default"], {
|
|
307
|
+
background: background,
|
|
308
|
+
width: width,
|
|
309
|
+
height: height,
|
|
310
|
+
resolution: resolution,
|
|
311
|
+
playing: backgroundPlaying,
|
|
312
|
+
shouldLoad: mediaShouldLoad,
|
|
313
|
+
withoutVideo: isPreview
|
|
314
|
+
}) : null, /*#__PURE__*/React__default["default"].createElement(Container__default["default"], {
|
|
315
|
+
width: width,
|
|
316
|
+
height: height
|
|
317
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
318
|
+
className: styles.content
|
|
319
|
+
}, /*#__PURE__*/React__default["default"].createElement(components.ScreenElement, {
|
|
309
320
|
key: "video",
|
|
310
321
|
placeholder: /*#__PURE__*/React__default["default"].createElement(components.PlaceholderVideo, Object.assign({
|
|
311
322
|
className: styles.placeholder
|
|
@@ -362,7 +373,7 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
362
373
|
key: "bottom-content",
|
|
363
374
|
className: styles.bottom,
|
|
364
375
|
style: {
|
|
365
|
-
transform: current && !isPreview ? "
|
|
376
|
+
transform: current && !isPreview ? "translate3d(0, -".concat(viewerBottomHeight, "px, 0)") : null,
|
|
366
377
|
paddingLeft: Math.max(spacing / 2, viewerBottomSidesWidth),
|
|
367
378
|
paddingRight: Math.max(spacing / 2, viewerBottomSidesWidth),
|
|
368
379
|
paddingBottom: spacing / 2,
|
|
@@ -377,24 +388,7 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
377
388
|
animationDisabled: isPreview,
|
|
378
389
|
focusable: current && isView,
|
|
379
390
|
openWebView: openWebView
|
|
380
|
-
})) : null) : null
|
|
381
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
382
|
-
className: classNames__default["default"]([styles.container, (_ref7 = {}, _defineProperty__default["default"](_ref7, className, className !== null), _defineProperty__default["default"](_ref7, styles.fullscreen, fullscreen), _ref7)]),
|
|
383
|
-
"data-screen-ready": isStatic || isCapture || ready
|
|
384
|
-
}, !isPlaceholder ? /*#__PURE__*/React__default["default"].createElement(Background__default["default"], {
|
|
385
|
-
background: background,
|
|
386
|
-
width: width,
|
|
387
|
-
height: height,
|
|
388
|
-
resolution: resolution,
|
|
389
|
-
playing: backgroundPlaying,
|
|
390
|
-
shouldLoad: mediaShouldLoad,
|
|
391
|
-
withoutVideo: isPreview
|
|
392
|
-
}) : null, /*#__PURE__*/React__default["default"].createElement(Container__default["default"], {
|
|
393
|
-
width: width,
|
|
394
|
-
height: height
|
|
395
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
396
|
-
className: styles.content
|
|
397
|
-
}, items)));
|
|
391
|
+
})) : null) : null)));
|
|
398
392
|
};
|
|
399
393
|
|
|
400
394
|
VideoScreen.propTypes = propTypes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-video",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.225",
|
|
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.
|
|
54
|
-
"@micromag/element-background": "^0.3.
|
|
55
|
-
"@micromag/element-call-to-action": "^0.3.
|
|
56
|
-
"@micromag/element-closed-captions": "^0.3.
|
|
57
|
-
"@micromag/element-container": "^0.3.
|
|
58
|
-
"@micromag/element-image": "^0.3.
|
|
59
|
-
"@micromag/element-media-controls": "^0.3.
|
|
60
|
-
"@micromag/element-video": "^0.3.
|
|
61
|
-
"@micromag/transforms": "^0.3.
|
|
53
|
+
"@micromag/core": "^0.3.225",
|
|
54
|
+
"@micromag/element-background": "^0.3.225",
|
|
55
|
+
"@micromag/element-call-to-action": "^0.3.225",
|
|
56
|
+
"@micromag/element-closed-captions": "^0.3.225",
|
|
57
|
+
"@micromag/element-container": "^0.3.225",
|
|
58
|
+
"@micromag/element-image": "^0.3.225",
|
|
59
|
+
"@micromag/element-media-controls": "^0.3.225",
|
|
60
|
+
"@micromag/element-video": "^0.3.225",
|
|
61
|
+
"@micromag/transforms": "^0.3.225",
|
|
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": "
|
|
71
|
+
"gitHead": "ef19a3d7ea1ad515a13840ebe2602f2d517b6c9e"
|
|
72
72
|
}
|