@micromag/screen-video 0.2.371 → 0.2.382
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/es/index.js +15 -4
- package/lib/index.js +14 -3
- package/package.json +11 -11
package/es/index.js
CHANGED
|
@@ -2,7 +2,7 @@ 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, useState, useCallback,
|
|
5
|
+
import React, { useRef, useEffect, useState, useCallback, useMemo } from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import { getSizeWithinBounds } from '@folklore/size';
|
|
@@ -31,6 +31,7 @@ var propTypes = {
|
|
|
31
31
|
// active: PropTypes.bool,
|
|
32
32
|
transitions: PropTypes$1.transitions,
|
|
33
33
|
spacing: PropTypes.number,
|
|
34
|
+
getMediaRef: PropTypes.func,
|
|
34
35
|
className: PropTypes.string
|
|
35
36
|
};
|
|
36
37
|
var defaultProps = {
|
|
@@ -42,6 +43,7 @@ var defaultProps = {
|
|
|
42
43
|
// active: true,
|
|
43
44
|
transitions: null,
|
|
44
45
|
spacing: 20,
|
|
46
|
+
getMediaRef: null,
|
|
45
47
|
className: null
|
|
46
48
|
};
|
|
47
49
|
|
|
@@ -55,6 +57,7 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
55
57
|
current = _ref.current,
|
|
56
58
|
transitions = _ref.transitions,
|
|
57
59
|
spacing = _ref.spacing,
|
|
60
|
+
getMediaRef = _ref.getMediaRef,
|
|
58
61
|
className = _ref.className;
|
|
59
62
|
var trackScreenMedia = useTrackScreenMedia('video');
|
|
60
63
|
|
|
@@ -78,8 +81,15 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
78
81
|
toggleMute = _ref2.toggleMute,
|
|
79
82
|
seek = _ref2.seek,
|
|
80
83
|
play = _ref2.play,
|
|
81
|
-
pause = _ref2.pause
|
|
84
|
+
pause = _ref2.pause,
|
|
85
|
+
_ref2$mediaRef = _ref2.mediaRef,
|
|
86
|
+
apiMediaRef = _ref2$mediaRef === void 0 ? null : _ref2$mediaRef;
|
|
82
87
|
|
|
88
|
+
useEffect(function () {
|
|
89
|
+
if (apiMediaRef !== null && getMediaRef !== null) {
|
|
90
|
+
getMediaRef(apiMediaRef.current);
|
|
91
|
+
}
|
|
92
|
+
}, [apiMediaRef, getMediaRef]); // Get api state updates from callback
|
|
83
93
|
|
|
84
94
|
var _useState = useState(null),
|
|
85
95
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -149,10 +159,11 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
149
159
|
var hasCallToAction = callToAction !== null && callToAction.active === true;
|
|
150
160
|
var hasVideo = video !== null;
|
|
151
161
|
|
|
152
|
-
var _useState9 = useState(
|
|
162
|
+
var _useState9 = useState(hasVideo),
|
|
153
163
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
154
164
|
ready = _useState10[0],
|
|
155
|
-
setReady = _useState10[1];
|
|
165
|
+
setReady = _useState10[1]; // useState(!hasVideo);
|
|
166
|
+
|
|
156
167
|
|
|
157
168
|
var transitionPlaying = current && ready;
|
|
158
169
|
var transitionDisabled = isStatic || isCapture || isPlaceholder || isPreview || isEdit; // get resized video style props
|
package/lib/index.js
CHANGED
|
@@ -52,6 +52,7 @@ var propTypes = {
|
|
|
52
52
|
// active: PropTypes.bool,
|
|
53
53
|
transitions: core.PropTypes.transitions,
|
|
54
54
|
spacing: PropTypes__default["default"].number,
|
|
55
|
+
getMediaRef: PropTypes__default["default"].func,
|
|
55
56
|
className: PropTypes__default["default"].string
|
|
56
57
|
};
|
|
57
58
|
var defaultProps = {
|
|
@@ -63,6 +64,7 @@ var defaultProps = {
|
|
|
63
64
|
// active: true,
|
|
64
65
|
transitions: null,
|
|
65
66
|
spacing: 20,
|
|
67
|
+
getMediaRef: null,
|
|
66
68
|
className: null
|
|
67
69
|
};
|
|
68
70
|
|
|
@@ -76,6 +78,7 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
76
78
|
current = _ref.current,
|
|
77
79
|
transitions = _ref.transitions,
|
|
78
80
|
spacing = _ref.spacing,
|
|
81
|
+
getMediaRef = _ref.getMediaRef,
|
|
79
82
|
className = _ref.className;
|
|
80
83
|
var trackScreenMedia = hooks.useTrackScreenMedia('video');
|
|
81
84
|
|
|
@@ -99,8 +102,15 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
99
102
|
toggleMute = _ref2.toggleMute,
|
|
100
103
|
seek = _ref2.seek,
|
|
101
104
|
play = _ref2.play,
|
|
102
|
-
pause = _ref2.pause
|
|
105
|
+
pause = _ref2.pause,
|
|
106
|
+
_ref2$mediaRef = _ref2.mediaRef,
|
|
107
|
+
apiMediaRef = _ref2$mediaRef === void 0 ? null : _ref2$mediaRef;
|
|
103
108
|
|
|
109
|
+
React.useEffect(function () {
|
|
110
|
+
if (apiMediaRef !== null && getMediaRef !== null) {
|
|
111
|
+
getMediaRef(apiMediaRef.current);
|
|
112
|
+
}
|
|
113
|
+
}, [apiMediaRef, getMediaRef]); // Get api state updates from callback
|
|
104
114
|
|
|
105
115
|
var _useState = React.useState(null),
|
|
106
116
|
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
@@ -170,10 +180,11 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
170
180
|
var hasCallToAction = callToAction !== null && callToAction.active === true;
|
|
171
181
|
var hasVideo = video !== null;
|
|
172
182
|
|
|
173
|
-
var _useState9 = React.useState(
|
|
183
|
+
var _useState9 = React.useState(hasVideo),
|
|
174
184
|
_useState10 = _slicedToArray__default["default"](_useState9, 2),
|
|
175
185
|
ready = _useState10[0],
|
|
176
|
-
setReady = _useState10[1];
|
|
186
|
+
setReady = _useState10[1]; // useState(!hasVideo);
|
|
187
|
+
|
|
177
188
|
|
|
178
189
|
var transitionPlaying = current && ready;
|
|
179
190
|
var transitionDisabled = isStatic || isCapture || isPlaceholder || isPreview || isEdit; // get resized video style props
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-video",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.382",
|
|
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.2.
|
|
54
|
-
"@micromag/element-background": "^0.2.
|
|
55
|
-
"@micromag/element-call-to-action": "^0.2.
|
|
56
|
-
"@micromag/element-closed-captions": "^0.2.
|
|
57
|
-
"@micromag/element-container": "^0.2.
|
|
58
|
-
"@micromag/element-image": "^0.2.
|
|
59
|
-
"@micromag/element-media-controls": "^0.2.
|
|
60
|
-
"@micromag/element-video": "^0.2.
|
|
61
|
-
"@micromag/transforms": "^0.2.
|
|
53
|
+
"@micromag/core": "^0.2.379",
|
|
54
|
+
"@micromag/element-background": "^0.2.379",
|
|
55
|
+
"@micromag/element-call-to-action": "^0.2.379",
|
|
56
|
+
"@micromag/element-closed-captions": "^0.2.379",
|
|
57
|
+
"@micromag/element-container": "^0.2.379",
|
|
58
|
+
"@micromag/element-image": "^0.2.379",
|
|
59
|
+
"@micromag/element-media-controls": "^0.2.379",
|
|
60
|
+
"@micromag/element-video": "^0.2.379",
|
|
61
|
+
"@micromag/transforms": "^0.2.379",
|
|
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": "45fb095754e40c8cc89b4e0ed04c69c04b1033dc"
|
|
72
72
|
}
|