@micromag/screen-video-360 0.4.48 → 0.4.50

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 +131 -123
  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, useRef, useCallback } from 'react';
7
+ import { useState, useEffect, useRef, useCallback } from 'react';
8
8
  import { ScreenElement, PlaceholderVideo360 } from '@micromag/core/components';
9
9
  import { useViewerInteraction, useViewerNavigation, useViewerContext, useScreenSize, useScreenRenderContext, useViewerWebView, usePlaybackContext, useViewerContainer } from '@micromag/core/contexts';
10
10
  import { useTrackScreenEvent, useTrackScreenMedia, useDevicePixelRatio, useActivityDetector, useDebounce, useAnimationFrame } 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, Fragment } from 'react/jsx-runtime';
19
20
 
20
21
  /**
21
22
  * Locale loader
@@ -503,129 +504,136 @@ function Video360Screen(_ref) {
503
504
  setControlsSuggestPlay(true);
504
505
  }
505
506
  }, [isView, current, playing, hasVideoUrl, autoPlay, setPlaying, setControlsSuggestPlay]);
506
- return /*#__PURE__*/React.createElement("div", {
507
+ return /*#__PURE__*/jsxs("div", {
507
508
  className: classNames([styles.container, className, _defineProperty({}, styles.showVideo, isPreview || isStatic || isCapture)]),
508
- "data-screen-ready": (isStatic || isCapture) && posterReady || ready
509
- }, /*#__PURE__*/React.createElement(Container, {
510
- width: width,
511
- height: height,
512
- className: styles.content
513
- }, withVideoSphere ? /*#__PURE__*/React.createElement("div", {
514
- ref: videoContainerRef,
515
- className: styles.videoContainer,
516
- style: {
517
- width: resizedVideoWidth,
518
- height: resizedVideoHeight,
519
- left: resizedVideoLeft,
520
- top: resizedVideoTop
521
- }
522
- }, /*#__PURE__*/React.createElement(Video, Object.assign({}, finalVideo, {
523
- mediaRef: mediaRef,
524
- className: styles.video,
525
- paused: !current || !playing,
526
- muted: muted,
527
- withoutCors: true,
528
- onReady: onVideoReady,
529
- onPlay: onPlay,
530
- onPause: onPause,
531
- onTimeUpdate: onTimeUpdate,
532
- onProgressStep: onProgressStep,
533
- onDurationChange: onDurationChange,
534
- onSeeked: onSeeked,
535
- onEnded: onEnded,
536
- onPosterLoaded: onPosterLoaded,
537
- onPlayError: onPlayError,
538
- setPlaying: setPlaying,
539
- focusable: current && isView,
540
- shouldLoad: mediaShouldLoad,
541
- qualityStartLevel: currentQualityLevel,
542
- onQualityLevelChange: setCurrentQualityLevel
543
- }))) : null, /*#__PURE__*/React.createElement("div", {
544
- className: styles.inner
545
- }, /*#__PURE__*/React.createElement(ScreenElement, {
546
- key: "video",
547
- placeholder: /*#__PURE__*/React.createElement(PlaceholderVideo360, {
548
- className: styles.placeholder,
549
- width: "100%",
550
- height: "100%"
551
- }),
552
- emptyClassName: styles.empty,
553
- emptyLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
554
- id: "oLtEu6",
555
- defaultMessage: [{
556
- "type": 0,
557
- "value": "Video 360"
558
- }]
559
- }),
560
- isEmpty: !withVideoSphere
561
- }, !isPlaceholder && hasHeader ? /*#__PURE__*/React.createElement("div", {
562
- key: "header",
563
- className: styles.header,
564
- style: {
565
- paddingTop: spacing / 2,
566
- paddingLeft: spacing,
567
- paddingRight: spacing,
568
- transform: !isPreview ? "translate(0, ".concat(viewerTopHeight, "px)") : null
569
- }
570
- }, /*#__PURE__*/React.createElement(Header, header)) : null, withVideoSphere ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("canvas", {
571
- ref: canvasRef,
572
- className: styles.canvas
573
- }), /*#__PURE__*/React.createElement("button", {
574
- className: styles.canvasButton,
575
- type: "button",
576
- "aria-label": "canvas-interaction",
577
- onPointerDown: onPointerDown,
578
- onPointerMove: onPointerMove,
579
- onPointerUp: onPointerUp,
580
- tabIndex: current && isView ? null : '-1'
581
- })) : /*#__PURE__*/React.createElement("div", {
582
- className: styles.videoContainer,
583
- style: {
584
- width: resizedVideoWidth,
585
- height: resizedVideoHeight,
586
- left: resizedVideoLeft,
587
- top: resizedVideoTop
588
- }
589
- }, /*#__PURE__*/React.createElement(Image, {
590
- className: styles.video,
591
- media: {
592
- url: thumbnailUrl,
593
- metadata: {
594
- width: videoWidth,
595
- height: videoHeight
596
- }
597
- },
598
- width: resizedVideoWidth,
599
- height: resizedVideoHeight,
600
- resolution: resolution
601
- }))), !isPlaceholder ? /*#__PURE__*/React.createElement("div", {
602
- key: "bottom-content",
603
- className: styles.bottom,
604
- style: {
605
- transform: current && !isPreview ? "translate(0, -".concat(viewerBottomHeight, "px)") : null,
606
- paddingLeft: Math.max(spacing / 2, viewerBottomSidesWidth),
607
- paddingRight: Math.max(spacing / 2, viewerBottomSidesWidth),
608
- paddingBottom: spacing / 2,
609
- paddingTop: 0
610
- }
611
- }, (closedCaptions !== null || captions !== null) && !isPreview && !isCapture && !isStatic ? /*#__PURE__*/React.createElement(ClosedCaptions, Object.assign({
612
- className: styles.closedCaptions,
613
- media: closedCaptions
614
- }, captions, {
615
- currentTime: currentTime
616
- })) : null, hasFooter ? /*#__PURE__*/React.createElement(Footer, Object.assign({}, footerProps, {
617
- className: styles.callToAction
618
- })) : null) : null)), !isPlaceholder ? /*#__PURE__*/React.createElement(Background, {
619
- background: background,
620
- width: width,
621
- height: height,
622
- resolution: resolution,
623
- playing: backgroundPlaying,
624
- muted: muted,
625
- shouldLoad: mediaShouldLoad,
626
- withoutVideo: isPreview,
627
- className: styles.background
628
- }) : null);
509
+ "data-screen-ready": (isStatic || isCapture) && posterReady || ready,
510
+ children: [/*#__PURE__*/jsxs(Container, {
511
+ width: width,
512
+ height: height,
513
+ className: styles.content,
514
+ children: [withVideoSphere ? /*#__PURE__*/jsx("div", {
515
+ ref: videoContainerRef,
516
+ className: styles.videoContainer,
517
+ style: {
518
+ width: resizedVideoWidth,
519
+ height: resizedVideoHeight,
520
+ left: resizedVideoLeft,
521
+ top: resizedVideoTop
522
+ },
523
+ children: /*#__PURE__*/jsx(Video, _objectSpread(_objectSpread({}, finalVideo), {}, {
524
+ mediaRef: mediaRef,
525
+ className: styles.video,
526
+ paused: !current || !playing,
527
+ muted: muted,
528
+ withoutCors: true,
529
+ onReady: onVideoReady,
530
+ onPlay: onPlay,
531
+ onPause: onPause,
532
+ onTimeUpdate: onTimeUpdate,
533
+ onProgressStep: onProgressStep,
534
+ onDurationChange: onDurationChange,
535
+ onSeeked: onSeeked,
536
+ onEnded: onEnded,
537
+ onPosterLoaded: onPosterLoaded,
538
+ onPlayError: onPlayError,
539
+ setPlaying: setPlaying,
540
+ focusable: current && isView,
541
+ shouldLoad: mediaShouldLoad,
542
+ qualityStartLevel: currentQualityLevel,
543
+ onQualityLevelChange: setCurrentQualityLevel
544
+ }))
545
+ }) : null, /*#__PURE__*/jsxs("div", {
546
+ className: styles.inner,
547
+ children: [/*#__PURE__*/jsxs(ScreenElement, {
548
+ placeholder: /*#__PURE__*/jsx(PlaceholderVideo360, {
549
+ className: styles.placeholder,
550
+ width: "100%",
551
+ height: "100%"
552
+ }),
553
+ emptyClassName: styles.empty,
554
+ emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
555
+ id: "oLtEu6",
556
+ defaultMessage: [{
557
+ "type": 0,
558
+ "value": "Video 360"
559
+ }]
560
+ }),
561
+ isEmpty: !withVideoSphere,
562
+ children: [!isPlaceholder && hasHeader ? /*#__PURE__*/jsx("div", {
563
+ className: styles.header,
564
+ style: {
565
+ paddingTop: spacing / 2,
566
+ paddingLeft: spacing,
567
+ paddingRight: spacing,
568
+ transform: !isPreview ? "translate(0, ".concat(viewerTopHeight, "px)") : null
569
+ },
570
+ children: /*#__PURE__*/jsx(Header, _objectSpread({}, header))
571
+ }, "header") : null, withVideoSphere ? /*#__PURE__*/jsxs(Fragment, {
572
+ children: [/*#__PURE__*/jsx("canvas", {
573
+ ref: canvasRef,
574
+ className: styles.canvas
575
+ }), /*#__PURE__*/jsx("button", {
576
+ className: styles.canvasButton,
577
+ type: "button",
578
+ "aria-label": "canvas-interaction",
579
+ onPointerDown: onPointerDown,
580
+ onPointerMove: onPointerMove,
581
+ onPointerUp: onPointerUp,
582
+ tabIndex: current && isView ? null : '-1'
583
+ })]
584
+ }) : /*#__PURE__*/jsx("div", {
585
+ className: styles.videoContainer,
586
+ style: {
587
+ width: resizedVideoWidth,
588
+ height: resizedVideoHeight,
589
+ left: resizedVideoLeft,
590
+ top: resizedVideoTop
591
+ },
592
+ children: /*#__PURE__*/jsx(Image, {
593
+ className: styles.video,
594
+ media: {
595
+ url: thumbnailUrl,
596
+ metadata: {
597
+ width: videoWidth,
598
+ height: videoHeight
599
+ }
600
+ },
601
+ width: resizedVideoWidth,
602
+ height: resizedVideoHeight,
603
+ resolution: resolution
604
+ })
605
+ })]
606
+ }, "video"), !isPlaceholder ? /*#__PURE__*/jsxs("div", {
607
+ className: styles.bottom,
608
+ style: {
609
+ transform: current && !isPreview ? "translate(0, -".concat(viewerBottomHeight, "px)") : null,
610
+ paddingLeft: Math.max(spacing / 2, viewerBottomSidesWidth),
611
+ paddingRight: Math.max(spacing / 2, viewerBottomSidesWidth),
612
+ paddingBottom: spacing / 2,
613
+ paddingTop: 0
614
+ },
615
+ children: [(closedCaptions !== null || captions !== null) && !isPreview && !isCapture && !isStatic ? /*#__PURE__*/jsx(ClosedCaptions, _objectSpread(_objectSpread({
616
+ className: styles.closedCaptions,
617
+ media: closedCaptions
618
+ }, captions), {}, {
619
+ currentTime: currentTime
620
+ })) : null, hasFooter ? /*#__PURE__*/jsx(Footer, _objectSpread(_objectSpread({}, footerProps), {}, {
621
+ className: styles.callToAction
622
+ })) : null]
623
+ }, "bottom-content") : null]
624
+ })]
625
+ }), !isPlaceholder ? /*#__PURE__*/jsx(Background, {
626
+ background: background,
627
+ width: width,
628
+ height: height,
629
+ resolution: resolution,
630
+ playing: backgroundPlaying,
631
+ muted: muted,
632
+ shouldLoad: mediaShouldLoad,
633
+ withoutVideo: isPreview,
634
+ className: styles.background
635
+ }) : null]
636
+ });
629
637
  }
630
638
 
631
639
  // import * as transforms from './transforms/index';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/screen-video-360",
3
- "version": "0.4.48",
3
+ "version": "0.4.50",
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.48",
66
- "@micromag/element-background": "^0.4.48",
67
- "@micromag/element-closed-captions": "^0.4.48",
68
- "@micromag/element-container": "^0.4.48",
69
- "@micromag/element-footer": "^0.4.48",
70
- "@micromag/element-header": "^0.4.48",
71
- "@micromag/element-image": "^0.4.48",
72
- "@micromag/element-video": "^0.4.48",
73
- "@micromag/transforms": "^0.4.48",
65
+ "@micromag/core": "^0.4.50",
66
+ "@micromag/element-background": "^0.4.50",
67
+ "@micromag/element-closed-captions": "^0.4.50",
68
+ "@micromag/element-container": "^0.4.50",
69
+ "@micromag/element-footer": "^0.4.50",
70
+ "@micromag/element-header": "^0.4.50",
71
+ "@micromag/element-image": "^0.4.50",
72
+ "@micromag/element-video": "^0.4.50",
73
+ "@micromag/transforms": "^0.4.50",
74
74
  "classnames": "^2.2.6",
75
75
  "lodash": "^4.17.23",
76
76
  "react-intl": "^8.1.3 || ^10.0.0",
@@ -81,6 +81,6 @@
81
81
  "access": "public",
82
82
  "registry": "https://registry.npmjs.org/"
83
83
  },
84
- "gitHead": "d6772865be1ee3f2d19288ebfbf4b9b6860f4cd7",
84
+ "gitHead": "940d5ca98f8f448b79eaa3e2fa685c3ee95185b8",
85
85
  "types": "es/index.d.ts"
86
86
  }