@zync/zync-screnplay-player 0.1.233 → 0.1.235

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.
@@ -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,
@@ -0,0 +1,221 @@
1
+ import React from "react";
2
+ import { AbsoluteFill, Audio, Easing, interpolate, OffthreadVideo, useCurrentFrame, useVideoConfig, Video } from "remotion";
3
+ import { useOrientationBased } from "../../hooks/useOrientationBased.js";
4
+ import FaceCenteredVideo from "../utils/FaceCenteredVideo";
5
+ var ANIMATION_SECONDS = 1.2;
6
+ var INSET_ASPECT_RATIO = 9 / 16;
7
+ var getInsetMetrics = function getInsetMetrics(_ref) {
8
+ var width = _ref.width,
9
+ height = _ref.height,
10
+ outputOrientation = _ref.outputOrientation;
11
+ var padding = Math.max(32, Math.min(width, height) * 0.045);
12
+ var rawWidth = width * 0.24;
13
+ var maxWidthByHeight = (height - padding * 2) * INSET_ASPECT_RATIO;
14
+ var insetWidth = Math.min(rawWidth, maxWidthByHeight, 360);
15
+ var finalWidth = outputOrientation === "portrait" ? Math.min(insetWidth, width * 0.36) : insetWidth;
16
+ var finalHeight = finalWidth / INSET_ASPECT_RATIO;
17
+ return {
18
+ borderRadius: Math.max(18, finalWidth * 0.06),
19
+ height: finalHeight,
20
+ left: padding,
21
+ top: height - padding - finalHeight,
22
+ width: finalWidth
23
+ };
24
+ };
25
+ var SourceVideo = function SourceVideo(_ref2) {
26
+ var faceMetadata = _ref2.faceMetadata,
27
+ height = _ref2.height,
28
+ noBackgroundVideoEffects = _ref2.noBackgroundVideoEffects,
29
+ sourceVideoOrientation = _ref2.sourceVideoOrientation,
30
+ src = _ref2.src,
31
+ startVideoFrom = _ref2.startVideoFrom,
32
+ transparent = _ref2.transparent,
33
+ width = _ref2.width;
34
+ if (!src) {
35
+ return null;
36
+ }
37
+ if (faceMetadata) {
38
+ return /*#__PURE__*/React.createElement(FaceCenteredVideo, {
39
+ startFrom: startVideoFrom,
40
+ src: src,
41
+ faceMetadata: faceMetadata,
42
+ containerWidth: width,
43
+ containerHeight: height,
44
+ useAveragePosition: true,
45
+ centerHorizontally: false,
46
+ transparent: transparent,
47
+ muted: false,
48
+ noBackgroundVideoEffects: noBackgroundVideoEffects,
49
+ style: {
50
+ filter: transparent && noBackgroundVideoEffects !== null && noBackgroundVideoEffects !== void 0 && noBackgroundVideoEffects.facePop ? "brightness(1.1) contrast(1.15) saturate(1.05)" : undefined
51
+ }
52
+ });
53
+ }
54
+ return /*#__PURE__*/React.createElement(OffthreadVideo, {
55
+ pauseWhenBuffering: true,
56
+ startFrom: startVideoFrom,
57
+ src: src,
58
+ muted: false,
59
+ transparent: transparent,
60
+ style: {
61
+ filter: transparent && noBackgroundVideoEffects !== null && noBackgroundVideoEffects !== void 0 && noBackgroundVideoEffects.facePop ? "brightness(1.1) contrast(1.15) saturate(1.05)" : undefined,
62
+ height: "100%",
63
+ objectFit: "cover",
64
+ objectPosition: sourceVideoOrientation === "portrait" ? "0% 30%" : undefined,
65
+ width: "100%"
66
+ }
67
+ });
68
+ };
69
+ var BrollInsetContent = function BrollInsetContent(_ref3) {
70
+ var brollUrl = _ref3.brollUrl,
71
+ children = _ref3.children,
72
+ disableTransitionSounds = _ref3.disableTransitionSounds,
73
+ faceMetadata = _ref3.faceMetadata,
74
+ frameColor = _ref3.frameColor,
75
+ height = _ref3.height,
76
+ noBackgroundVideoEffects = _ref3.noBackgroundVideoEffects,
77
+ noBackgroundVideoUrl = _ref3.noBackgroundVideoUrl,
78
+ outputOrientation = _ref3.outputOrientation,
79
+ sourceVideoOrientation = _ref3.sourceVideoOrientation,
80
+ startVideoFrom = _ref3.startVideoFrom,
81
+ videoUrl = _ref3.videoUrl,
82
+ width = _ref3.width;
83
+ var frame = useCurrentFrame();
84
+ var _useVideoConfig = useVideoConfig(),
85
+ fps = _useVideoConfig.fps;
86
+ var animationFrames = fps * ANIMATION_SECONDS;
87
+ var progress = interpolate(frame, [0, animationFrames], [0, 1], {
88
+ easing: Easing.out(Easing.cubic),
89
+ extrapolateLeft: "clamp",
90
+ extrapolateRight: "clamp"
91
+ });
92
+ var sourceSrc = noBackgroundVideoUrl || videoUrl;
93
+ var sourceTransparent = Boolean(noBackgroundVideoUrl);
94
+ var inset = getInsetMetrics({
95
+ width: width,
96
+ height: height,
97
+ outputOrientation: outputOrientation
98
+ });
99
+ var sourceWidth = interpolate(progress, [0, 1], [width, inset.width]);
100
+ var sourceHeight = interpolate(progress, [0, 1], [height, inset.height]);
101
+ var sourceLeft = interpolate(progress, [0, 1], [0, inset.left]);
102
+ var sourceTop = interpolate(progress, [0, 1], [0, inset.top]);
103
+ var sourceBorderRadius = interpolate(progress, [0, 1], [0, inset.borderRadius]);
104
+ return /*#__PURE__*/React.createElement(React.Fragment, null, !disableTransitionSounds && /*#__PURE__*/React.createElement(Audio, {
105
+ src: "https://cdn.zync.ai/assets/static/swoosh.mp3",
106
+ volume: 0.25
107
+ }), /*#__PURE__*/React.createElement(AbsoluteFill, {
108
+ style: {
109
+ backgroundColor: frameColor || "black",
110
+ height: height,
111
+ overflow: "hidden",
112
+ width: width
113
+ }
114
+ }, brollUrl ? /*#__PURE__*/React.createElement(Video, {
115
+ src: brollUrl,
116
+ loop: true,
117
+ muted: true,
118
+ style: {
119
+ height: "100%",
120
+ objectFit: "cover",
121
+ width: "100%"
122
+ }
123
+ }) : null, /*#__PURE__*/React.createElement("div", {
124
+ style: {
125
+ borderRadius: sourceBorderRadius,
126
+ boxShadow: progress > 0 ? "0 ".concat(16 * progress, "px ").concat(44 * progress, "px rgba(0, 0, 0, ").concat(0.34 * progress, ")") : undefined,
127
+ height: sourceHeight,
128
+ left: sourceLeft,
129
+ overflow: "hidden",
130
+ position: "absolute",
131
+ top: sourceTop,
132
+ width: sourceWidth,
133
+ zIndex: 2
134
+ }
135
+ }, /*#__PURE__*/React.createElement(SourceVideo, {
136
+ faceMetadata: faceMetadata,
137
+ height: sourceHeight,
138
+ noBackgroundVideoEffects: noBackgroundVideoEffects,
139
+ sourceVideoOrientation: sourceVideoOrientation,
140
+ src: sourceSrc,
141
+ startVideoFrom: startVideoFrom,
142
+ transparent: sourceTransparent,
143
+ width: sourceWidth
144
+ })), /*#__PURE__*/React.createElement(AbsoluteFill, {
145
+ style: {
146
+ zIndex: 3
147
+ }
148
+ }, children)));
149
+ };
150
+ export var BrollInset = function BrollInset(_ref4) {
151
+ var _compositionProps$out, _window, _window$screenplayPro, _window$screenplayPro2;
152
+ var brollUrl = _ref4.brollUrl,
153
+ children = _ref4.children,
154
+ _ref4$disableTransiti = _ref4.disableTransitionSounds,
155
+ disableTransitionSounds = _ref4$disableTransiti === void 0 ? false : _ref4$disableTransiti,
156
+ faceMetadata = _ref4.faceMetadata,
157
+ frameColor = _ref4.frameColor,
158
+ noBackgroundVideoEffects = _ref4.noBackgroundVideoEffects,
159
+ noBackgroundVideoUrl = _ref4.noBackgroundVideoUrl,
160
+ sourceVideoOrientation = _ref4.sourceVideoOrientation,
161
+ startVideoFrom = _ref4.startVideoFrom,
162
+ _ref4$useSquareInLand = _ref4.useSquareInLandscape,
163
+ useSquareInLandscape = _ref4$useSquareInLand === void 0 ? false : _ref4$useSquareInLand,
164
+ videoUrl = _ref4.videoUrl;
165
+ var _useVideoConfig2 = useVideoConfig(),
166
+ outputWidth = _useVideoConfig2.width,
167
+ outputHeight = _useVideoConfig2.height,
168
+ _useVideoConfig2$prop = _useVideoConfig2.props,
169
+ compositionProps = _useVideoConfig2$prop === void 0 ? {} : _useVideoConfig2$prop;
170
+ 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);
171
+ var shouldUseSquareInLandscape = Boolean(useSquareInLandscape) && outputOrientation === "landscape";
172
+ var squareSize = 1080;
173
+ var width = shouldUseSquareInLandscape ? squareSize : outputWidth;
174
+ var height = shouldUseSquareInLandscape ? squareSize : outputHeight;
175
+ var renderOffsetX = shouldUseSquareInLandscape ? (outputWidth - squareSize) / 2 : 0;
176
+ var orientationOverride = shouldUseSquareInLandscape ? "square" : undefined;
177
+ var _useOrientationBased = useOrientationBased({
178
+ portrait: {
179
+ activeOrientation: "portrait"
180
+ },
181
+ landscape: {
182
+ activeOrientation: "landscape"
183
+ },
184
+ square: {
185
+ activeOrientation: "square"
186
+ }
187
+ }, orientationOverride),
188
+ activeOrientation = _useOrientationBased.activeOrientation;
189
+ var content = /*#__PURE__*/React.createElement(BrollInsetContent, {
190
+ brollUrl: brollUrl,
191
+ disableTransitionSounds: disableTransitionSounds,
192
+ faceMetadata: faceMetadata,
193
+ frameColor: frameColor,
194
+ height: height,
195
+ noBackgroundVideoEffects: noBackgroundVideoEffects,
196
+ noBackgroundVideoUrl: noBackgroundVideoUrl,
197
+ outputOrientation: activeOrientation,
198
+ sourceVideoOrientation: sourceVideoOrientation,
199
+ startVideoFrom: startVideoFrom,
200
+ videoUrl: videoUrl,
201
+ width: width
202
+ }, children);
203
+ if (!shouldUseSquareInLandscape) {
204
+ return content;
205
+ }
206
+ return /*#__PURE__*/React.createElement(AbsoluteFill, {
207
+ style: {
208
+ backgroundColor: "black",
209
+ height: outputHeight,
210
+ width: outputWidth
211
+ }
212
+ }, /*#__PURE__*/React.createElement(AbsoluteFill, {
213
+ style: {
214
+ height: height,
215
+ left: renderOffsetX,
216
+ overflow: "hidden",
217
+ top: 0,
218
+ width: width
219
+ }
220
+ }, content));
221
+ };
@@ -0,0 +1,232 @@
1
+ import React from "react";
2
+ import { AbsoluteFill, Audio, Easing, Img, interpolate, OffthreadVideo, useCurrentFrame, useVideoConfig } from "remotion";
3
+ import { useOrientationBased } from "../../hooks/useOrientationBased.js";
4
+ import FaceCenteredVideo from "../utils/FaceCenteredVideo";
5
+ var ANIMATION_SECONDS = 1.2;
6
+ var INSET_ASPECT_RATIO = 9 / 16;
7
+ var getInsetMetrics = function getInsetMetrics(_ref) {
8
+ var width = _ref.width,
9
+ height = _ref.height,
10
+ outputOrientation = _ref.outputOrientation;
11
+ var padding = Math.max(32, Math.min(width, height) * 0.045);
12
+ var rawWidth = width * 0.24;
13
+ var maxWidthByHeight = (height - padding * 2) * INSET_ASPECT_RATIO;
14
+ var insetWidth = Math.min(rawWidth, maxWidthByHeight, 360);
15
+ var finalWidth = outputOrientation === "portrait" ? Math.min(insetWidth, width * 0.36) : insetWidth;
16
+ var finalHeight = finalWidth / INSET_ASPECT_RATIO;
17
+ return {
18
+ borderRadius: Math.max(18, finalWidth * 0.06),
19
+ height: finalHeight,
20
+ left: padding,
21
+ top: height - padding - finalHeight,
22
+ width: finalWidth
23
+ };
24
+ };
25
+ var SourceVideo = function SourceVideo(_ref2) {
26
+ var faceMetadata = _ref2.faceMetadata,
27
+ height = _ref2.height,
28
+ noBackgroundVideoEffects = _ref2.noBackgroundVideoEffects,
29
+ sourceVideoOrientation = _ref2.sourceVideoOrientation,
30
+ src = _ref2.src,
31
+ startVideoFrom = _ref2.startVideoFrom,
32
+ transparent = _ref2.transparent,
33
+ width = _ref2.width;
34
+ if (!src) {
35
+ return null;
36
+ }
37
+ if (faceMetadata) {
38
+ return /*#__PURE__*/React.createElement(FaceCenteredVideo, {
39
+ startFrom: startVideoFrom,
40
+ src: src,
41
+ faceMetadata: faceMetadata,
42
+ containerWidth: width,
43
+ containerHeight: height,
44
+ useAveragePosition: true,
45
+ centerHorizontally: false,
46
+ transparent: transparent,
47
+ muted: false,
48
+ noBackgroundVideoEffects: noBackgroundVideoEffects,
49
+ style: {
50
+ filter: transparent && noBackgroundVideoEffects !== null && noBackgroundVideoEffects !== void 0 && noBackgroundVideoEffects.facePop ? "brightness(1.1) contrast(1.15) saturate(1.05)" : undefined
51
+ }
52
+ });
53
+ }
54
+ return /*#__PURE__*/React.createElement(OffthreadVideo, {
55
+ pauseWhenBuffering: true,
56
+ startFrom: startVideoFrom,
57
+ src: src,
58
+ muted: false,
59
+ transparent: transparent,
60
+ style: {
61
+ filter: transparent && noBackgroundVideoEffects !== null && noBackgroundVideoEffects !== void 0 && noBackgroundVideoEffects.facePop ? "brightness(1.1) contrast(1.15) saturate(1.05)" : undefined,
62
+ height: "100%",
63
+ objectFit: "cover",
64
+ objectPosition: sourceVideoOrientation === "portrait" ? "0% 30%" : undefined,
65
+ width: "100%"
66
+ }
67
+ });
68
+ };
69
+ var MotionStillInsetContent = function MotionStillInsetContent(_ref3) {
70
+ var children = _ref3.children,
71
+ disableTransitionSounds = _ref3.disableTransitionSounds,
72
+ durationInFrames = _ref3.durationInFrames,
73
+ faceMetadata = _ref3.faceMetadata,
74
+ frameColor = _ref3.frameColor,
75
+ height = _ref3.height,
76
+ imageUrl = _ref3.imageUrl,
77
+ noBackgroundVideoEffects = _ref3.noBackgroundVideoEffects,
78
+ noBackgroundVideoUrl = _ref3.noBackgroundVideoUrl,
79
+ outputOrientation = _ref3.outputOrientation,
80
+ sourceVideoOrientation = _ref3.sourceVideoOrientation,
81
+ startVideoFrom = _ref3.startVideoFrom,
82
+ videoUrl = _ref3.videoUrl,
83
+ width = _ref3.width;
84
+ var frame = useCurrentFrame();
85
+ var _useVideoConfig = useVideoConfig(),
86
+ fps = _useVideoConfig.fps;
87
+ var animationFrames = fps * ANIMATION_SECONDS;
88
+ var progress = interpolate(frame, [0, animationFrames], [0, 1], {
89
+ easing: Easing.out(Easing.cubic),
90
+ extrapolateLeft: "clamp",
91
+ extrapolateRight: "clamp"
92
+ });
93
+ var sourceSrc = noBackgroundVideoUrl || videoUrl;
94
+ var sourceTransparent = Boolean(noBackgroundVideoUrl);
95
+ var inset = getInsetMetrics({
96
+ width: width,
97
+ height: height,
98
+ outputOrientation: outputOrientation
99
+ });
100
+ var sourceWidth = interpolate(progress, [0, 1], [width, inset.width]);
101
+ var sourceHeight = interpolate(progress, [0, 1], [height, inset.height]);
102
+ var sourceLeft = interpolate(progress, [0, 1], [0, inset.left]);
103
+ var sourceTop = interpolate(progress, [0, 1], [0, inset.top]);
104
+ var sourceBorderRadius = interpolate(progress, [0, 1], [0, inset.borderRadius]);
105
+ var imagePanProgress = interpolate(frame, [0, Math.max(1, (durationInFrames || 1) - 1)], [0, 1], {
106
+ extrapolateLeft: "clamp",
107
+ extrapolateRight: "clamp"
108
+ });
109
+ var shouldPanImage = outputOrientation === "square" || outputOrientation === "portrait";
110
+ return /*#__PURE__*/React.createElement(React.Fragment, null, !disableTransitionSounds && /*#__PURE__*/React.createElement(Audio, {
111
+ src: "https://cdn.zync.ai/assets/static/swoosh.mp3",
112
+ volume: 0.25
113
+ }), /*#__PURE__*/React.createElement(AbsoluteFill, {
114
+ style: {
115
+ backgroundColor: frameColor || "black",
116
+ height: height,
117
+ overflow: "hidden",
118
+ width: width
119
+ }
120
+ }, imageUrl ? /*#__PURE__*/React.createElement(Img, {
121
+ src: imageUrl,
122
+ style: {
123
+ height: "100%",
124
+ left: shouldPanImage ? imagePanProgress * width : undefined,
125
+ maxWidth: shouldPanImage ? "none" : undefined,
126
+ objectFit: shouldPanImage ? undefined : "cover",
127
+ position: shouldPanImage ? "absolute" : undefined,
128
+ top: 0,
129
+ transform: shouldPanImage ? "translateX(-".concat(imagePanProgress * 100, "%)") : undefined,
130
+ width: shouldPanImage ? "auto" : "100%"
131
+ }
132
+ }) : null, /*#__PURE__*/React.createElement("div", {
133
+ style: {
134
+ borderRadius: sourceBorderRadius,
135
+ boxShadow: progress > 0 ? "0 ".concat(16 * progress, "px ").concat(44 * progress, "px rgba(0, 0, 0, ").concat(0.34 * progress, ")") : undefined,
136
+ height: sourceHeight,
137
+ left: sourceLeft,
138
+ overflow: "hidden",
139
+ position: "absolute",
140
+ top: sourceTop,
141
+ width: sourceWidth,
142
+ zIndex: 2
143
+ }
144
+ }, /*#__PURE__*/React.createElement(SourceVideo, {
145
+ faceMetadata: faceMetadata,
146
+ height: sourceHeight,
147
+ noBackgroundVideoEffects: noBackgroundVideoEffects,
148
+ sourceVideoOrientation: sourceVideoOrientation,
149
+ src: sourceSrc,
150
+ startVideoFrom: startVideoFrom,
151
+ transparent: sourceTransparent,
152
+ width: sourceWidth
153
+ })), /*#__PURE__*/React.createElement(AbsoluteFill, {
154
+ style: {
155
+ zIndex: 3
156
+ }
157
+ }, children)));
158
+ };
159
+ export var MotionStillInset = function MotionStillInset(_ref4) {
160
+ var _compositionProps$out, _window, _window$screenplayPro, _window$screenplayPro2;
161
+ var children = _ref4.children,
162
+ _ref4$disableTransiti = _ref4.disableTransitionSounds,
163
+ disableTransitionSounds = _ref4$disableTransiti === void 0 ? false : _ref4$disableTransiti,
164
+ durationInFrames = _ref4.durationInFrames,
165
+ faceMetadata = _ref4.faceMetadata,
166
+ frameColor = _ref4.frameColor,
167
+ imageUrl = _ref4.imageUrl,
168
+ noBackgroundVideoEffects = _ref4.noBackgroundVideoEffects,
169
+ noBackgroundVideoUrl = _ref4.noBackgroundVideoUrl,
170
+ sourceVideoOrientation = _ref4.sourceVideoOrientation,
171
+ startVideoFrom = _ref4.startVideoFrom,
172
+ _ref4$useSquareInLand = _ref4.useSquareInLandscape,
173
+ useSquareInLandscape = _ref4$useSquareInLand === void 0 ? false : _ref4$useSquareInLand,
174
+ videoUrl = _ref4.videoUrl;
175
+ var _useVideoConfig2 = useVideoConfig(),
176
+ outputWidth = _useVideoConfig2.width,
177
+ outputHeight = _useVideoConfig2.height,
178
+ _useVideoConfig2$prop = _useVideoConfig2.props,
179
+ compositionProps = _useVideoConfig2$prop === void 0 ? {} : _useVideoConfig2$prop;
180
+ 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);
181
+ var shouldUseSquareInLandscape = Boolean(useSquareInLandscape) && outputOrientation === "landscape";
182
+ var squareSize = 1080;
183
+ var width = shouldUseSquareInLandscape ? squareSize : outputWidth;
184
+ var height = shouldUseSquareInLandscape ? squareSize : outputHeight;
185
+ var renderOffsetX = shouldUseSquareInLandscape ? (outputWidth - squareSize) / 2 : 0;
186
+ var orientationOverride = shouldUseSquareInLandscape ? "square" : undefined;
187
+ var _useOrientationBased = useOrientationBased({
188
+ portrait: {
189
+ activeOrientation: "portrait"
190
+ },
191
+ landscape: {
192
+ activeOrientation: "landscape"
193
+ },
194
+ square: {
195
+ activeOrientation: "square"
196
+ }
197
+ }, orientationOverride),
198
+ activeOrientation = _useOrientationBased.activeOrientation;
199
+ var content = /*#__PURE__*/React.createElement(MotionStillInsetContent, {
200
+ disableTransitionSounds: disableTransitionSounds,
201
+ durationInFrames: durationInFrames,
202
+ faceMetadata: faceMetadata,
203
+ frameColor: frameColor,
204
+ height: height,
205
+ imageUrl: imageUrl,
206
+ noBackgroundVideoEffects: noBackgroundVideoEffects,
207
+ noBackgroundVideoUrl: noBackgroundVideoUrl,
208
+ outputOrientation: activeOrientation,
209
+ sourceVideoOrientation: sourceVideoOrientation,
210
+ startVideoFrom: startVideoFrom,
211
+ videoUrl: videoUrl,
212
+ width: width
213
+ }, children);
214
+ if (!shouldUseSquareInLandscape) {
215
+ return content;
216
+ }
217
+ return /*#__PURE__*/React.createElement(AbsoluteFill, {
218
+ style: {
219
+ backgroundColor: "black",
220
+ height: outputHeight,
221
+ width: outputWidth
222
+ }
223
+ }, /*#__PURE__*/React.createElement(AbsoluteFill, {
224
+ style: {
225
+ height: height,
226
+ left: renderOffsetX,
227
+ overflow: "hidden",
228
+ top: 0,
229
+ width: width
230
+ }
231
+ }, content));
232
+ };
@@ -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,