@zync/zync-screnplay-player 0.1.202 → 0.1.204
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/dist/bundle.js +1 -1
- package/dist/screenplay/RemotionRenderer/RemotionRenderer.js +13 -12
- package/dist/screenplay/RemotionRenderer/components/LottieAnimationGlobal.js +21 -21
- package/dist/screenplay/RemotionRenderer/components/layouts/Handoff.js +26 -10
- package/dist/screenplay/RemotionRenderer/components/layouts/SimpleFrame.js +41 -21
- package/dist/screenplay/RemotionRenderer/components/utils/FaceCenteredVideo.js +50 -50
- package/dist/screenplay/RemotionRenderer/components/utils/PausableImg.js +4 -4
- package/dist/screenplay/RemotionRenderer/components/utils/README.md +80 -80
- package/dist/screenplay/RemotionRenderer/components/utils/StretchTextDemo.js +3 -3
- package/dist/screenplay/RemotionRenderer/development.js +786 -1737
- package/dist/screenplay/RemotionRenderer/helpers/convertToSeconds.js +8 -8
- package/dist/screenplay/RemotionRenderer/helpers/faceBasedVideoStyles.js +4 -4
- package/dist/screenplay/RemotionRenderer/helpers/faceCenteredVideoTransforms.js +46 -46
- package/dist/screenplay/RemotionRenderer/main/lib/layouts/HandoffLayout.js +3 -2
- package/dist/screenplay/RemotionRenderer/main/lib/layouts/SimpleFrameLayout.js +4 -3
- package/dist/screenplay/RemotionRenderer/main/screenplaySchema.js +51 -51
- package/dist/screenplay/RemotionRenderer/registeredComponents.js +2 -2
- package/dist/screenplay/RemotionRenderer/theme/themes/default/HandoffNametag.js +20 -6
- package/dist/screenplay/RemotionRenderer/tracks/LayoutVideoTrack.js +20 -20
- package/package.json +47 -47
|
@@ -90,26 +90,27 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
90
90
|
}, {
|
|
91
91
|
key: "toRemotionFragment",
|
|
92
92
|
value: function toRemotionFragment(screenPlaySegment, layout) {
|
|
93
|
-
var _screenPlaySegment$da, _screenPlaySegment$da2, _layout$data, _screenPlaySegment$da3, _toFrames, _screenPlaySegment$
|
|
93
|
+
var _screenPlaySegment$da, _screenPlaySegment$da2, _layout$data, _screenPlaySegment$da3, _screenPlaySegment$da4, _layout$data2, _screenPlaySegment$da5, _toFrames, _screenPlaySegment$da6, _screenPlaySegment$da7;
|
|
94
94
|
var trimLeft = 0;
|
|
95
95
|
if (layout) {
|
|
96
96
|
trimLeft = layout.data.trimLeft || 0;
|
|
97
97
|
}
|
|
98
98
|
var component = toPascalCase(screenPlaySegment.type);
|
|
99
99
|
var inheritedProps = component === "HandoffNametag" ? {
|
|
100
|
-
handoffNametagVariant: (_screenPlaySegment$da = (_screenPlaySegment$da2 = screenPlaySegment.data) === null || _screenPlaySegment$da2 === void 0 ? void 0 : _screenPlaySegment$da2.handoffNametagVariant) !== null && _screenPlaySegment$da !== void 0 ? _screenPlaySegment$da : layout === null || layout === void 0 ? void 0 : (_layout$data = layout.data) === null || _layout$data === void 0 ? void 0 : _layout$data.handoffNametagVariant
|
|
100
|
+
handoffNametagVariant: (_screenPlaySegment$da = (_screenPlaySegment$da2 = screenPlaySegment.data) === null || _screenPlaySegment$da2 === void 0 ? void 0 : _screenPlaySegment$da2.handoffNametagVariant) !== null && _screenPlaySegment$da !== void 0 ? _screenPlaySegment$da : layout === null || layout === void 0 ? void 0 : (_layout$data = layout.data) === null || _layout$data === void 0 ? void 0 : _layout$data.handoffNametagVariant,
|
|
101
|
+
useSquareInLandscapeFirstVideo: (_screenPlaySegment$da3 = (_screenPlaySegment$da4 = screenPlaySegment.data) === null || _screenPlaySegment$da4 === void 0 ? void 0 : _screenPlaySegment$da4.useSquareInLandscapeFirstVideo) !== null && _screenPlaySegment$da3 !== void 0 ? _screenPlaySegment$da3 : layout === null || layout === void 0 ? void 0 : (_layout$data2 = layout.data) === null || _layout$data2 === void 0 ? void 0 : _layout$data2.useSquareInLandscapeFirstVideo
|
|
101
102
|
} : {};
|
|
102
103
|
var from = this.fps * (screenPlaySegment.data.offset - trimLeft) || 0;
|
|
103
104
|
var durationInFrames = toFrames(this.fps * screenPlaySegment.data.duration);
|
|
104
105
|
var to = from + durationInFrames;
|
|
105
106
|
return _objectSpread(_objectSpread(_objectSpread({}, screenPlaySegment.data), inheritedProps), {}, {
|
|
106
107
|
component: component,
|
|
107
|
-
videoUrl: (_screenPlaySegment$
|
|
108
|
-
startVideoFrom: (_toFrames = toFrames(this.fps * ((_screenPlaySegment$
|
|
108
|
+
videoUrl: (_screenPlaySegment$da5 = screenPlaySegment.data.sourceVideo) === null || _screenPlaySegment$da5 === void 0 ? void 0 : _screenPlaySegment$da5.videoUrl,
|
|
109
|
+
startVideoFrom: (_toFrames = toFrames(this.fps * ((_screenPlaySegment$da6 = screenPlaySegment.data.sourceVideo) === null || _screenPlaySegment$da6 === void 0 ? void 0 : _screenPlaySegment$da6.start), false, true)) !== null && _toFrames !== void 0 ? _toFrames : 0,
|
|
109
110
|
durationInFrames: durationInFrames,
|
|
110
111
|
from: from,
|
|
111
112
|
to: to,
|
|
112
|
-
videoZoom: (_screenPlaySegment$
|
|
113
|
+
videoZoom: (_screenPlaySegment$da7 = screenPlaySegment.data.sourceVideo) === null || _screenPlaySegment$da7 === void 0 ? void 0 : _screenPlaySegment$da7.zoom,
|
|
113
114
|
offset: toFrames(this.fps * (screenPlaySegment.data.offset - trimLeft)) || 0,
|
|
114
115
|
theme: screenPlaySegment.theme,
|
|
115
116
|
themeSettings: screenPlaySegment === null || screenPlaySegment === void 0 ? void 0 : screenPlaySegment.themeSettings
|
|
@@ -118,20 +119,20 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
118
119
|
}, {
|
|
119
120
|
key: "toRemotionAudioFragment",
|
|
120
121
|
value: function toRemotionAudioFragment(screenPlaySegment) {
|
|
121
|
-
var _screenPlaySegment$
|
|
122
|
+
var _screenPlaySegment$da8, _toFrames2, _screenPlaySegment$da9, _screenPlaySegment$da10, _screenPlaySegment$da11, _screenPlaySegment$da12, _screenPlaySegment$da13, _screenPlaySegment$da14;
|
|
122
123
|
var from = this.fps * screenPlaySegment.data.offset || 0;
|
|
123
124
|
var durationInFrames = toFrames(this.fps * screenPlaySegment.data.duration) || undefined;
|
|
124
125
|
var to = from + durationInFrames;
|
|
125
126
|
return _objectSpread(_objectSpread({}, screenPlaySegment.data), {}, {
|
|
126
127
|
component: toPascalCase(screenPlaySegment.type),
|
|
127
|
-
src: (_screenPlaySegment$
|
|
128
|
-
startAudioFrom: (_toFrames2 = toFrames(this.fps * ((_screenPlaySegment$
|
|
128
|
+
src: (_screenPlaySegment$da8 = screenPlaySegment.data.sourceAudio) === null || _screenPlaySegment$da8 === void 0 ? void 0 : _screenPlaySegment$da8.url,
|
|
129
|
+
startAudioFrom: (_toFrames2 = toFrames(this.fps * ((_screenPlaySegment$da9 = screenPlaySegment.data.sourceAudio) === null || _screenPlaySegment$da9 === void 0 ? void 0 : _screenPlaySegment$da9.start), false, true)) !== null && _toFrames2 !== void 0 ? _toFrames2 : 0,
|
|
129
130
|
durationInFrames: durationInFrames,
|
|
130
131
|
from: from,
|
|
131
132
|
to: to,
|
|
132
133
|
offset: this.fps * screenPlaySegment.data.offset || 0,
|
|
133
|
-
volume: (_screenPlaySegment$
|
|
134
|
-
loop: ((_screenPlaySegment$
|
|
134
|
+
volume: (_screenPlaySegment$da10 = (_screenPlaySegment$da11 = screenPlaySegment.data) === null || _screenPlaySegment$da11 === void 0 ? void 0 : (_screenPlaySegment$da12 = _screenPlaySegment$da11.sourceAudio) === null || _screenPlaySegment$da12 === void 0 ? void 0 : _screenPlaySegment$da12.volume) !== null && _screenPlaySegment$da10 !== void 0 ? _screenPlaySegment$da10 : 1,
|
|
135
|
+
loop: ((_screenPlaySegment$da13 = screenPlaySegment.data) === null || _screenPlaySegment$da13 === void 0 ? void 0 : (_screenPlaySegment$da14 = _screenPlaySegment$da13.sourceAudio) === null || _screenPlaySegment$da14 === void 0 ? void 0 : _screenPlaySegment$da14.loop) || false
|
|
135
136
|
});
|
|
136
137
|
}
|
|
137
138
|
}, {
|
|
@@ -163,10 +164,10 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
163
164
|
key: "toRemotionCaptionSegment",
|
|
164
165
|
value: function toRemotionCaptionSegment(screenPlaySegment, screenplayLayout) {
|
|
165
166
|
var _screenplayLayout$dat,
|
|
166
|
-
_screenPlaySegment$
|
|
167
|
+
_screenPlaySegment$da15,
|
|
167
168
|
_this3 = this;
|
|
168
169
|
var trimLeft = (screenplayLayout === null || screenplayLayout === void 0 ? void 0 : (_screenplayLayout$dat = screenplayLayout.data) === null || _screenplayLayout$dat === void 0 ? void 0 : _screenplayLayout$dat.trimLeft) || 0;
|
|
169
|
-
var segmentOffset = Number(screenPlaySegment === null || screenPlaySegment === void 0 ? void 0 : (_screenPlaySegment$
|
|
170
|
+
var segmentOffset = Number(screenPlaySegment === null || screenPlaySegment === void 0 ? void 0 : (_screenPlaySegment$da15 = screenPlaySegment.data) === null || _screenPlaySegment$da15 === void 0 ? void 0 : _screenPlaySegment$da15.offset);
|
|
170
171
|
var from = Number.isFinite(segmentOffset) ? this.fps * (segmentOffset + trimLeft) : 0;
|
|
171
172
|
var transcripts = screenPlaySegment.data.transcript_text;
|
|
172
173
|
if (!transcripts) {
|
|
@@ -8,9 +8,9 @@ import React, { useEffect, useState } from 'react';
|
|
|
8
8
|
import { delayRender, continueRender, cancelRender } from 'remotion';
|
|
9
9
|
import { Lottie } from '@remotion/lottie';
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* Convert a HEX color string (e.g. "#ff8800") to the RGBA float array that
|
|
13
|
-
* Lottie expects: [r, g, b, a] where each component is 0‑1.
|
|
11
|
+
/**
|
|
12
|
+
* Convert a HEX color string (e.g. "#ff8800") to the RGBA float array that
|
|
13
|
+
* Lottie expects: [r, g, b, a] where each component is 0‑1.
|
|
14
14
|
*/
|
|
15
15
|
var hexToRGBA = function hexToRGBA(hex) {
|
|
16
16
|
var clean = hex.replace('#', '');
|
|
@@ -25,9 +25,9 @@ var hexToRGBA = function hexToRGBA(hex) {
|
|
|
25
25
|
];
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
/**
|
|
29
|
-
* Recursively walks through shape objects and overrides any fill (fl) or
|
|
30
|
-
* stroke (st) color with the provided RGBA array.
|
|
28
|
+
/**
|
|
29
|
+
* Recursively walks through shape objects and overrides any fill (fl) or
|
|
30
|
+
* stroke (st) color with the provided RGBA array.
|
|
31
31
|
*/
|
|
32
32
|
var _applyColor = function applyColor(shapes, rgba) {
|
|
33
33
|
shapes === null || shapes === void 0 ? void 0 : shapes.forEach(function (shape) {
|
|
@@ -40,11 +40,11 @@ var _applyColor = function applyColor(shapes, rgba) {
|
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
/**
|
|
44
|
-
* Traverses all layers (top‑level + asset layers) and applies the primary
|
|
45
|
-
* color to every fill / stroke it encounters. This is useful for Lottie files
|
|
46
|
-
* that were exported with a single static color (e.g. white) and do not use
|
|
47
|
-
* layer naming conventions like "PrimaryColor".
|
|
43
|
+
/**
|
|
44
|
+
* Traverses all layers (top‑level + asset layers) and applies the primary
|
|
45
|
+
* color to every fill / stroke it encounters. This is useful for Lottie files
|
|
46
|
+
* that were exported with a single static color (e.g. white) and do not use
|
|
47
|
+
* layer naming conventions like "PrimaryColor".
|
|
48
48
|
*/
|
|
49
49
|
var replaceGlobalColor = function replaceGlobalColor(data, hex) {
|
|
50
50
|
var _data$assets;
|
|
@@ -60,16 +60,16 @@ var replaceGlobalColor = function replaceGlobalColor(data, hex) {
|
|
|
60
60
|
});
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
/**
|
|
64
|
-
* LottieAnimationGlobal – specialised wrapper to render the provided Lottie
|
|
65
|
-
* (e.g. text‑bubble‑animation.json) while dynamically replacing **all** stroke
|
|
66
|
-
* and fill colors with the supplied `primaryColor`.
|
|
67
|
-
*
|
|
68
|
-
* Props:
|
|
69
|
-
* • animationPath – URL or local path to the json file.
|
|
70
|
-
* • primaryColor – HEX string, defaults to "#ffffff".
|
|
71
|
-
* • autoplay – boolean, whether to start playing immediately.
|
|
72
|
-
* • loop – boolean, whether to loop the animation.
|
|
63
|
+
/**
|
|
64
|
+
* LottieAnimationGlobal – specialised wrapper to render the provided Lottie
|
|
65
|
+
* (e.g. text‑bubble‑animation.json) while dynamically replacing **all** stroke
|
|
66
|
+
* and fill colors with the supplied `primaryColor`.
|
|
67
|
+
*
|
|
68
|
+
* Props:
|
|
69
|
+
* • animationPath – URL or local path to the json file.
|
|
70
|
+
* • primaryColor – HEX string, defaults to "#ffffff".
|
|
71
|
+
* • autoplay – boolean, whether to start playing immediately.
|
|
72
|
+
* • loop – boolean, whether to loop the animation.
|
|
73
73
|
*/
|
|
74
74
|
export var LottieAnimationGlobal = function LottieAnimationGlobal(_ref) {
|
|
75
75
|
var animationPath = _ref.animationPath,
|
|
@@ -10,6 +10,7 @@ var TOTAL_X_PADDING = 20;
|
|
|
10
10
|
var GAP_BETWEEN_VIDEOS = 5;
|
|
11
11
|
var MIN_HANDOFF_OVERLAP = 0.5;
|
|
12
12
|
export var Handoff = function Handoff(_ref) {
|
|
13
|
+
var _compositionProps$out, _window, _window$screenplayPro, _window$screenplayPro2;
|
|
13
14
|
var startFirstVideoFrom = _ref.startFirstVideoFrom,
|
|
14
15
|
startSecondVideoFrom = _ref.startSecondVideoFrom,
|
|
15
16
|
firstVideoFile = _ref.firstVideoFile,
|
|
@@ -22,11 +23,18 @@ export var Handoff = function Handoff(_ref) {
|
|
|
22
23
|
secondNoBackgroundVideoUrl = _ref.secondNoBackgroundVideoUrl,
|
|
23
24
|
secondNoBackgroundFaceMetadata = _ref.secondNoBackgroundFaceMetadata,
|
|
24
25
|
noBackgroundVideoEffects = _ref.noBackgroundVideoEffects,
|
|
25
|
-
handoffOverlapSeconds = _ref.handoffOverlapSeconds
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
handoffOverlapSeconds = _ref.handoffOverlapSeconds,
|
|
27
|
+
_ref$useSquareInLands = _ref.useSquareInLandscapeFirstVideo,
|
|
28
|
+
useSquareInLandscapeFirstVideo = _ref$useSquareInLands === void 0 ? false : _ref$useSquareInLands;
|
|
29
|
+
var videoConfig = useVideoConfig();
|
|
30
|
+
var width = videoConfig.width,
|
|
31
|
+
height = videoConfig.height,
|
|
32
|
+
fps = videoConfig.fps,
|
|
33
|
+
_videoConfig$props = videoConfig.props,
|
|
34
|
+
compositionProps = _videoConfig$props === void 0 ? {} : _videoConfig$props;
|
|
35
|
+
var outputOrientation = (compositionProps === null || compositionProps === void 0 ? void 0 : (_compositionProps$out = compositionProps.output) === null || _compositionProps$out === void 0 ? void 0 : _compositionProps$out.orientation) || (typeof window !== "undefined" ? (_window = window) === null || _window === void 0 ? void 0 : (_window$screenplayPro = _window.screenplayProps) === null || _window$screenplayPro === void 0 ? void 0 : (_window$screenplayPro2 = _window$screenplayPro.output) === null || _window$screenplayPro2 === void 0 ? void 0 : _window$screenplayPro2.orientation : undefined);
|
|
36
|
+
var shouldUseSquareInLandscapeFirstVideo = Boolean(useSquareInLandscapeFirstVideo) && outputOrientation === "landscape";
|
|
37
|
+
var squareSize = 1080;
|
|
30
38
|
var frame = useCurrentFrame();
|
|
31
39
|
var _useTheme = useTheme(),
|
|
32
40
|
primaryColor = _useTheme.primaryColor;
|
|
@@ -68,6 +76,10 @@ export var Handoff = function Handoff(_ref) {
|
|
|
68
76
|
var secondVideoWidth = useTimeInterpolate(inputRangeInSeconds, secondTargetVideoWidths, DEFAULT_TIME_INTERPOLATE_OPTIONS);
|
|
69
77
|
var firstVideoHeight = useTimeInterpolate(inputRangeInSeconds, firstTargetVideoHeights, DEFAULT_TIME_INTERPOLATE_OPTIONS);
|
|
70
78
|
var secondVideoHeight = useTimeInterpolate(inputRangeInSeconds, secondTargetVideoHeights, DEFAULT_TIME_INTERPOLATE_OPTIONS);
|
|
79
|
+
var firstRenderVideoWidth = shouldUseSquareInLandscapeFirstVideo ? Math.min(firstVideoWidth, squareSize) : firstVideoWidth;
|
|
80
|
+
var firstRenderVideoHeight = shouldUseSquareInLandscapeFirstVideo ? Math.min(firstVideoHeight, squareSize) : firstVideoHeight;
|
|
81
|
+
var firstVideoCenteredOffsetX = shouldUseSquareInLandscapeFirstVideo ? Math.max(0, (width - TOTAL_X_PADDING - firstRenderVideoWidth) / 2) : 0;
|
|
82
|
+
var firstVideoTranslateX = useTimeInterpolate(inputRangeInSeconds, [firstVideoCenteredOffsetX, 0, 0, 0], DEFAULT_TIME_INTERPOLATE_OPTIONS);
|
|
71
83
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AbsoluteFill, {
|
|
72
84
|
style: {
|
|
73
85
|
width: width,
|
|
@@ -90,24 +102,28 @@ export var Handoff = function Handoff(_ref) {
|
|
|
90
102
|
}, /*#__PURE__*/React.createElement(Freeze, {
|
|
91
103
|
frame: firstVideoDurationInFrames,
|
|
92
104
|
active: frame >= firstVideoDurationInFrames
|
|
105
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
106
|
+
style: {
|
|
107
|
+
transform: "translateX(".concat(firstVideoTranslateX, "px)")
|
|
108
|
+
}
|
|
93
109
|
}, firstNoBackgroundFaceMetadata ? /*#__PURE__*/React.createElement(FaceCenteredVideo, {
|
|
94
110
|
startFrom: startFirstVideoFrom,
|
|
95
111
|
src: firstVideoFile,
|
|
96
112
|
faceMetadata: firstNoBackgroundFaceMetadata,
|
|
97
113
|
aspectRatio: orientation,
|
|
98
|
-
containerWidth:
|
|
99
|
-
containerHeight:
|
|
114
|
+
containerWidth: firstRenderVideoWidth,
|
|
115
|
+
containerHeight: firstRenderVideoHeight,
|
|
100
116
|
useAveragePosition: true
|
|
101
117
|
}) : /*#__PURE__*/React.createElement(OffthreadVideo, {
|
|
102
118
|
startFrom: startFirstVideoFrom,
|
|
103
119
|
src: firstVideoFile,
|
|
104
120
|
style: {
|
|
105
|
-
height:
|
|
121
|
+
height: firstRenderVideoHeight,
|
|
106
122
|
objectFit: "cover",
|
|
107
|
-
width:
|
|
123
|
+
width: firstRenderVideoWidth,
|
|
108
124
|
borderRadius: "40px"
|
|
109
125
|
}
|
|
110
|
-
})), /*#__PURE__*/React.createElement(Sequence, {
|
|
126
|
+
}))), /*#__PURE__*/React.createElement(Sequence, {
|
|
111
127
|
from: delayInFrames,
|
|
112
128
|
layout: "none"
|
|
113
129
|
}, secondNoBackgroundFaceMetadata ? /*#__PURE__*/React.createElement(FaceCenteredVideo, {
|
|
@@ -7,6 +7,7 @@ import PausableImg from "../utils/PausableImg";
|
|
|
7
7
|
import { useVirtualBackground } from "../../hooks/useVirtualBackground";
|
|
8
8
|
import { VirtualBackground } from "../backgrounds/VirtualBackground";
|
|
9
9
|
export var SimpleFrame = function SimpleFrame(_ref) {
|
|
10
|
+
var _compositionProps$out, _window, _window$screenplayPro, _window$screenplayPro2;
|
|
10
11
|
var videoUrl = _ref.videoUrl,
|
|
11
12
|
startVideoFrom = _ref.startVideoFrom,
|
|
12
13
|
muted = _ref.muted,
|
|
@@ -18,10 +19,21 @@ export var SimpleFrame = function SimpleFrame(_ref) {
|
|
|
18
19
|
_ref$disableTransitio = _ref.disableTransitionSounds,
|
|
19
20
|
disableTransitionSounds = _ref$disableTransitio === void 0 ? false : _ref$disableTransitio,
|
|
20
21
|
noBackgroundVideoEffects = _ref.noBackgroundVideoEffects,
|
|
21
|
-
noBackgroundVideoUrl = _ref.noBackgroundVideoUrl
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
noBackgroundVideoUrl = _ref.noBackgroundVideoUrl,
|
|
23
|
+
_ref$useSquareInLands = _ref.useSquareInLandscape,
|
|
24
|
+
useSquareInLandscape = _ref$useSquareInLands === void 0 ? false : _ref$useSquareInLands;
|
|
25
|
+
var videoConfig = useVideoConfig();
|
|
26
|
+
var width = videoConfig.width,
|
|
27
|
+
height = videoConfig.height,
|
|
28
|
+
_videoConfig$props = videoConfig.props,
|
|
29
|
+
compositionProps = _videoConfig$props === void 0 ? {} : _videoConfig$props;
|
|
30
|
+
var orientation = (compositionProps === null || compositionProps === void 0 ? void 0 : (_compositionProps$out = compositionProps.output) === null || _compositionProps$out === void 0 ? void 0 : _compositionProps$out.orientation) || (typeof window !== "undefined" ? (_window = window) === null || _window === void 0 ? void 0 : (_window$screenplayPro = _window.screenplayProps) === null || _window$screenplayPro === void 0 ? void 0 : (_window$screenplayPro2 = _window$screenplayPro.output) === null || _window$screenplayPro2 === void 0 ? void 0 : _window$screenplayPro2.orientation : undefined);
|
|
31
|
+
var isLandscapeOutput = orientation === "landscape";
|
|
32
|
+
var shouldUseSquareInLandscape = Boolean(useSquareInLandscape) && isLandscapeOutput;
|
|
33
|
+
var squareSize = 1080;
|
|
34
|
+
var renderWidth = shouldUseSquareInLandscape ? squareSize : width;
|
|
35
|
+
var renderHeight = shouldUseSquareInLandscape ? squareSize : height;
|
|
36
|
+
var offsetX = shouldUseSquareInLandscape ? (width - squareSize) / 2 : 0;
|
|
25
37
|
|
|
26
38
|
// Determine if we should show a virtual background image (orientation-aware)
|
|
27
39
|
var _useVirtualBackground = useVirtualBackground(),
|
|
@@ -37,12 +49,20 @@ export var SimpleFrame = function SimpleFrame(_ref) {
|
|
|
37
49
|
src: "https://cdn.zync.ai/assets/static/swoosh.mp3",
|
|
38
50
|
volume: 0.25
|
|
39
51
|
}), /*#__PURE__*/React.createElement(AbsoluteFill, {
|
|
52
|
+
style: {
|
|
53
|
+
backgroundColor: shouldUseSquareInLandscape ? "black" : "transparent",
|
|
54
|
+
width: width,
|
|
55
|
+
height: height
|
|
56
|
+
}
|
|
57
|
+
}, /*#__PURE__*/React.createElement(AbsoluteFill, {
|
|
40
58
|
style: {
|
|
41
59
|
backgroundColor: frameColor || "transparent",
|
|
42
60
|
padding: frameColor ? CHROME_PADDING : 0,
|
|
43
61
|
isolation: "isolate",
|
|
44
|
-
width:
|
|
45
|
-
height:
|
|
62
|
+
width: renderWidth,
|
|
63
|
+
height: renderHeight,
|
|
64
|
+
left: offsetX,
|
|
65
|
+
top: 0
|
|
46
66
|
}
|
|
47
67
|
}, faceMetadata ? /*#__PURE__*/React.createElement("div", {
|
|
48
68
|
style: {
|
|
@@ -57,8 +77,8 @@ export var SimpleFrame = function SimpleFrame(_ref) {
|
|
|
57
77
|
}, /*#__PURE__*/React.createElement(FaceCenteredVideo, {
|
|
58
78
|
src: videoUrl,
|
|
59
79
|
startFrom: startVideoFrom,
|
|
60
|
-
containerWidth:
|
|
61
|
-
containerHeight:
|
|
80
|
+
containerWidth: renderWidth,
|
|
81
|
+
containerHeight: renderHeight,
|
|
62
82
|
faceMetadata: faceMetadata,
|
|
63
83
|
useAveragePosition: true,
|
|
64
84
|
centerHorizontally: false,
|
|
@@ -88,16 +108,16 @@ export var SimpleFrame = function SimpleFrame(_ref) {
|
|
|
88
108
|
})), /*#__PURE__*/React.createElement(AbsoluteFill, {
|
|
89
109
|
style: {
|
|
90
110
|
margin: frameColor ? CHROME_PADDING : 0,
|
|
91
|
-
width: frameColor ?
|
|
92
|
-
height: frameColor ?
|
|
111
|
+
width: frameColor ? renderWidth - CHROME_PADDING * 2 : renderWidth,
|
|
112
|
+
height: frameColor ? renderHeight - CHROME_PADDING * 2 : renderHeight,
|
|
93
113
|
transform: videoZoom > 1 ? "scale(".concat(videoZoomInterpolated, ")") : undefined
|
|
94
114
|
}
|
|
95
115
|
}, showVirtual && virtualBgUrl ? /*#__PURE__*/React.createElement(VirtualBackground, {
|
|
96
116
|
url: virtualBgUrl
|
|
97
117
|
}) : null), !showVirtual && noBackgroundVideoEffects !== null && noBackgroundVideoEffects !== void 0 && noBackgroundVideoEffects.backgroundBlur && noBackgroundVideoUrl ? /*#__PURE__*/React.createElement(AbsoluteFill, {
|
|
98
118
|
style: {
|
|
99
|
-
width:
|
|
100
|
-
height:
|
|
119
|
+
width: renderWidth,
|
|
120
|
+
height: renderHeight,
|
|
101
121
|
backdropFilter: "blur(10px)",
|
|
102
122
|
zIndex: 1
|
|
103
123
|
}
|
|
@@ -105,8 +125,8 @@ export var SimpleFrame = function SimpleFrame(_ref) {
|
|
|
105
125
|
style: {
|
|
106
126
|
padding: frameColor ? CHROME_PADDING : 0,
|
|
107
127
|
isolation: "isolate",
|
|
108
|
-
width:
|
|
109
|
-
height:
|
|
128
|
+
width: renderWidth,
|
|
129
|
+
height: renderHeight,
|
|
110
130
|
zIndex: 9
|
|
111
131
|
}
|
|
112
132
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -115,13 +135,13 @@ export var SimpleFrame = function SimpleFrame(_ref) {
|
|
|
115
135
|
height: "100%",
|
|
116
136
|
overflow: "hidden",
|
|
117
137
|
borderRadius: "30px",
|
|
118
|
-
transform: videoZoom
|
|
138
|
+
transform: videoZoom ? "scale(".concat(videoZoomInterpolated, ")") : undefined
|
|
119
139
|
}
|
|
120
140
|
}, /*#__PURE__*/React.createElement(FaceCenteredVideo, {
|
|
121
141
|
src: noBackgroundVideoUrl,
|
|
122
142
|
startFrom: startVideoFrom,
|
|
123
|
-
containerWidth:
|
|
124
|
-
containerHeight:
|
|
143
|
+
containerWidth: renderWidth,
|
|
144
|
+
containerHeight: renderHeight,
|
|
125
145
|
faceMetadata: faceMetadata,
|
|
126
146
|
useAveragePosition: true,
|
|
127
147
|
centerHorizontally: false,
|
|
@@ -133,8 +153,8 @@ export var SimpleFrame = function SimpleFrame(_ref) {
|
|
|
133
153
|
backgroundColor: "transparent",
|
|
134
154
|
padding: frameColor ? CHROME_PADDING : 0,
|
|
135
155
|
isolation: "isolate",
|
|
136
|
-
width:
|
|
137
|
-
height:
|
|
156
|
+
width: renderWidth,
|
|
157
|
+
height: renderHeight,
|
|
138
158
|
zIndex: 9
|
|
139
159
|
}
|
|
140
160
|
}, /*#__PURE__*/React.createElement(AbsoluteFill, {
|
|
@@ -165,7 +185,7 @@ export var SimpleFrame = function SimpleFrame(_ref) {
|
|
|
165
185
|
}
|
|
166
186
|
}, children), logoUrl ? /*#__PURE__*/React.createElement("div", {
|
|
167
187
|
style: {
|
|
168
|
-
position: "fixed",
|
|
188
|
+
position: shouldUseSquareInLandscape ? "absolute" : "fixed",
|
|
169
189
|
left: frameColor ? CHROME_PADDING : 25,
|
|
170
190
|
top: frameColor ? CHROME_PADDING : 25,
|
|
171
191
|
padding: 20,
|
|
@@ -179,5 +199,5 @@ export var SimpleFrame = function SimpleFrame(_ref) {
|
|
|
179
199
|
objectFit: "contain"
|
|
180
200
|
},
|
|
181
201
|
src: logoUrl
|
|
182
|
-
})) : null));
|
|
202
|
+
})) : null)));
|
|
183
203
|
};
|
|
@@ -8,34 +8,34 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
8
8
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
9
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
10
10
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
11
|
-
/**
|
|
12
|
-
* Face-Centered Video Component
|
|
13
|
-
*
|
|
14
|
-
* A reusable component that wraps OffthreadVideo to ensure the video is always
|
|
15
|
-
* centered on a person's face within a flexible container.
|
|
16
|
-
*
|
|
17
|
-
* The video maintains its source dimensions and is positioned using translateX/translateY
|
|
18
|
-
* to center the face within the container, regardless of container size.
|
|
11
|
+
/**
|
|
12
|
+
* Face-Centered Video Component
|
|
13
|
+
*
|
|
14
|
+
* A reusable component that wraps OffthreadVideo to ensure the video is always
|
|
15
|
+
* centered on a person's face within a flexible container.
|
|
16
|
+
*
|
|
17
|
+
* The video maintains its source dimensions and is positioned using translateX/translateY
|
|
18
|
+
* to center the face within the container, regardless of container size.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
import React from "react";
|
|
22
22
|
import { OffthreadVideo, useCurrentFrame } from "remotion";
|
|
23
23
|
import { useOrientationBased } from "../../hooks/useOrientationBased.js";
|
|
24
24
|
|
|
25
|
-
/**
|
|
26
|
-
* Calculate face-centered translation for flexible container
|
|
27
|
-
* @param {Object} params - Configuration object
|
|
28
|
-
* @param {Object} params.faceMetadata - Face detection metadata
|
|
29
|
-
* @param {number} params.containerWidth - Container width in pixels
|
|
30
|
-
* @param {number} params.containerHeight - Container height in pixels
|
|
31
|
-
* @param {number} params.currentFrame - Current frame number (optional)
|
|
32
|
-
* @param {boolean} params.enableInterpolation - Whether to interpolate between frames
|
|
33
|
-
* @param {boolean} params.useAveragePosition - Whether to use average face position
|
|
34
|
-
* @param {boolean} params.centerHorizontally - Whether to only center horizontally
|
|
35
|
-
* @param {number} params.translateX - Additional translateX offset
|
|
36
|
-
* @param {number} params.translateY - Additional translateY offset
|
|
37
|
-
* @param {string} params.orientation - Viewport orientation (portrait, square, landscape)
|
|
38
|
-
* @returns {Object} Transform styles and debug info
|
|
25
|
+
/**
|
|
26
|
+
* Calculate face-centered translation for flexible container
|
|
27
|
+
* @param {Object} params - Configuration object
|
|
28
|
+
* @param {Object} params.faceMetadata - Face detection metadata
|
|
29
|
+
* @param {number} params.containerWidth - Container width in pixels
|
|
30
|
+
* @param {number} params.containerHeight - Container height in pixels
|
|
31
|
+
* @param {number} params.currentFrame - Current frame number (optional)
|
|
32
|
+
* @param {boolean} params.enableInterpolation - Whether to interpolate between frames
|
|
33
|
+
* @param {boolean} params.useAveragePosition - Whether to use average face position
|
|
34
|
+
* @param {boolean} params.centerHorizontally - Whether to only center horizontally
|
|
35
|
+
* @param {number} params.translateX - Additional translateX offset
|
|
36
|
+
* @param {number} params.translateY - Additional translateY offset
|
|
37
|
+
* @param {string} params.orientation - Viewport orientation (portrait, square, landscape)
|
|
38
|
+
* @returns {Object} Transform styles and debug info
|
|
39
39
|
*/
|
|
40
40
|
var calculateFaceCenteredTranslation = function calculateFaceCenteredTranslation(_ref) {
|
|
41
41
|
var _faceMetadata$metadat, _faceMetadata$metadat2;
|
|
@@ -214,8 +214,8 @@ var calculateFaceCenteredTranslation = function calculateFaceCenteredTranslation
|
|
|
214
214
|
};
|
|
215
215
|
};
|
|
216
216
|
|
|
217
|
-
/**
|
|
218
|
-
* Get face data for a specific frame with optional interpolation
|
|
217
|
+
/**
|
|
218
|
+
* Get face data for a specific frame with optional interpolation
|
|
219
219
|
*/
|
|
220
220
|
function getFaceDataForFrame(frames, frameIndex, enableInterpolation) {
|
|
221
221
|
var _prevFrame, _nextFrame;
|
|
@@ -274,8 +274,8 @@ function getFaceDataForFrame(frames, frameIndex, enableInterpolation) {
|
|
|
274
274
|
return ((_prevFrame = prevFrame) === null || _prevFrame === void 0 ? void 0 : _prevFrame.data) || ((_nextFrame = nextFrame) === null || _nextFrame === void 0 ? void 0 : _nextFrame.data) || null;
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
-
/**
|
|
278
|
-
* Calculate average face position from all frames with face data
|
|
277
|
+
/**
|
|
278
|
+
* Calculate average face position from all frames with face data
|
|
279
279
|
*/
|
|
280
280
|
function getAverageFaceData(frames) {
|
|
281
281
|
if (!frames || frames.length === 0) return null;
|
|
@@ -310,14 +310,14 @@ function getAverageFaceData(frames) {
|
|
|
310
310
|
};
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
/**
|
|
314
|
-
* Calculate the negative space offset when face-centering a video
|
|
315
|
-
*
|
|
316
|
-
* @param {Object} faceMetadata - Face detection metadata object
|
|
317
|
-
* @param {number} containerWidth - Container width in pixels
|
|
318
|
-
* @param {number} containerHeight - Container height in pixels
|
|
319
|
-
* @param {number} scale - Scale factor applied to the video
|
|
320
|
-
* @returns {Object} Object containing horizontal and vertical offsets and which side has negative space
|
|
313
|
+
/**
|
|
314
|
+
* Calculate the negative space offset when face-centering a video
|
|
315
|
+
*
|
|
316
|
+
* @param {Object} faceMetadata - Face detection metadata object
|
|
317
|
+
* @param {number} containerWidth - Container width in pixels
|
|
318
|
+
* @param {number} containerHeight - Container height in pixels
|
|
319
|
+
* @param {number} scale - Scale factor applied to the video
|
|
320
|
+
* @returns {Object} Object containing horizontal and vertical offsets and which side has negative space
|
|
321
321
|
*/
|
|
322
322
|
export var calculateNegativeSpaceOffset = function calculateNegativeSpaceOffset(faceMetadata, containerWidth, containerHeight) {
|
|
323
323
|
var _faceMetadata$metadat4, _faceMetadata$metadat5;
|
|
@@ -415,22 +415,22 @@ export var calculateNegativeSpaceOffset = function calculateNegativeSpaceOffset(
|
|
|
415
415
|
};
|
|
416
416
|
};
|
|
417
417
|
|
|
418
|
-
/**
|
|
419
|
-
* FaceCenteredVideo Component
|
|
420
|
-
* @param {Object} props - Component props
|
|
421
|
-
* @param {string} props.src - Video source URL
|
|
422
|
-
* @param {Object} props.faceMetadata - Face detection metadata
|
|
423
|
-
* @param {number} props.containerWidth - Container width in pixels (required)
|
|
424
|
-
* @param {number} props.containerHeight - Container height in pixels (required)
|
|
425
|
-
* @param {boolean} props.enableInterpolation - Whether to interpolate between frames
|
|
426
|
-
* @param {boolean} props.useAveragePosition - Whether to use average face position for entire video duration
|
|
427
|
-
* @param {boolean} props.centerHorizontally - Whether to only center horizontally (X axis), not vertically (Y axis)
|
|
428
|
-
* @param {number} props.translateX - Additional translateX offset (optional)
|
|
429
|
-
* @param {number} props.translateY - Additional translateY offset (optional)
|
|
430
|
-
* @param {boolean} props.showDebugInfo - Whether to show debug information
|
|
431
|
-
* @param {Object} props.style - Additional styles to apply to video
|
|
432
|
-
* @param {string} props.className - CSS class name
|
|
433
|
-
* @param {...Object} props.otherProps - Other props to pass to OffthreadVideo
|
|
418
|
+
/**
|
|
419
|
+
* FaceCenteredVideo Component
|
|
420
|
+
* @param {Object} props - Component props
|
|
421
|
+
* @param {string} props.src - Video source URL
|
|
422
|
+
* @param {Object} props.faceMetadata - Face detection metadata
|
|
423
|
+
* @param {number} props.containerWidth - Container width in pixels (required)
|
|
424
|
+
* @param {number} props.containerHeight - Container height in pixels (required)
|
|
425
|
+
* @param {boolean} props.enableInterpolation - Whether to interpolate between frames
|
|
426
|
+
* @param {boolean} props.useAveragePosition - Whether to use average face position for entire video duration
|
|
427
|
+
* @param {boolean} props.centerHorizontally - Whether to only center horizontally (X axis), not vertically (Y axis)
|
|
428
|
+
* @param {number} props.translateX - Additional translateX offset (optional)
|
|
429
|
+
* @param {number} props.translateY - Additional translateY offset (optional)
|
|
430
|
+
* @param {boolean} props.showDebugInfo - Whether to show debug information
|
|
431
|
+
* @param {Object} props.style - Additional styles to apply to video
|
|
432
|
+
* @param {string} props.className - CSS class name
|
|
433
|
+
* @param {...Object} props.otherProps - Other props to pass to OffthreadVideo
|
|
434
434
|
*/
|
|
435
435
|
export var FaceCenteredVideo = function FaceCenteredVideo(_ref2) {
|
|
436
436
|
var _faceMetadata$metadat7, _faceMetadata$metadat8, _faceMetadata$metadat9, _faceMetadata$metadat10;
|
|
@@ -15,10 +15,10 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
15
15
|
import React, { useEffect, useState } from "react";
|
|
16
16
|
import { Img, delayRender, continueRender } from "remotion";
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* PausableImg component that extends Remotion's Img with fetch validation.
|
|
20
|
-
* It delays rendering until the image source can be successfully fetched.
|
|
21
|
-
* If there's an error fetching the image, it renders nothing.
|
|
18
|
+
/**
|
|
19
|
+
* PausableImg component that extends Remotion's Img with fetch validation.
|
|
20
|
+
* It delays rendering until the image source can be successfully fetched.
|
|
21
|
+
* If there's an error fetching the image, it renders nothing.
|
|
22
22
|
*/
|
|
23
23
|
export var PausableImg = /*#__PURE__*/React.memo(function (_ref) {
|
|
24
24
|
var src = _ref.src,
|