@micromag/element-video 0.3.111 → 0.3.117
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 +8 -18
- package/lib/index.js +7 -17
- package/package.json +5 -5
package/es/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import PropTypes$1 from 'prop-types';
|
|
|
6
6
|
import React, { useMemo, useEffect, useRef } from 'react';
|
|
7
7
|
import { PropTypes } from '@micromag/core';
|
|
8
8
|
import { useUserInteracted } from '@micromag/core/contexts';
|
|
9
|
-
import { useMediaApi } from '@micromag/core/hooks';
|
|
9
|
+
import { useMediaThumbnail, useMediaApi } from '@micromag/core/hooks';
|
|
10
10
|
import { getMediaFilesAsArray } from '@micromag/core/utils';
|
|
11
11
|
|
|
12
12
|
var styles = {"container":"micromag-element-video-container","withSize":"micromag-element-video-withSize","video":"micromag-element-video-video"};
|
|
@@ -14,6 +14,7 @@ var styles = {"container":"micromag-element-video-container","withSize":"microma
|
|
|
14
14
|
var _excluded = ["ref"];
|
|
15
15
|
var propTypes = {
|
|
16
16
|
media: PropTypes.videoMedia,
|
|
17
|
+
thumbnailFile: PropTypes$1.string,
|
|
17
18
|
width: PropTypes$1.number,
|
|
18
19
|
height: PropTypes$1.number,
|
|
19
20
|
apiRef: PropTypes$1.oneOfType([PropTypes$1.func, PropTypes$1.shape({
|
|
@@ -42,6 +43,7 @@ var propTypes = {
|
|
|
42
43
|
};
|
|
43
44
|
var defaultProps = {
|
|
44
45
|
media: null,
|
|
46
|
+
thumbnailFile: null,
|
|
45
47
|
width: null,
|
|
46
48
|
height: null,
|
|
47
49
|
apiRef: null,
|
|
@@ -71,6 +73,7 @@ var Video = function Video(_ref) {
|
|
|
71
73
|
var _ref7;
|
|
72
74
|
|
|
73
75
|
var media = _ref.media,
|
|
76
|
+
thumbnailFile = _ref.thumbnailFile,
|
|
74
77
|
width = _ref.width,
|
|
75
78
|
height = _ref.height,
|
|
76
79
|
apiRef = _ref.apiRef,
|
|
@@ -100,9 +103,7 @@ var Video = function Video(_ref) {
|
|
|
100
103
|
_ref2$files = _ref2.files,
|
|
101
104
|
files = _ref2$files === void 0 ? null : _ref2$files,
|
|
102
105
|
_ref2$metadata = _ref2.metadata,
|
|
103
|
-
metadata = _ref2$metadata === void 0 ? null : _ref2$metadata
|
|
104
|
-
_ref2$thumbnail_url = _ref2.thumbnail_url,
|
|
105
|
-
thumbnailUrl = _ref2$thumbnail_url === void 0 ? null : _ref2$thumbnail_url;
|
|
106
|
+
metadata = _ref2$metadata === void 0 ? null : _ref2$metadata;
|
|
106
107
|
|
|
107
108
|
var _ref3 = metadata || {},
|
|
108
109
|
_ref3$description = _ref3.description,
|
|
@@ -112,7 +113,8 @@ var Video = function Video(_ref) {
|
|
|
112
113
|
|
|
113
114
|
var filesArray = useMemo(function () {
|
|
114
115
|
return getMediaFilesAsArray(files);
|
|
115
|
-
}, [files]);
|
|
116
|
+
}, [files]);
|
|
117
|
+
var thumbnailUrl = useMediaThumbnail(media, thumbnailFile); // Get source files with supported mimes
|
|
116
118
|
|
|
117
119
|
var sourceFiles = useMemo(function () {
|
|
118
120
|
if (filesArray.length === 0) {
|
|
@@ -193,19 +195,7 @@ var Video = function Video(_ref) {
|
|
|
193
195
|
onReady();
|
|
194
196
|
}
|
|
195
197
|
}, [dataReady, onReady]);
|
|
196
|
-
var withSize = width !== null && height !== null;
|
|
197
|
-
// useEffect(() => {
|
|
198
|
-
// if (thumbnailUrl !== null) {
|
|
199
|
-
// const img = new Image();
|
|
200
|
-
// img.src = thumbnailUrl;
|
|
201
|
-
// img.onload = () => {
|
|
202
|
-
// if (onPosterLoaded) {
|
|
203
|
-
// onPosterLoaded();
|
|
204
|
-
// }
|
|
205
|
-
// };
|
|
206
|
-
// }
|
|
207
|
-
// }, [thumbnailUrl]);
|
|
208
|
-
|
|
198
|
+
var withSize = width !== null && height !== null;
|
|
209
199
|
useEffect(function () {
|
|
210
200
|
if (autoPlay) {
|
|
211
201
|
play();
|
package/lib/index.js
CHANGED
|
@@ -25,6 +25,7 @@ var styles = {"container":"micromag-element-video-container","withSize":"microma
|
|
|
25
25
|
var _excluded = ["ref"];
|
|
26
26
|
var propTypes = {
|
|
27
27
|
media: core.PropTypes.videoMedia,
|
|
28
|
+
thumbnailFile: PropTypes__default["default"].string,
|
|
28
29
|
width: PropTypes__default["default"].number,
|
|
29
30
|
height: PropTypes__default["default"].number,
|
|
30
31
|
apiRef: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].shape({
|
|
@@ -53,6 +54,7 @@ var propTypes = {
|
|
|
53
54
|
};
|
|
54
55
|
var defaultProps = {
|
|
55
56
|
media: null,
|
|
57
|
+
thumbnailFile: null,
|
|
56
58
|
width: null,
|
|
57
59
|
height: null,
|
|
58
60
|
apiRef: null,
|
|
@@ -82,6 +84,7 @@ var Video = function Video(_ref) {
|
|
|
82
84
|
var _ref7;
|
|
83
85
|
|
|
84
86
|
var media = _ref.media,
|
|
87
|
+
thumbnailFile = _ref.thumbnailFile,
|
|
85
88
|
width = _ref.width,
|
|
86
89
|
height = _ref.height,
|
|
87
90
|
apiRef = _ref.apiRef,
|
|
@@ -111,9 +114,7 @@ var Video = function Video(_ref) {
|
|
|
111
114
|
_ref2$files = _ref2.files,
|
|
112
115
|
files = _ref2$files === void 0 ? null : _ref2$files,
|
|
113
116
|
_ref2$metadata = _ref2.metadata,
|
|
114
|
-
metadata = _ref2$metadata === void 0 ? null : _ref2$metadata
|
|
115
|
-
_ref2$thumbnail_url = _ref2.thumbnail_url,
|
|
116
|
-
thumbnailUrl = _ref2$thumbnail_url === void 0 ? null : _ref2$thumbnail_url;
|
|
117
|
+
metadata = _ref2$metadata === void 0 ? null : _ref2$metadata;
|
|
117
118
|
|
|
118
119
|
var _ref3 = metadata || {},
|
|
119
120
|
_ref3$description = _ref3.description,
|
|
@@ -123,7 +124,8 @@ var Video = function Video(_ref) {
|
|
|
123
124
|
|
|
124
125
|
var filesArray = React.useMemo(function () {
|
|
125
126
|
return utils.getMediaFilesAsArray(files);
|
|
126
|
-
}, [files]);
|
|
127
|
+
}, [files]);
|
|
128
|
+
var thumbnailUrl = hooks.useMediaThumbnail(media, thumbnailFile); // Get source files with supported mimes
|
|
127
129
|
|
|
128
130
|
var sourceFiles = React.useMemo(function () {
|
|
129
131
|
if (filesArray.length === 0) {
|
|
@@ -204,19 +206,7 @@ var Video = function Video(_ref) {
|
|
|
204
206
|
onReady();
|
|
205
207
|
}
|
|
206
208
|
}, [dataReady, onReady]);
|
|
207
|
-
var withSize = width !== null && height !== null;
|
|
208
|
-
// useEffect(() => {
|
|
209
|
-
// if (thumbnailUrl !== null) {
|
|
210
|
-
// const img = new Image();
|
|
211
|
-
// img.src = thumbnailUrl;
|
|
212
|
-
// img.onload = () => {
|
|
213
|
-
// if (onPosterLoaded) {
|
|
214
|
-
// onPosterLoaded();
|
|
215
|
-
// }
|
|
216
|
-
// };
|
|
217
|
-
// }
|
|
218
|
-
// }, [thumbnailUrl]);
|
|
219
|
-
|
|
209
|
+
var withSize = width !== null && height !== null;
|
|
220
210
|
React.useEffect(function () {
|
|
221
211
|
if (autoPlay) {
|
|
222
212
|
play();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-video",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.117",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"@fortawesome/fontawesome-svg-core": "^1.2.32",
|
|
53
53
|
"@fortawesome/free-solid-svg-icons": "^5.15.1",
|
|
54
54
|
"@fortawesome/react-fontawesome": "^0.1.13",
|
|
55
|
-
"@micromag/core": "^0.3.
|
|
56
|
-
"@micromag/element-closed-captions": "^0.3.
|
|
57
|
-
"@micromag/element-media-controls": "^0.3.
|
|
55
|
+
"@micromag/core": "^0.3.117",
|
|
56
|
+
"@micromag/element-closed-captions": "^0.3.117",
|
|
57
|
+
"@micromag/element-media-controls": "^0.3.117",
|
|
58
58
|
"classnames": "^2.2.6",
|
|
59
59
|
"prop-types": "^15.7.2",
|
|
60
60
|
"react-intl": "^5.12.1",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "eab1c9a0b8c19d747fee6472158779f33b1f18d3"
|
|
67
67
|
}
|