@micromag/screen-video 0.4.49 → 0.4.51

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.
Files changed (2) hide show
  1. package/es/index.js +110 -103
  2. package/package.json +11 -11
package/es/index.js CHANGED
@@ -4,7 +4,7 @@ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
4
4
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
5
  import { getSizeWithinBounds } from '@folklore/size';
6
6
  import classNames from 'classnames';
7
- import React, { useState, useEffect, useCallback, useMemo } from 'react';
7
+ import { useState, useEffect, useCallback, useMemo } from 'react';
8
8
  import { ScreenElement, Empty, PlaceholderVideo } from '@micromag/core/components';
9
9
  import { useScreenSize, useScreenRenderContext, useViewerNavigation, useViewerContext, useViewerWebView, usePlaybackContext, usePlaybackMediaRef, useViewerContainer } from '@micromag/core/contexts';
10
10
  import { useTrackScreenMedia, useActivityDetector, useDebounce, useMediaThumbnail } from '@micromag/core/hooks';
@@ -16,6 +16,7 @@ import Footer from '@micromag/element-footer';
16
16
  import Header from '@micromag/element-header';
17
17
  import Image from '@micromag/element-image';
18
18
  import Video from '@micromag/element-video';
19
+ import { jsxs, jsx } from 'react/jsx-runtime';
19
20
 
20
21
  var styles = {"container":"micromag-screen-video-container","content":"micromag-screen-video-content","emptyContainer":"micromag-screen-video-emptyContainer","empty":"micromag-screen-video-empty","inner":"micromag-screen-video-inner","header":"micromag-screen-video-header","bottom":"micromag-screen-video-bottom","placeholder":"micromag-screen-video-placeholder","videoContainer":"micromag-screen-video-videoContainer","fullscreen":"micromag-screen-video-fullscreen","image":"micromag-screen-video-image","video":"micromag-screen-video-video"};
21
22
 
@@ -268,109 +269,115 @@ function VideoScreen(_ref) {
268
269
  setControlsSuggestPlay(true);
269
270
  }
270
271
  }, [isView, current, playing, hasVideoUrl, autoPlay, setPlaying, setControlsSuggestPlay]);
271
- return /*#__PURE__*/React.createElement("div", {
272
+ return /*#__PURE__*/jsxs("div", {
272
273
  className: classNames([styles.container, className, _defineProperty({}, styles.fullscreen, fullscreen)]),
273
- "data-screen-ready": isStatic || isCapture || ready
274
- }, /*#__PURE__*/React.createElement(Container, {
275
- width: width,
276
- height: height,
277
- className: styles.content
278
- }, /*#__PURE__*/React.createElement("div", {
279
- className: styles.inner
280
- }, !isPlaceholder && hasHeader ? /*#__PURE__*/React.createElement("div", {
281
- key: "header",
282
- className: styles.header,
283
- style: {
284
- paddingTop: spacing / 2,
285
- paddingLeft: spacing,
286
- paddingRight: spacing,
287
- transform: !isPreview ? "translate(0, ".concat(viewerTopHeight, "px)") : null
288
- }
289
- }, /*#__PURE__*/React.createElement(Header, Object.assign({
290
- fade: current && !controlsVisible
291
- }, header))) : null, /*#__PURE__*/React.createElement(ScreenElement, {
292
- key: "video",
293
- placeholder: /*#__PURE__*/React.createElement(PlaceholderVideo, Object.assign({
294
- className: styles.placeholder
295
- }, placeholderProps)),
296
- empty: /*#__PURE__*/React.createElement("div", {
297
- className: styles.emptyContainer
298
- }, /*#__PURE__*/React.createElement(Empty, {
299
- className: styles.empty
300
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
301
- id: "3ext9Q",
302
- defaultMessage: [{
303
- "type": 0,
304
- "value": "Video"
305
- }]
306
- }))),
307
- isEmpty: !hasVideoUrl
308
- }, hasVideoUrl ? /*#__PURE__*/React.createElement("div", {
309
- className: styles.videoContainer,
310
- style: {
311
- width: resizedVideoWidth,
312
- height: resizedVideoHeight,
313
- left: resizedVideoLeft,
314
- top: resizedVideoTop
315
- }
316
- }, shouldDisplayPoster ? /*#__PURE__*/React.createElement(Image, {
317
- className: styles.image,
318
- media: finalThumbnail,
319
- width: resizedVideoWidth,
320
- height: resizedVideoHeight,
321
- objectFit: {
322
- fit: 'cover'
323
- },
324
- resolution: resolution,
325
- shouldLoad: mediaShouldLoad
326
- }) : /*#__PURE__*/React.createElement(Video, Object.assign({}, finalVideo, {
327
- width: resizedVideoWidth,
328
- height: resizedVideoHeight,
329
- paused: !videoPlaying,
330
- muted: muted,
331
- mediaRef: mediaRef,
332
- className: styles.video,
333
- onReady: onVideoReady,
334
- onPlay: onPlay,
335
- onPause: onPause,
336
- onTimeUpdate: onTimeUpdate,
337
- onProgressStep: onProgressStep,
338
- onDurationChange: onDurationChange,
339
- onSeeked: onSeeked,
340
- onEnded: onEnded
341
- // onSuspended={onSuspended}
342
- ,
343
- onPlayError: onPlayError,
344
- disablePictureInPicture: true,
345
- focusable: current && isView,
346
- shouldLoad: mediaShouldLoad,
347
- qualityStartLevel: currentQualityLevel,
348
- onQualityLevelChange: setCurrentQualityLevel
349
- }))) : null), !isPlaceholder ? /*#__PURE__*/React.createElement("div", {
350
- key: "bottom-content",
351
- className: styles.bottom,
352
- style: {
353
- transform: current && !isPreview ? "translate3d(0, -".concat(viewerBottomHeight, "px, 0)") : null,
354
- paddingLeft: Math.max(spacing / 2, viewerBottomSidesWidth),
355
- paddingRight: Math.max(spacing / 2, viewerBottomSidesWidth),
356
- paddingBottom: spacing / 2,
357
- paddingTop: 0
358
- }
359
- }, (closedCaptions !== null || captions !== null) && !isPreview && !isCapture && !isStatic ? /*#__PURE__*/React.createElement(ClosedCaptions, Object.assign({
360
- className: styles.closedCaptions,
361
- media: closedCaptions // BW Compat
362
- }, captions, {
363
- currentTime: currentTime
364
- })) : null, hasFooter ? /*#__PURE__*/React.createElement(Footer, footerProps) : null) : null)), !isPlaceholder ? /*#__PURE__*/React.createElement(Background, {
365
- background: background,
366
- width: width,
367
- height: height,
368
- resolution: resolution,
369
- playing: backgroundPlaying,
370
- muted: muted,
371
- shouldLoad: mediaShouldLoad,
372
- withoutVideo: isPreview
373
- }) : null);
274
+ "data-screen-ready": isStatic || isCapture || ready,
275
+ children: [/*#__PURE__*/jsx(Container, {
276
+ width: width,
277
+ height: height,
278
+ className: styles.content,
279
+ children: /*#__PURE__*/jsxs("div", {
280
+ className: styles.inner,
281
+ children: [!isPlaceholder && hasHeader ? /*#__PURE__*/jsx("div", {
282
+ className: styles.header,
283
+ style: {
284
+ paddingTop: spacing / 2,
285
+ paddingLeft: spacing,
286
+ paddingRight: spacing,
287
+ transform: !isPreview ? "translate(0, ".concat(viewerTopHeight, "px)") : null
288
+ },
289
+ children: /*#__PURE__*/jsx(Header, _objectSpread({
290
+ fade: current && !controlsVisible
291
+ }, header))
292
+ }, "header") : null, /*#__PURE__*/jsx(ScreenElement, {
293
+ placeholder: /*#__PURE__*/jsx(PlaceholderVideo, _objectSpread({
294
+ className: styles.placeholder
295
+ }, placeholderProps)),
296
+ empty: /*#__PURE__*/jsx("div", {
297
+ className: styles.emptyContainer,
298
+ children: /*#__PURE__*/jsx(Empty, {
299
+ className: styles.empty,
300
+ children: /*#__PURE__*/jsx(FormattedMessage, {
301
+ id: "3ext9Q",
302
+ defaultMessage: [{
303
+ "type": 0,
304
+ "value": "Video"
305
+ }]
306
+ })
307
+ })
308
+ }),
309
+ isEmpty: !hasVideoUrl,
310
+ children: hasVideoUrl ? /*#__PURE__*/jsx("div", {
311
+ className: styles.videoContainer,
312
+ style: {
313
+ width: resizedVideoWidth,
314
+ height: resizedVideoHeight,
315
+ left: resizedVideoLeft,
316
+ top: resizedVideoTop
317
+ },
318
+ children: shouldDisplayPoster ? /*#__PURE__*/jsx(Image, {
319
+ className: styles.image,
320
+ media: finalThumbnail,
321
+ width: resizedVideoWidth,
322
+ height: resizedVideoHeight,
323
+ objectFit: {
324
+ fit: 'cover'
325
+ },
326
+ resolution: resolution,
327
+ shouldLoad: mediaShouldLoad
328
+ }) : /*#__PURE__*/jsx(Video, _objectSpread(_objectSpread({}, finalVideo), {}, {
329
+ width: resizedVideoWidth,
330
+ height: resizedVideoHeight,
331
+ paused: !videoPlaying,
332
+ muted: muted,
333
+ mediaRef: mediaRef,
334
+ className: styles.video,
335
+ onReady: onVideoReady,
336
+ onPlay: onPlay,
337
+ onPause: onPause,
338
+ onTimeUpdate: onTimeUpdate,
339
+ onProgressStep: onProgressStep,
340
+ onDurationChange: onDurationChange,
341
+ onSeeked: onSeeked,
342
+ onEnded: onEnded
343
+ // onSuspended={onSuspended}
344
+ ,
345
+ onPlayError: onPlayError,
346
+ disablePictureInPicture: true,
347
+ focusable: current && isView,
348
+ shouldLoad: mediaShouldLoad,
349
+ qualityStartLevel: currentQualityLevel,
350
+ onQualityLevelChange: setCurrentQualityLevel
351
+ }))
352
+ }) : null
353
+ }, "video"), !isPlaceholder ? /*#__PURE__*/jsxs("div", {
354
+ className: styles.bottom,
355
+ style: {
356
+ transform: current && !isPreview ? "translate3d(0, -".concat(viewerBottomHeight, "px, 0)") : null,
357
+ paddingLeft: Math.max(spacing / 2, viewerBottomSidesWidth),
358
+ paddingRight: Math.max(spacing / 2, viewerBottomSidesWidth),
359
+ paddingBottom: spacing / 2,
360
+ paddingTop: 0
361
+ },
362
+ children: [(closedCaptions !== null || captions !== null) && !isPreview && !isCapture && !isStatic ? /*#__PURE__*/jsx(ClosedCaptions, _objectSpread(_objectSpread({
363
+ className: styles.closedCaptions,
364
+ media: closedCaptions // BW Compat
365
+ }, captions), {}, {
366
+ currentTime: currentTime
367
+ })) : null, hasFooter ? /*#__PURE__*/jsx(Footer, _objectSpread({}, footerProps)) : null]
368
+ }, "bottom-content") : null]
369
+ })
370
+ }), !isPlaceholder ? /*#__PURE__*/jsx(Background, {
371
+ background: background,
372
+ width: width,
373
+ height: height,
374
+ resolution: resolution,
375
+ playing: backgroundPlaying,
376
+ muted: muted,
377
+ shouldLoad: mediaShouldLoad,
378
+ withoutVideo: isPreview
379
+ }) : null]
380
+ });
374
381
  }
375
382
 
376
383
  var definition = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/screen-video",
3
- "version": "0.4.49",
3
+ "version": "0.4.51",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -62,15 +62,15 @@
62
62
  "dependencies": {
63
63
  "@babel/runtime": "^7.28.6",
64
64
  "@folklore/size": "^0.1.20",
65
- "@micromag/core": "^0.4.49",
66
- "@micromag/element-background": "^0.4.49",
67
- "@micromag/element-closed-captions": "^0.4.49",
68
- "@micromag/element-container": "^0.4.49",
69
- "@micromag/element-footer": "^0.4.49",
70
- "@micromag/element-header": "^0.4.49",
71
- "@micromag/element-image": "^0.4.49",
72
- "@micromag/element-video": "^0.4.49",
73
- "@micromag/transforms": "^0.4.49",
65
+ "@micromag/core": "^0.4.51",
66
+ "@micromag/element-background": "^0.4.51",
67
+ "@micromag/element-closed-captions": "^0.4.51",
68
+ "@micromag/element-container": "^0.4.51",
69
+ "@micromag/element-footer": "^0.4.51",
70
+ "@micromag/element-header": "^0.4.51",
71
+ "@micromag/element-image": "^0.4.51",
72
+ "@micromag/element-video": "^0.4.51",
73
+ "@micromag/transforms": "^0.4.51",
74
74
  "classnames": "^2.2.6",
75
75
  "lodash": "^4.17.23",
76
76
  "react-intl": "^8.1.3 || ^10.0.0",
@@ -80,6 +80,6 @@
80
80
  "access": "public",
81
81
  "registry": "https://registry.npmjs.org/"
82
82
  },
83
- "gitHead": "0a225ff29387217cccb0fcc5a731e23c74bd202e",
83
+ "gitHead": "985a2370829c9ac8901ea97bf20bfc98ab158439",
84
84
  "types": "es/index.d.ts"
85
85
  }