@micromag/screen-video-360 0.4.49 → 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.
- package/es/index.js +131 -123
- 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
|
|
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__*/
|
|
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
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
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.
|
|
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.
|
|
66
|
-
"@micromag/element-background": "^0.4.
|
|
67
|
-
"@micromag/element-closed-captions": "^0.4.
|
|
68
|
-
"@micromag/element-container": "^0.4.
|
|
69
|
-
"@micromag/element-footer": "^0.4.
|
|
70
|
-
"@micromag/element-header": "^0.4.
|
|
71
|
-
"@micromag/element-image": "^0.4.
|
|
72
|
-
"@micromag/element-video": "^0.4.
|
|
73
|
-
"@micromag/transforms": "^0.4.
|
|
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": "
|
|
84
|
+
"gitHead": "940d5ca98f8f448b79eaa3e2fa685c3ee95185b8",
|
|
85
85
|
"types": "es/index.d.ts"
|
|
86
86
|
}
|