@micromag/element-video 0.3.215 → 0.3.219
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 +5 -11
- package/lib/index.js +4 -10
- package/package.json +5 -5
package/es/index.js
CHANGED
|
@@ -7,11 +7,10 @@ import PropTypes$1 from 'prop-types';
|
|
|
7
7
|
import React, { useMemo, useRef, useEffect, useCallback, useState } from 'react';
|
|
8
8
|
import { PropTypes } from '@micromag/core';
|
|
9
9
|
import { useMediaThumbnail, useMediaCurrentTime, useMediaDuration, useMediaReady, useProgressSteps } from '@micromag/core/hooks';
|
|
10
|
-
import { getMediaFilesAsArray } from '@micromag/core/utils';
|
|
10
|
+
import { getMediaFilesAsArray, getVideoSupportedMimes } 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"};
|
|
13
13
|
|
|
14
|
-
var supportVideo = document.createElement('video');
|
|
15
14
|
var propTypes = {
|
|
16
15
|
media: PropTypes.videoMedia,
|
|
17
16
|
thumbnail: PropTypes$1.oneOf([PropTypes$1.string, PropTypes.imageMedia]),
|
|
@@ -41,7 +40,6 @@ var propTypes = {
|
|
|
41
40
|
onSuspend: PropTypes$1.func,
|
|
42
41
|
onSuspended: PropTypes$1.func,
|
|
43
42
|
focusable: PropTypes$1.bool,
|
|
44
|
-
supportedMimes: PropTypes$1.arrayOf(PropTypes$1.string),
|
|
45
43
|
withPoster: PropTypes$1.bool // onPosterLoaded: PropTypes.func,
|
|
46
44
|
|
|
47
45
|
};
|
|
@@ -72,7 +70,6 @@ var defaultProps = {
|
|
|
72
70
|
onSuspend: null,
|
|
73
71
|
onSuspended: null,
|
|
74
72
|
focusable: true,
|
|
75
|
-
supportedMimes: ['video/mp4', 'video/webm', 'video/ogg'],
|
|
76
73
|
withPoster: false
|
|
77
74
|
};
|
|
78
75
|
|
|
@@ -105,7 +102,6 @@ var Video = function Video(_ref) {
|
|
|
105
102
|
customOnSuspend = _ref.onSuspend,
|
|
106
103
|
onSuspended = _ref.onSuspended,
|
|
107
104
|
focusable = _ref.focusable,
|
|
108
|
-
supportedMimes = _ref.supportedMimes,
|
|
109
105
|
withPoster = _ref.withPoster;
|
|
110
106
|
|
|
111
107
|
var _ref2 = media || {},
|
|
@@ -151,18 +147,16 @@ var Video = function Video(_ref) {
|
|
|
151
147
|
return null;
|
|
152
148
|
}
|
|
153
149
|
|
|
154
|
-
var
|
|
155
|
-
return supportVideo.canPlayType(mime) !== '';
|
|
156
|
-
});
|
|
150
|
+
var supportedMimes = getVideoSupportedMimes();
|
|
157
151
|
|
|
158
|
-
if (
|
|
152
|
+
if (supportedMimes.length === 0) {
|
|
159
153
|
return null;
|
|
160
154
|
}
|
|
161
155
|
|
|
162
156
|
var sourceFilesMap = filesArray.filter(function (file) {
|
|
163
157
|
var _file$mime = file.mime,
|
|
164
158
|
mime = _file$mime === void 0 ? "video/".concat(file.id === 'h264' ? 'mp4' : file.id) : _file$mime;
|
|
165
|
-
return
|
|
159
|
+
return supportedMimes.indexOf(mime) !== -1;
|
|
166
160
|
}).reduce(function (filesMap, file) {
|
|
167
161
|
var _file$mime2 = file.mime,
|
|
168
162
|
mime = _file$mime2 === void 0 ? "video/".concat(file.id === 'h264' ? 'mp4' : file.id) : _file$mime2;
|
|
@@ -177,7 +171,7 @@ var Video = function Video(_ref) {
|
|
|
177
171
|
return Object.keys(sourceFilesMap).map(function (mime) {
|
|
178
172
|
return sourceFilesMap[mime];
|
|
179
173
|
});
|
|
180
|
-
}, [filesArray
|
|
174
|
+
}, [filesArray]); // @NOTE: Media is an animated image and doesn't have source files in video formats
|
|
181
175
|
|
|
182
176
|
var _ref5 = filesArray.find(function (_ref6) {
|
|
183
177
|
var handle = _ref6.handle;
|
package/lib/index.js
CHANGED
|
@@ -23,7 +23,6 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
23
23
|
|
|
24
24
|
var styles = {"container":"micromag-element-video-container","withSize":"micromag-element-video-withSize","video":"micromag-element-video-video"};
|
|
25
25
|
|
|
26
|
-
var supportVideo = document.createElement('video');
|
|
27
26
|
var propTypes = {
|
|
28
27
|
media: core.PropTypes.videoMedia,
|
|
29
28
|
thumbnail: PropTypes__default["default"].oneOf([PropTypes__default["default"].string, core.PropTypes.imageMedia]),
|
|
@@ -53,7 +52,6 @@ var propTypes = {
|
|
|
53
52
|
onSuspend: PropTypes__default["default"].func,
|
|
54
53
|
onSuspended: PropTypes__default["default"].func,
|
|
55
54
|
focusable: PropTypes__default["default"].bool,
|
|
56
|
-
supportedMimes: PropTypes__default["default"].arrayOf(PropTypes__default["default"].string),
|
|
57
55
|
withPoster: PropTypes__default["default"].bool // onPosterLoaded: PropTypes.func,
|
|
58
56
|
|
|
59
57
|
};
|
|
@@ -84,7 +82,6 @@ var defaultProps = {
|
|
|
84
82
|
onSuspend: null,
|
|
85
83
|
onSuspended: null,
|
|
86
84
|
focusable: true,
|
|
87
|
-
supportedMimes: ['video/mp4', 'video/webm', 'video/ogg'],
|
|
88
85
|
withPoster: false
|
|
89
86
|
};
|
|
90
87
|
|
|
@@ -117,7 +114,6 @@ var Video = function Video(_ref) {
|
|
|
117
114
|
customOnSuspend = _ref.onSuspend,
|
|
118
115
|
onSuspended = _ref.onSuspended,
|
|
119
116
|
focusable = _ref.focusable,
|
|
120
|
-
supportedMimes = _ref.supportedMimes,
|
|
121
117
|
withPoster = _ref.withPoster;
|
|
122
118
|
|
|
123
119
|
var _ref2 = media || {},
|
|
@@ -163,18 +159,16 @@ var Video = function Video(_ref) {
|
|
|
163
159
|
return null;
|
|
164
160
|
}
|
|
165
161
|
|
|
166
|
-
var
|
|
167
|
-
return supportVideo.canPlayType(mime) !== '';
|
|
168
|
-
});
|
|
162
|
+
var supportedMimes = utils.getVideoSupportedMimes();
|
|
169
163
|
|
|
170
|
-
if (
|
|
164
|
+
if (supportedMimes.length === 0) {
|
|
171
165
|
return null;
|
|
172
166
|
}
|
|
173
167
|
|
|
174
168
|
var sourceFilesMap = filesArray.filter(function (file) {
|
|
175
169
|
var _file$mime = file.mime,
|
|
176
170
|
mime = _file$mime === void 0 ? "video/".concat(file.id === 'h264' ? 'mp4' : file.id) : _file$mime;
|
|
177
|
-
return
|
|
171
|
+
return supportedMimes.indexOf(mime) !== -1;
|
|
178
172
|
}).reduce(function (filesMap, file) {
|
|
179
173
|
var _file$mime2 = file.mime,
|
|
180
174
|
mime = _file$mime2 === void 0 ? "video/".concat(file.id === 'h264' ? 'mp4' : file.id) : _file$mime2;
|
|
@@ -189,7 +183,7 @@ var Video = function Video(_ref) {
|
|
|
189
183
|
return Object.keys(sourceFilesMap).map(function (mime) {
|
|
190
184
|
return sourceFilesMap[mime];
|
|
191
185
|
});
|
|
192
|
-
}, [filesArray
|
|
186
|
+
}, [filesArray]); // @NOTE: Media is an animated image and doesn't have source files in video formats
|
|
193
187
|
|
|
194
188
|
var _ref5 = filesArray.find(function (_ref6) {
|
|
195
189
|
var handle = _ref6.handle;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-video",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.219",
|
|
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.219",
|
|
56
|
+
"@micromag/element-closed-captions": "^0.3.219",
|
|
57
|
+
"@micromag/element-media-controls": "^0.3.219",
|
|
58
58
|
"classnames": "^2.2.6",
|
|
59
59
|
"lodash": "^4.17.21",
|
|
60
60
|
"prop-types": "^15.7.2",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "ab36acb620cd3fba5c4e3c0522a299d1d27ee422"
|
|
68
68
|
}
|