@micromag/screen-video 0.2.412 → 0.3.0
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 +54 -29
- package/lib/index.js +59 -34
- package/package.json +11 -11
package/assets/css/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.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{overflow:hidden}.micromag-screen-video-container .micromag-screen-video-mediaControls{padding:10px 20px 20px}.micromag-screen-video-container .micromag-screen-video-placeholder{display:-webkit-flex;display:-ms-flexbox;display:flex
|
|
1
|
+
.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{overflow:hidden}.micromag-screen-video-container .micromag-screen-video-mediaControls{padding:10px 20px 20px;opacity:0;-webkit-transition:opacity .3s linear;-o-transition:opacity .3s linear;transition:opacity .3s linear}.micromag-screen-video-container .micromag-screen-video-mediaControls.micromag-screen-video-visible{opacity:1}.micromag-screen-video-container .micromag-screen-video-placeholder{display:-webkit-flex;display:-ms-flexbox;display:flex;height:100%;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center}.micromag-screen-video-container .micromag-screen-video-videoContainer{position:absolute}.micromag-screen-video-container .micromag-screen-video-bottomContent{position:absolute;bottom:0;width:100%}.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}
|
package/es/index.js
CHANGED
|
@@ -2,25 +2,25 @@ import { FormattedMessage, defineMessage } from 'react-intl';
|
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
3
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
4
4
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
5
|
-
import React, { useRef, useEffect, useState, useCallback, useMemo } from 'react';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import classNames from 'classnames';
|
|
8
5
|
import { getSizeWithinBounds } from '@folklore/size';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import React, { useRef, 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
11
|
import { useScreenSize, useScreenRenderContext, useViewerNavigation } from '@micromag/core/contexts';
|
|
12
12
|
import { useTrackScreenMedia, useLongPress } from '@micromag/core/hooks';
|
|
13
13
|
import Background from '@micromag/element-background';
|
|
14
|
-
import
|
|
14
|
+
import CallToAction from '@micromag/element-call-to-action';
|
|
15
15
|
import ClosedCaptions from '@micromag/element-closed-captions';
|
|
16
|
-
import
|
|
16
|
+
import Container from '@micromag/element-container';
|
|
17
17
|
import Image from '@micromag/element-image';
|
|
18
|
+
import MediaControls from '@micromag/element-media-controls';
|
|
18
19
|
import Video from '@micromag/element-video';
|
|
19
|
-
import CallToAction from '@micromag/element-call-to-action';
|
|
20
20
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
21
21
|
import { Video as Video$1, Container as Container$1 } from '@micromag/transforms/apple-news';
|
|
22
22
|
|
|
23
|
-
var styles = {"container":"micromag-screen-video-container","content":"micromag-screen-video-content","empty":"micromag-screen-video-empty","emptyContainer":"micromag-screen-video-emptyContainer","fullscreen":"micromag-screen-video-fullscreen","image":"micromag-screen-video-image","placeholder":"micromag-screen-video-placeholder","video":"micromag-screen-video-video","disabled":"micromag-screen-video-disabled","hidden":"micromag-screen-video-hidden","mediaControls":"micromag-screen-video-mediaControls","videoContainer":"micromag-screen-video-videoContainer","bottomContent":"micromag-screen-video-bottomContent"};
|
|
23
|
+
var styles = {"container":"micromag-screen-video-container","content":"micromag-screen-video-content","empty":"micromag-screen-video-empty","emptyContainer":"micromag-screen-video-emptyContainer","fullscreen":"micromag-screen-video-fullscreen","image":"micromag-screen-video-image","placeholder":"micromag-screen-video-placeholder","video":"micromag-screen-video-video","disabled":"micromag-screen-video-disabled","hidden":"micromag-screen-video-hidden","mediaControls":"micromag-screen-video-mediaControls","visible":"micromag-screen-video-visible","videoContainer":"micromag-screen-video-videoContainer","bottomContent":"micromag-screen-video-bottomContent"};
|
|
24
24
|
|
|
25
25
|
var propTypes = {
|
|
26
26
|
layout: PropTypes.oneOf(['middle', 'full']),
|
|
@@ -50,7 +50,7 @@ var defaultProps = {
|
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
var VideoScreen = function VideoScreen(_ref) {
|
|
53
|
-
var
|
|
53
|
+
var _ref9;
|
|
54
54
|
|
|
55
55
|
var layout = _ref.layout,
|
|
56
56
|
video = _ref.video,
|
|
@@ -99,27 +99,34 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
99
99
|
if (apiMediaRef !== null && getMediaRef !== null) {
|
|
100
100
|
getMediaRef(apiMediaRef.current);
|
|
101
101
|
}
|
|
102
|
-
}, [apiMediaRef, getMediaRef]);
|
|
102
|
+
}, [apiMediaRef, getMediaRef]);
|
|
103
|
+
var mouseMoveRef = useRef(null);
|
|
103
104
|
|
|
104
|
-
var _useState = useState(
|
|
105
|
+
var _useState = useState(false),
|
|
105
106
|
_useState2 = _slicedToArray(_useState, 2),
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
showMediaControls = _useState2[0],
|
|
108
|
+
setShowMediaControls = _useState2[1]; // Get api state updates from callback
|
|
109
|
+
|
|
108
110
|
|
|
109
111
|
var _useState3 = useState(null),
|
|
110
112
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
currentTime = _useState4[0],
|
|
114
|
+
setCurrentTime = _useState4[1];
|
|
113
115
|
|
|
114
|
-
var _useState5 = useState(
|
|
116
|
+
var _useState5 = useState(null),
|
|
115
117
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
116
|
-
|
|
117
|
-
|
|
118
|
+
duration = _useState6[0],
|
|
119
|
+
setDuration = _useState6[1];
|
|
118
120
|
|
|
119
121
|
var _useState7 = useState(false),
|
|
120
122
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
playing = _useState8[0],
|
|
124
|
+
setPlaying = _useState8[1];
|
|
125
|
+
|
|
126
|
+
var _useState9 = useState(false),
|
|
127
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
128
|
+
muted = _useState10[0],
|
|
129
|
+
setMuted = _useState10[1];
|
|
123
130
|
|
|
124
131
|
var onTimeUpdate = useCallback(function (time) {
|
|
125
132
|
setCurrentTime(time);
|
|
@@ -165,19 +172,32 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
165
172
|
if (!current && playing) {
|
|
166
173
|
pause();
|
|
167
174
|
}
|
|
168
|
-
}, [playing, current]);
|
|
175
|
+
}, [playing, current]);
|
|
176
|
+
var onMouseMove = useCallback(function () {
|
|
177
|
+
setShowMediaControls(true);
|
|
178
|
+
|
|
179
|
+
if (mouseMoveRef.current !== null) {
|
|
180
|
+
clearTimeout(mouseMoveRef.current);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
mouseMoveRef.current = setTimeout(function () {
|
|
184
|
+
setShowMediaControls(false);
|
|
185
|
+
mouseMoveRef.current = null;
|
|
186
|
+
}, 1800);
|
|
187
|
+
}, [setShowMediaControls]); // ------------------------------------
|
|
169
188
|
|
|
170
189
|
var longPressBind = useLongPress({
|
|
171
|
-
onLongPress: togglePlay
|
|
190
|
+
onLongPress: togglePlay,
|
|
191
|
+
onClick: onMouseMove
|
|
172
192
|
});
|
|
173
193
|
var fullscreen = layout === 'full';
|
|
174
194
|
var hasCallToAction = callToAction !== null && callToAction.active === true;
|
|
175
195
|
var hasVideo = video !== null;
|
|
176
196
|
|
|
177
|
-
var
|
|
178
|
-
|
|
179
|
-
ready =
|
|
180
|
-
setReady =
|
|
197
|
+
var _useState11 = useState(hasVideo),
|
|
198
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
199
|
+
ready = _useState12[0],
|
|
200
|
+
setReady = _useState12[1]; // useState(!hasVideo);
|
|
181
201
|
|
|
182
202
|
|
|
183
203
|
var transitionPlaying = current && ready;
|
|
@@ -193,7 +213,9 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
193
213
|
_ref5$withSeekBar = _ref5.withSeekBar,
|
|
194
214
|
withSeekBar = _ref5$withSeekBar === void 0 ? false : _ref5$withSeekBar,
|
|
195
215
|
_ref5$withPlayPause = _ref5.withPlayPause,
|
|
196
|
-
withPlayPause = _ref5$withPlayPause === void 0 ? false : _ref5$withPlayPause
|
|
216
|
+
withPlayPause = _ref5$withPlayPause === void 0 ? false : _ref5$withPlayPause,
|
|
217
|
+
_ref5$withTime = _ref5.withTime,
|
|
218
|
+
withTime = _ref5$withTime === void 0 ? false : _ref5$withTime;
|
|
197
219
|
|
|
198
220
|
var finalVideo = useMemo(function () {
|
|
199
221
|
return hasVideo ? _objectSpread(_objectSpread({}, video), {}, {
|
|
@@ -307,9 +329,10 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
307
329
|
media: closedCaptions,
|
|
308
330
|
currentTime: currentTime
|
|
309
331
|
}) : null, hasVideoUrl ? /*#__PURE__*/React.createElement(MediaControls, {
|
|
310
|
-
className: styles.mediaControls,
|
|
332
|
+
className: classNames([styles.mediaControls, _defineProperty({}, styles.visible, !autoPlay && !playing || muted || showMediaControls)]),
|
|
311
333
|
withSeekBar: withSeekBar,
|
|
312
334
|
withPlayPause: withPlayPause,
|
|
335
|
+
withTime: withTime,
|
|
313
336
|
playing: playing,
|
|
314
337
|
muted: muted,
|
|
315
338
|
currentTime: currentTime,
|
|
@@ -328,11 +351,13 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
328
351
|
focusable: current && isView
|
|
329
352
|
})) : null)) : null];
|
|
330
353
|
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
331
|
-
className: classNames([styles.container, (
|
|
354
|
+
className: classNames([styles.container, (_ref9 = {}, _defineProperty(_ref9, className, className !== null), _defineProperty(_ref9, styles.fullscreen, fullscreen), _ref9)]),
|
|
332
355
|
"data-screen-ready": isStatic || isCapture
|
|
333
356
|
/* && posterReady */
|
|
334
357
|
|| ready
|
|
335
|
-
}, longPressBind
|
|
358
|
+
}, longPressBind, {
|
|
359
|
+
onMouseMove: onMouseMove
|
|
360
|
+
}), !isPlaceholder ? /*#__PURE__*/React.createElement(Background, {
|
|
336
361
|
background: background,
|
|
337
362
|
width: width,
|
|
338
363
|
height: height,
|
package/lib/index.js
CHANGED
|
@@ -6,21 +6,21 @@ var reactIntl = require('react-intl');
|
|
|
6
6
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
7
|
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
8
8
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
9
|
-
var React = require('react');
|
|
10
|
-
var PropTypes = require('prop-types');
|
|
11
|
-
var classNames = require('classnames');
|
|
12
9
|
var size = require('@folklore/size');
|
|
10
|
+
var classNames = require('classnames');
|
|
11
|
+
var PropTypes = require('prop-types');
|
|
12
|
+
var React = require('react');
|
|
13
13
|
var core = require('@micromag/core');
|
|
14
14
|
var components = require('@micromag/core/components');
|
|
15
15
|
var contexts = require('@micromag/core/contexts');
|
|
16
16
|
var hooks = require('@micromag/core/hooks');
|
|
17
17
|
var Background = require('@micromag/element-background');
|
|
18
|
-
var
|
|
18
|
+
var CallToAction = require('@micromag/element-call-to-action');
|
|
19
19
|
var ClosedCaptions = require('@micromag/element-closed-captions');
|
|
20
|
-
var
|
|
20
|
+
var Container = require('@micromag/element-container');
|
|
21
21
|
var Image = require('@micromag/element-image');
|
|
22
|
+
var MediaControls = require('@micromag/element-media-controls');
|
|
22
23
|
var Video = require('@micromag/element-video');
|
|
23
|
-
var CallToAction = require('@micromag/element-call-to-action');
|
|
24
24
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
25
25
|
var appleNews = require('@micromag/transforms/apple-news');
|
|
26
26
|
|
|
@@ -29,19 +29,19 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
29
29
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
30
30
|
var _objectSpread__default = /*#__PURE__*/_interopDefaultLegacy(_objectSpread);
|
|
31
31
|
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
32
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
33
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
34
32
|
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
33
|
+
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
34
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
35
35
|
var Background__default = /*#__PURE__*/_interopDefaultLegacy(Background);
|
|
36
|
-
var
|
|
36
|
+
var CallToAction__default = /*#__PURE__*/_interopDefaultLegacy(CallToAction);
|
|
37
37
|
var ClosedCaptions__default = /*#__PURE__*/_interopDefaultLegacy(ClosedCaptions);
|
|
38
|
-
var
|
|
38
|
+
var Container__default = /*#__PURE__*/_interopDefaultLegacy(Container);
|
|
39
39
|
var Image__default = /*#__PURE__*/_interopDefaultLegacy(Image);
|
|
40
|
+
var MediaControls__default = /*#__PURE__*/_interopDefaultLegacy(MediaControls);
|
|
40
41
|
var Video__default = /*#__PURE__*/_interopDefaultLegacy(Video);
|
|
41
|
-
var CallToAction__default = /*#__PURE__*/_interopDefaultLegacy(CallToAction);
|
|
42
42
|
var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
|
|
43
43
|
|
|
44
|
-
var styles = {"container":"micromag-screen-video-container","content":"micromag-screen-video-content","empty":"micromag-screen-video-empty","emptyContainer":"micromag-screen-video-emptyContainer","fullscreen":"micromag-screen-video-fullscreen","image":"micromag-screen-video-image","placeholder":"micromag-screen-video-placeholder","video":"micromag-screen-video-video","disabled":"micromag-screen-video-disabled","hidden":"micromag-screen-video-hidden","mediaControls":"micromag-screen-video-mediaControls","videoContainer":"micromag-screen-video-videoContainer","bottomContent":"micromag-screen-video-bottomContent"};
|
|
44
|
+
var styles = {"container":"micromag-screen-video-container","content":"micromag-screen-video-content","empty":"micromag-screen-video-empty","emptyContainer":"micromag-screen-video-emptyContainer","fullscreen":"micromag-screen-video-fullscreen","image":"micromag-screen-video-image","placeholder":"micromag-screen-video-placeholder","video":"micromag-screen-video-video","disabled":"micromag-screen-video-disabled","hidden":"micromag-screen-video-hidden","mediaControls":"micromag-screen-video-mediaControls","visible":"micromag-screen-video-visible","videoContainer":"micromag-screen-video-videoContainer","bottomContent":"micromag-screen-video-bottomContent"};
|
|
45
45
|
|
|
46
46
|
var propTypes = {
|
|
47
47
|
layout: PropTypes__default["default"].oneOf(['middle', 'full']),
|
|
@@ -71,7 +71,7 @@ var defaultProps = {
|
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
var VideoScreen = function VideoScreen(_ref) {
|
|
74
|
-
var
|
|
74
|
+
var _ref9;
|
|
75
75
|
|
|
76
76
|
var layout = _ref.layout,
|
|
77
77
|
video = _ref.video,
|
|
@@ -120,27 +120,34 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
120
120
|
if (apiMediaRef !== null && getMediaRef !== null) {
|
|
121
121
|
getMediaRef(apiMediaRef.current);
|
|
122
122
|
}
|
|
123
|
-
}, [apiMediaRef, getMediaRef]);
|
|
123
|
+
}, [apiMediaRef, getMediaRef]);
|
|
124
|
+
var mouseMoveRef = React.useRef(null);
|
|
124
125
|
|
|
125
|
-
var _useState = React.useState(
|
|
126
|
+
var _useState = React.useState(false),
|
|
126
127
|
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
127
|
-
|
|
128
|
-
|
|
128
|
+
showMediaControls = _useState2[0],
|
|
129
|
+
setShowMediaControls = _useState2[1]; // Get api state updates from callback
|
|
130
|
+
|
|
129
131
|
|
|
130
132
|
var _useState3 = React.useState(null),
|
|
131
133
|
_useState4 = _slicedToArray__default["default"](_useState3, 2),
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
currentTime = _useState4[0],
|
|
135
|
+
setCurrentTime = _useState4[1];
|
|
134
136
|
|
|
135
|
-
var _useState5 = React.useState(
|
|
137
|
+
var _useState5 = React.useState(null),
|
|
136
138
|
_useState6 = _slicedToArray__default["default"](_useState5, 2),
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
duration = _useState6[0],
|
|
140
|
+
setDuration = _useState6[1];
|
|
139
141
|
|
|
140
142
|
var _useState7 = React.useState(false),
|
|
141
143
|
_useState8 = _slicedToArray__default["default"](_useState7, 2),
|
|
142
|
-
|
|
143
|
-
|
|
144
|
+
playing = _useState8[0],
|
|
145
|
+
setPlaying = _useState8[1];
|
|
146
|
+
|
|
147
|
+
var _useState9 = React.useState(false),
|
|
148
|
+
_useState10 = _slicedToArray__default["default"](_useState9, 2),
|
|
149
|
+
muted = _useState10[0],
|
|
150
|
+
setMuted = _useState10[1];
|
|
144
151
|
|
|
145
152
|
var onTimeUpdate = React.useCallback(function (time) {
|
|
146
153
|
setCurrentTime(time);
|
|
@@ -186,19 +193,32 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
186
193
|
if (!current && playing) {
|
|
187
194
|
pause();
|
|
188
195
|
}
|
|
189
|
-
}, [playing, current]);
|
|
196
|
+
}, [playing, current]);
|
|
197
|
+
var onMouseMove = React.useCallback(function () {
|
|
198
|
+
setShowMediaControls(true);
|
|
199
|
+
|
|
200
|
+
if (mouseMoveRef.current !== null) {
|
|
201
|
+
clearTimeout(mouseMoveRef.current);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
mouseMoveRef.current = setTimeout(function () {
|
|
205
|
+
setShowMediaControls(false);
|
|
206
|
+
mouseMoveRef.current = null;
|
|
207
|
+
}, 1800);
|
|
208
|
+
}, [setShowMediaControls]); // ------------------------------------
|
|
190
209
|
|
|
191
210
|
var longPressBind = hooks.useLongPress({
|
|
192
|
-
onLongPress: togglePlay
|
|
211
|
+
onLongPress: togglePlay,
|
|
212
|
+
onClick: onMouseMove
|
|
193
213
|
});
|
|
194
214
|
var fullscreen = layout === 'full';
|
|
195
215
|
var hasCallToAction = callToAction !== null && callToAction.active === true;
|
|
196
216
|
var hasVideo = video !== null;
|
|
197
217
|
|
|
198
|
-
var
|
|
199
|
-
|
|
200
|
-
ready =
|
|
201
|
-
setReady =
|
|
218
|
+
var _useState11 = React.useState(hasVideo),
|
|
219
|
+
_useState12 = _slicedToArray__default["default"](_useState11, 2),
|
|
220
|
+
ready = _useState12[0],
|
|
221
|
+
setReady = _useState12[1]; // useState(!hasVideo);
|
|
202
222
|
|
|
203
223
|
|
|
204
224
|
var transitionPlaying = current && ready;
|
|
@@ -214,7 +234,9 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
214
234
|
_ref5$withSeekBar = _ref5.withSeekBar,
|
|
215
235
|
withSeekBar = _ref5$withSeekBar === void 0 ? false : _ref5$withSeekBar,
|
|
216
236
|
_ref5$withPlayPause = _ref5.withPlayPause,
|
|
217
|
-
withPlayPause = _ref5$withPlayPause === void 0 ? false : _ref5$withPlayPause
|
|
237
|
+
withPlayPause = _ref5$withPlayPause === void 0 ? false : _ref5$withPlayPause,
|
|
238
|
+
_ref5$withTime = _ref5.withTime,
|
|
239
|
+
withTime = _ref5$withTime === void 0 ? false : _ref5$withTime;
|
|
218
240
|
|
|
219
241
|
var finalVideo = React.useMemo(function () {
|
|
220
242
|
return hasVideo ? _objectSpread__default["default"](_objectSpread__default["default"]({}, video), {}, {
|
|
@@ -328,9 +350,10 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
328
350
|
media: closedCaptions,
|
|
329
351
|
currentTime: currentTime
|
|
330
352
|
}) : null, hasVideoUrl ? /*#__PURE__*/React__default["default"].createElement(MediaControls__default["default"], {
|
|
331
|
-
className: styles.mediaControls,
|
|
353
|
+
className: classNames__default["default"]([styles.mediaControls, _defineProperty__default["default"]({}, styles.visible, !autoPlay && !playing || muted || showMediaControls)]),
|
|
332
354
|
withSeekBar: withSeekBar,
|
|
333
355
|
withPlayPause: withPlayPause,
|
|
356
|
+
withTime: withTime,
|
|
334
357
|
playing: playing,
|
|
335
358
|
muted: muted,
|
|
336
359
|
currentTime: currentTime,
|
|
@@ -349,11 +372,13 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
349
372
|
focusable: current && isView
|
|
350
373
|
})) : null)) : null];
|
|
351
374
|
return /*#__PURE__*/React__default["default"].createElement("div", Object.assign({
|
|
352
|
-
className: classNames__default["default"]([styles.container, (
|
|
375
|
+
className: classNames__default["default"]([styles.container, (_ref9 = {}, _defineProperty__default["default"](_ref9, className, className !== null), _defineProperty__default["default"](_ref9, styles.fullscreen, fullscreen), _ref9)]),
|
|
353
376
|
"data-screen-ready": isStatic || isCapture
|
|
354
377
|
/* && posterReady */
|
|
355
378
|
|| ready
|
|
356
|
-
}, longPressBind
|
|
379
|
+
}, longPressBind, {
|
|
380
|
+
onMouseMove: onMouseMove
|
|
381
|
+
}), !isPlaceholder ? /*#__PURE__*/React__default["default"].createElement(Background__default["default"], {
|
|
357
382
|
background: background,
|
|
358
383
|
width: width,
|
|
359
384
|
height: height,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-video",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
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.15",
|
|
53
|
-
"@micromag/core": "^0.
|
|
54
|
-
"@micromag/element-background": "^0.
|
|
55
|
-
"@micromag/element-call-to-action": "^0.
|
|
56
|
-
"@micromag/element-closed-captions": "^0.
|
|
57
|
-
"@micromag/element-container": "^0.
|
|
58
|
-
"@micromag/element-image": "^0.
|
|
59
|
-
"@micromag/element-media-controls": "^0.
|
|
60
|
-
"@micromag/element-video": "^0.
|
|
61
|
-
"@micromag/transforms": "^0.
|
|
53
|
+
"@micromag/core": "^0.3.0",
|
|
54
|
+
"@micromag/element-background": "^0.3.0",
|
|
55
|
+
"@micromag/element-call-to-action": "^0.3.0",
|
|
56
|
+
"@micromag/element-closed-captions": "^0.3.0",
|
|
57
|
+
"@micromag/element-container": "^0.3.0",
|
|
58
|
+
"@micromag/element-image": "^0.3.0",
|
|
59
|
+
"@micromag/element-media-controls": "^0.3.0",
|
|
60
|
+
"@micromag/element-video": "^0.3.0",
|
|
61
|
+
"@micromag/transforms": "^0.3.0",
|
|
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": "729bcf44dc4f99a2afec77fbdac86454e1cdf79f"
|
|
72
72
|
}
|