@micromag/screen-video 0.2.375 → 0.2.379
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 +12 -2
- package/lib/index.js +11 -1
- 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),
|
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),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-video",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.379",
|
|
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": "b3261cde1fac196f335a2f2b3091494919dd62b2"
|
|
72
72
|
}
|