@micromag/screen-video 0.3.488 → 0.3.495
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 +37 -24
- package/lib/index.js +37 -24
- package/package.json +11 -11
package/es/index.js
CHANGED
|
@@ -90,6 +90,8 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
90
90
|
videoMedia = _ref2$media === void 0 ? null : _ref2$media,
|
|
91
91
|
_ref2$thumbnail = _ref2.thumbnail,
|
|
92
92
|
thumbnail = _ref2$thumbnail === void 0 ? null : _ref2$thumbnail,
|
|
93
|
+
_ref2$captions = _ref2.captions,
|
|
94
|
+
captions = _ref2$captions === void 0 ? null : _ref2$captions,
|
|
93
95
|
_ref2$closedCaptions = _ref2.closedCaptions,
|
|
94
96
|
closedCaptions = _ref2$closedCaptions === void 0 ? null : _ref2$closedCaptions,
|
|
95
97
|
_ref2$withSeekBar = _ref2.withSeekBar,
|
|
@@ -171,8 +173,16 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
171
173
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
172
174
|
duration = _useState6[0],
|
|
173
175
|
setDuration = _useState6[1];
|
|
174
|
-
var onTimeUpdate = useCallback(function (
|
|
175
|
-
|
|
176
|
+
var onTimeUpdate = useCallback(function () {
|
|
177
|
+
var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
178
|
+
if (time !== null && typeof time.currentTarget !== 'undefined') {
|
|
179
|
+
var _ref3 = time.currentTarget || {},
|
|
180
|
+
_ref3$currentTime = _ref3.currentTime,
|
|
181
|
+
targetTime = _ref3$currentTime === void 0 ? 0 : _ref3$currentTime;
|
|
182
|
+
setCurrentTime(targetTime);
|
|
183
|
+
} else {
|
|
184
|
+
setCurrentTime(0);
|
|
185
|
+
}
|
|
176
186
|
}, [duration, setCurrentTime]);
|
|
177
187
|
var onProgressStep = useCallback(function (step) {
|
|
178
188
|
trackScreenMedia(video, "progress_".concat(Math.round(step * 100, 10), "%"));
|
|
@@ -180,15 +190,15 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
180
190
|
var onDurationChange = useCallback(function (dur) {
|
|
181
191
|
setDuration(dur);
|
|
182
192
|
}, [setDuration]);
|
|
183
|
-
var onPlay = useCallback(function (
|
|
184
|
-
var initial =
|
|
193
|
+
var onPlay = useCallback(function (_ref4) {
|
|
194
|
+
var initial = _ref4.initial;
|
|
185
195
|
if (!hasPlayed) {
|
|
186
196
|
setHasPlayed(true);
|
|
187
197
|
}
|
|
188
198
|
trackScreenMedia(video, initial ? 'play' : 'resume');
|
|
189
199
|
}, [trackScreenMedia, video]);
|
|
190
|
-
var onPause = useCallback(function (
|
|
191
|
-
var midway =
|
|
200
|
+
var onPause = useCallback(function (_ref5) {
|
|
201
|
+
var midway = _ref5.midway;
|
|
192
202
|
trackScreenMedia(video, midway ? 'pause' : 'ended');
|
|
193
203
|
}, [trackScreenMedia, video]);
|
|
194
204
|
var onSeeked = useCallback(function (time) {
|
|
@@ -223,18 +233,18 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
223
233
|
autoPlay: !isPreview && !isStatic && !isCapture && autoPlay && current
|
|
224
234
|
}) : null;
|
|
225
235
|
}, [hasVideo, video, isPreview, isStatic, isCapture, autoPlay, current]);
|
|
226
|
-
var
|
|
227
|
-
|
|
228
|
-
videoMetadata =
|
|
229
|
-
|
|
230
|
-
videoUrl =
|
|
236
|
+
var _ref6 = videoMedia || {},
|
|
237
|
+
_ref6$metadata = _ref6.metadata,
|
|
238
|
+
videoMetadata = _ref6$metadata === void 0 ? null : _ref6$metadata,
|
|
239
|
+
_ref6$url = _ref6.url,
|
|
240
|
+
videoUrl = _ref6$url === void 0 ? null : _ref6$url;
|
|
231
241
|
var finalThumbnail = useMediaThumbnail(videoMedia, thumbnail);
|
|
232
242
|
var hasVideoUrl = videoUrl !== null;
|
|
233
|
-
var
|
|
234
|
-
|
|
235
|
-
videoWidth =
|
|
236
|
-
|
|
237
|
-
videoHeight =
|
|
243
|
+
var _ref7 = videoMetadata || {},
|
|
244
|
+
_ref7$width = _ref7.width,
|
|
245
|
+
videoWidth = _ref7$width === void 0 ? 0 : _ref7$width,
|
|
246
|
+
_ref7$height = _ref7.height,
|
|
247
|
+
videoHeight = _ref7$height === void 0 ? 0 : _ref7$height;
|
|
238
248
|
var _getSizeWithinBounds = getSizeWithinBounds(videoWidth, videoHeight, width, height, {
|
|
239
249
|
cover: fullscreen
|
|
240
250
|
}),
|
|
@@ -254,11 +264,13 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
254
264
|
var onVideoReady = useCallback(function () {
|
|
255
265
|
setReady(true);
|
|
256
266
|
}, [setReady]);
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
267
|
+
|
|
268
|
+
// const onSuspended = useCallback(() => {
|
|
269
|
+
// if (playing && current) {
|
|
270
|
+
// setPlaying(false);
|
|
271
|
+
// }
|
|
272
|
+
// }, [current, playing, setPlaying]);
|
|
273
|
+
|
|
262
274
|
var onPlayError = useCallback(function () {
|
|
263
275
|
if (isView && playing && current && hasVideoUrl && autoPlay) {
|
|
264
276
|
setPlaying(false);
|
|
@@ -350,11 +362,12 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
350
362
|
paddingBottom: spacing / 2,
|
|
351
363
|
paddingTop: 0
|
|
352
364
|
}
|
|
353
|
-
}, closedCaptions !== null && !isPreview && !isCapture && !isStatic ? /*#__PURE__*/React.createElement(ClosedCaptions, {
|
|
365
|
+
}, (closedCaptions !== null || captions !== null) && !isPreview && !isCapture && !isStatic ? /*#__PURE__*/React.createElement(ClosedCaptions, Object.assign({
|
|
354
366
|
className: styles.closedCaptions,
|
|
355
|
-
media: closedCaptions
|
|
367
|
+
media: closedCaptions // BW Compat
|
|
368
|
+
}, captions, {
|
|
356
369
|
currentTime: currentTime
|
|
357
|
-
}) : null, hasFooter ? /*#__PURE__*/React.createElement(Footer, footerProps) : null) : null)), !isPlaceholder ? /*#__PURE__*/React.createElement(Background, {
|
|
370
|
+
})) : null, hasFooter ? /*#__PURE__*/React.createElement(Footer, footerProps) : null) : null)), !isPlaceholder ? /*#__PURE__*/React.createElement(Background, {
|
|
358
371
|
background: background,
|
|
359
372
|
width: width,
|
|
360
373
|
height: height,
|
package/lib/index.js
CHANGED
|
@@ -94,6 +94,8 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
94
94
|
videoMedia = _ref2$media === void 0 ? null : _ref2$media,
|
|
95
95
|
_ref2$thumbnail = _ref2.thumbnail,
|
|
96
96
|
thumbnail = _ref2$thumbnail === void 0 ? null : _ref2$thumbnail,
|
|
97
|
+
_ref2$captions = _ref2.captions,
|
|
98
|
+
captions = _ref2$captions === void 0 ? null : _ref2$captions,
|
|
97
99
|
_ref2$closedCaptions = _ref2.closedCaptions,
|
|
98
100
|
closedCaptions = _ref2$closedCaptions === void 0 ? null : _ref2$closedCaptions,
|
|
99
101
|
_ref2$withSeekBar = _ref2.withSeekBar,
|
|
@@ -175,8 +177,16 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
175
177
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
176
178
|
duration = _useState6[0],
|
|
177
179
|
setDuration = _useState6[1];
|
|
178
|
-
var onTimeUpdate = React.useCallback(function (
|
|
179
|
-
|
|
180
|
+
var onTimeUpdate = React.useCallback(function () {
|
|
181
|
+
var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
182
|
+
if (time !== null && typeof time.currentTarget !== 'undefined') {
|
|
183
|
+
var _ref3 = time.currentTarget || {},
|
|
184
|
+
_ref3$currentTime = _ref3.currentTime,
|
|
185
|
+
targetTime = _ref3$currentTime === void 0 ? 0 : _ref3$currentTime;
|
|
186
|
+
setCurrentTime(targetTime);
|
|
187
|
+
} else {
|
|
188
|
+
setCurrentTime(0);
|
|
189
|
+
}
|
|
180
190
|
}, [duration, setCurrentTime]);
|
|
181
191
|
var onProgressStep = React.useCallback(function (step) {
|
|
182
192
|
trackScreenMedia(video, "progress_".concat(Math.round(step * 100, 10), "%"));
|
|
@@ -184,15 +194,15 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
184
194
|
var onDurationChange = React.useCallback(function (dur) {
|
|
185
195
|
setDuration(dur);
|
|
186
196
|
}, [setDuration]);
|
|
187
|
-
var onPlay = React.useCallback(function (
|
|
188
|
-
var initial =
|
|
197
|
+
var onPlay = React.useCallback(function (_ref4) {
|
|
198
|
+
var initial = _ref4.initial;
|
|
189
199
|
if (!hasPlayed) {
|
|
190
200
|
setHasPlayed(true);
|
|
191
201
|
}
|
|
192
202
|
trackScreenMedia(video, initial ? 'play' : 'resume');
|
|
193
203
|
}, [trackScreenMedia, video]);
|
|
194
|
-
var onPause = React.useCallback(function (
|
|
195
|
-
var midway =
|
|
204
|
+
var onPause = React.useCallback(function (_ref5) {
|
|
205
|
+
var midway = _ref5.midway;
|
|
196
206
|
trackScreenMedia(video, midway ? 'pause' : 'ended');
|
|
197
207
|
}, [trackScreenMedia, video]);
|
|
198
208
|
var onSeeked = React.useCallback(function (time) {
|
|
@@ -227,18 +237,18 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
227
237
|
autoPlay: !isPreview && !isStatic && !isCapture && autoPlay && current
|
|
228
238
|
}) : null;
|
|
229
239
|
}, [hasVideo, video, isPreview, isStatic, isCapture, autoPlay, current]);
|
|
230
|
-
var
|
|
231
|
-
|
|
232
|
-
videoMetadata =
|
|
233
|
-
|
|
234
|
-
videoUrl =
|
|
240
|
+
var _ref6 = videoMedia || {},
|
|
241
|
+
_ref6$metadata = _ref6.metadata,
|
|
242
|
+
videoMetadata = _ref6$metadata === void 0 ? null : _ref6$metadata,
|
|
243
|
+
_ref6$url = _ref6.url,
|
|
244
|
+
videoUrl = _ref6$url === void 0 ? null : _ref6$url;
|
|
235
245
|
var finalThumbnail = hooks.useMediaThumbnail(videoMedia, thumbnail);
|
|
236
246
|
var hasVideoUrl = videoUrl !== null;
|
|
237
|
-
var
|
|
238
|
-
|
|
239
|
-
videoWidth =
|
|
240
|
-
|
|
241
|
-
videoHeight =
|
|
247
|
+
var _ref7 = videoMetadata || {},
|
|
248
|
+
_ref7$width = _ref7.width,
|
|
249
|
+
videoWidth = _ref7$width === void 0 ? 0 : _ref7$width,
|
|
250
|
+
_ref7$height = _ref7.height,
|
|
251
|
+
videoHeight = _ref7$height === void 0 ? 0 : _ref7$height;
|
|
242
252
|
var _getSizeWithinBounds = size.getSizeWithinBounds(videoWidth, videoHeight, width, height, {
|
|
243
253
|
cover: fullscreen
|
|
244
254
|
}),
|
|
@@ -258,11 +268,13 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
258
268
|
var onVideoReady = React.useCallback(function () {
|
|
259
269
|
setReady(true);
|
|
260
270
|
}, [setReady]);
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}
|
|
271
|
+
|
|
272
|
+
// const onSuspended = useCallback(() => {
|
|
273
|
+
// if (playing && current) {
|
|
274
|
+
// setPlaying(false);
|
|
275
|
+
// }
|
|
276
|
+
// }, [current, playing, setPlaying]);
|
|
277
|
+
|
|
266
278
|
var onPlayError = React.useCallback(function () {
|
|
267
279
|
if (isView && playing && current && hasVideoUrl && autoPlay) {
|
|
268
280
|
setPlaying(false);
|
|
@@ -354,11 +366,12 @@ var VideoScreen = function VideoScreen(_ref) {
|
|
|
354
366
|
paddingBottom: spacing / 2,
|
|
355
367
|
paddingTop: 0
|
|
356
368
|
}
|
|
357
|
-
}, closedCaptions !== null && !isPreview && !isCapture && !isStatic ? /*#__PURE__*/React.createElement(ClosedCaptions, {
|
|
369
|
+
}, (closedCaptions !== null || captions !== null) && !isPreview && !isCapture && !isStatic ? /*#__PURE__*/React.createElement(ClosedCaptions, Object.assign({
|
|
358
370
|
className: styles.closedCaptions,
|
|
359
|
-
media: closedCaptions
|
|
371
|
+
media: closedCaptions // BW Compat
|
|
372
|
+
}, captions, {
|
|
360
373
|
currentTime: currentTime
|
|
361
|
-
}) : null, hasFooter ? /*#__PURE__*/React.createElement(Footer, footerProps) : null) : null)), !isPlaceholder ? /*#__PURE__*/React.createElement(Background, {
|
|
374
|
+
})) : null, hasFooter ? /*#__PURE__*/React.createElement(Footer, footerProps) : null) : null)), !isPlaceholder ? /*#__PURE__*/React.createElement(Background, {
|
|
362
375
|
background: background,
|
|
363
376
|
width: width,
|
|
364
377
|
height: height,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-video",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.495",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -62,15 +62,15 @@
|
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@babel/runtime": "^7.13.10",
|
|
64
64
|
"@folklore/size": "^0.1.20",
|
|
65
|
-
"@micromag/core": "^0.3.
|
|
66
|
-
"@micromag/element-background": "^0.3.
|
|
67
|
-
"@micromag/element-closed-captions": "^0.3.
|
|
68
|
-
"@micromag/element-container": "^0.3.
|
|
69
|
-
"@micromag/element-footer": "^0.3.
|
|
70
|
-
"@micromag/element-header": "^0.3.
|
|
71
|
-
"@micromag/element-image": "^0.3.
|
|
72
|
-
"@micromag/element-video": "^0.3.
|
|
73
|
-
"@micromag/transforms": "^0.3.
|
|
65
|
+
"@micromag/core": "^0.3.491",
|
|
66
|
+
"@micromag/element-background": "^0.3.491",
|
|
67
|
+
"@micromag/element-closed-captions": "^0.3.491",
|
|
68
|
+
"@micromag/element-container": "^0.3.491",
|
|
69
|
+
"@micromag/element-footer": "^0.3.491",
|
|
70
|
+
"@micromag/element-header": "^0.3.495",
|
|
71
|
+
"@micromag/element-image": "^0.3.491",
|
|
72
|
+
"@micromag/element-video": "^0.3.491",
|
|
73
|
+
"@micromag/transforms": "^0.3.491",
|
|
74
74
|
"classnames": "^2.2.6",
|
|
75
75
|
"lodash": "^4.17.21",
|
|
76
76
|
"prop-types": "^15.7.2",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"access": "public",
|
|
82
82
|
"registry": "https://registry.npmjs.org/"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "dca5bb24d7c6de3807e45e15dccfdca68dcac0f4"
|
|
85
85
|
}
|