@micromag/element-video 0.3.105 → 0.3.106
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 +11 -7
- package/lib/index.js +11 -7
- package/package.json +5 -5
package/es/index.js
CHANGED
|
@@ -25,6 +25,7 @@ var propTypes = {
|
|
|
25
25
|
loop: PropTypes$1.bool,
|
|
26
26
|
playsInline: PropTypes$1.bool,
|
|
27
27
|
preload: PropTypes$1.oneOf(['auto', 'metadata', 'none', null]),
|
|
28
|
+
shouldLoad: PropTypes$1.bool,
|
|
28
29
|
withoutCors: PropTypes$1.bool,
|
|
29
30
|
className: PropTypes$1.string,
|
|
30
31
|
onReady: PropTypes$1.func,
|
|
@@ -50,6 +51,7 @@ var defaultProps = {
|
|
|
50
51
|
loop: false,
|
|
51
52
|
playsInline: true,
|
|
52
53
|
preload: 'auto',
|
|
54
|
+
shouldLoad: true,
|
|
53
55
|
withoutCors: false,
|
|
54
56
|
className: null,
|
|
55
57
|
onReady: null,
|
|
@@ -78,6 +80,7 @@ var Video = function Video(_ref) {
|
|
|
78
80
|
loop = _ref.loop,
|
|
79
81
|
playsInline = _ref.playsInline,
|
|
80
82
|
preload = _ref.preload,
|
|
83
|
+
shouldLoad = _ref.shouldLoad,
|
|
81
84
|
withoutCors = _ref.withoutCors,
|
|
82
85
|
className = _ref.className,
|
|
83
86
|
onReady = _ref.onReady,
|
|
@@ -221,33 +224,34 @@ var Video = function Video(_ref) {
|
|
|
221
224
|
useEffect(function () {
|
|
222
225
|
var _ref$current = ref.current,
|
|
223
226
|
videoElement = _ref$current === void 0 ? null : _ref$current;
|
|
224
|
-
var canLoad = preload !== 'none' && preload !== 'metadata';
|
|
227
|
+
var canLoad = preload !== 'none' && preload !== 'metadata' && shouldLoad; // @todo
|
|
228
|
+
|
|
225
229
|
var preloadHasChanged = firstPreloadRef.current !== preload;
|
|
226
230
|
|
|
227
231
|
if (canLoad && preloadHasChanged && !hasLoadedRef.current && videoElement !== null && typeof videoElement.load !== 'undefined') {
|
|
228
232
|
hasLoadedRef.current = true;
|
|
229
233
|
videoElement.load();
|
|
230
234
|
}
|
|
231
|
-
}, [preload]);
|
|
235
|
+
}, [shouldLoad, preload]);
|
|
232
236
|
return /*#__PURE__*/React.createElement("div", {
|
|
233
237
|
className: classNames([styles.container, (_ref7 = {}, _defineProperty(_ref7, className, className !== null), _defineProperty(_ref7, styles.paused, !playing), _defineProperty(_ref7, styles.withSize, withSize), _ref7)]),
|
|
234
238
|
style: withSize ? {
|
|
235
239
|
width: width,
|
|
236
240
|
height: height
|
|
237
241
|
} : null
|
|
238
|
-
}, isImageWithoutSourceFile ? /*#__PURE__*/React.createElement("img", {
|
|
242
|
+
}, isImageWithoutSourceFile && shouldLoad ? /*#__PURE__*/React.createElement("img", {
|
|
239
243
|
src: mediaUrl,
|
|
240
244
|
alt: description,
|
|
241
245
|
className: styles.video
|
|
242
|
-
}) : /*#__PURE__*/React.createElement("video", {
|
|
246
|
+
}) : null, !isImageWithoutSourceFile ? /*#__PURE__*/React.createElement("video", {
|
|
243
247
|
key: mediaUrl,
|
|
244
248
|
ref: ref,
|
|
245
249
|
src: sourceFiles === null ? mediaUrl : null,
|
|
246
250
|
autoPlay: autoPlay,
|
|
247
251
|
loop: loop,
|
|
248
252
|
muted: muted,
|
|
249
|
-
poster: thumbnailUrl,
|
|
250
|
-
preload: preload,
|
|
253
|
+
poster: shouldLoad ? thumbnailUrl : null,
|
|
254
|
+
preload: shouldLoad ? preload : 'metadata',
|
|
251
255
|
playsInline: playsInline,
|
|
252
256
|
crossOrigin: withoutCors ? 'anonymous' : null,
|
|
253
257
|
tabIndex: focusable ? '0' : '-1',
|
|
@@ -260,7 +264,7 @@ var Video = function Video(_ref) {
|
|
|
260
264
|
src: sourceUrl,
|
|
261
265
|
type: sourceMime
|
|
262
266
|
});
|
|
263
|
-
})));
|
|
267
|
+
})) : null);
|
|
264
268
|
};
|
|
265
269
|
|
|
266
270
|
Video.propTypes = propTypes;
|
package/lib/index.js
CHANGED
|
@@ -36,6 +36,7 @@ var propTypes = {
|
|
|
36
36
|
loop: PropTypes__default["default"].bool,
|
|
37
37
|
playsInline: PropTypes__default["default"].bool,
|
|
38
38
|
preload: PropTypes__default["default"].oneOf(['auto', 'metadata', 'none', null]),
|
|
39
|
+
shouldLoad: PropTypes__default["default"].bool,
|
|
39
40
|
withoutCors: PropTypes__default["default"].bool,
|
|
40
41
|
className: PropTypes__default["default"].string,
|
|
41
42
|
onReady: PropTypes__default["default"].func,
|
|
@@ -61,6 +62,7 @@ var defaultProps = {
|
|
|
61
62
|
loop: false,
|
|
62
63
|
playsInline: true,
|
|
63
64
|
preload: 'auto',
|
|
65
|
+
shouldLoad: true,
|
|
64
66
|
withoutCors: false,
|
|
65
67
|
className: null,
|
|
66
68
|
onReady: null,
|
|
@@ -89,6 +91,7 @@ var Video = function Video(_ref) {
|
|
|
89
91
|
loop = _ref.loop,
|
|
90
92
|
playsInline = _ref.playsInline,
|
|
91
93
|
preload = _ref.preload,
|
|
94
|
+
shouldLoad = _ref.shouldLoad,
|
|
92
95
|
withoutCors = _ref.withoutCors,
|
|
93
96
|
className = _ref.className,
|
|
94
97
|
onReady = _ref.onReady,
|
|
@@ -232,33 +235,34 @@ var Video = function Video(_ref) {
|
|
|
232
235
|
React.useEffect(function () {
|
|
233
236
|
var _ref$current = ref.current,
|
|
234
237
|
videoElement = _ref$current === void 0 ? null : _ref$current;
|
|
235
|
-
var canLoad = preload !== 'none' && preload !== 'metadata';
|
|
238
|
+
var canLoad = preload !== 'none' && preload !== 'metadata' && shouldLoad; // @todo
|
|
239
|
+
|
|
236
240
|
var preloadHasChanged = firstPreloadRef.current !== preload;
|
|
237
241
|
|
|
238
242
|
if (canLoad && preloadHasChanged && !hasLoadedRef.current && videoElement !== null && typeof videoElement.load !== 'undefined') {
|
|
239
243
|
hasLoadedRef.current = true;
|
|
240
244
|
videoElement.load();
|
|
241
245
|
}
|
|
242
|
-
}, [preload]);
|
|
246
|
+
}, [shouldLoad, preload]);
|
|
243
247
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
244
248
|
className: classNames__default["default"]([styles.container, (_ref7 = {}, _defineProperty__default["default"](_ref7, className, className !== null), _defineProperty__default["default"](_ref7, styles.paused, !playing), _defineProperty__default["default"](_ref7, styles.withSize, withSize), _ref7)]),
|
|
245
249
|
style: withSize ? {
|
|
246
250
|
width: width,
|
|
247
251
|
height: height
|
|
248
252
|
} : null
|
|
249
|
-
}, isImageWithoutSourceFile ? /*#__PURE__*/React__default["default"].createElement("img", {
|
|
253
|
+
}, isImageWithoutSourceFile && shouldLoad ? /*#__PURE__*/React__default["default"].createElement("img", {
|
|
250
254
|
src: mediaUrl,
|
|
251
255
|
alt: description,
|
|
252
256
|
className: styles.video
|
|
253
|
-
}) : /*#__PURE__*/React__default["default"].createElement("video", {
|
|
257
|
+
}) : null, !isImageWithoutSourceFile ? /*#__PURE__*/React__default["default"].createElement("video", {
|
|
254
258
|
key: mediaUrl,
|
|
255
259
|
ref: ref,
|
|
256
260
|
src: sourceFiles === null ? mediaUrl : null,
|
|
257
261
|
autoPlay: autoPlay,
|
|
258
262
|
loop: loop,
|
|
259
263
|
muted: muted,
|
|
260
|
-
poster: thumbnailUrl,
|
|
261
|
-
preload: preload,
|
|
264
|
+
poster: shouldLoad ? thumbnailUrl : null,
|
|
265
|
+
preload: shouldLoad ? preload : 'metadata',
|
|
262
266
|
playsInline: playsInline,
|
|
263
267
|
crossOrigin: withoutCors ? 'anonymous' : null,
|
|
264
268
|
tabIndex: focusable ? '0' : '-1',
|
|
@@ -271,7 +275,7 @@ var Video = function Video(_ref) {
|
|
|
271
275
|
src: sourceUrl,
|
|
272
276
|
type: sourceMime
|
|
273
277
|
});
|
|
274
|
-
})));
|
|
278
|
+
})) : null);
|
|
275
279
|
};
|
|
276
280
|
|
|
277
281
|
Video.propTypes = propTypes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-video",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.106",
|
|
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.106",
|
|
56
|
+
"@micromag/element-closed-captions": "^0.3.106",
|
|
57
|
+
"@micromag/element-media-controls": "^0.3.106",
|
|
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": "865842ef7fbdc41f89dd0891857989ded63d44c4"
|
|
67
67
|
}
|