@zync/zync-screnplay-player 0.1.205 → 0.1.207
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 +18 -14
- package/dist/screenplay/RemotionRenderer/components/LottieAnimationGlobal.js +21 -21
- package/dist/screenplay/RemotionRenderer/components/layouts/DynamicTriangle.js +36 -6
- package/dist/screenplay/RemotionRenderer/components/layouts/Handoff.js +20 -7
- package/dist/screenplay/RemotionRenderer/components/layouts/IntroVideo.js +45 -8
- package/dist/screenplay/RemotionRenderer/components/layouts/Keyword.js +42 -9
- package/dist/screenplay/RemotionRenderer/components/layouts/KeywordStudioBackdrop.js +47 -10
- package/dist/screenplay/RemotionRenderer/components/layouts/MotionStill.js +42 -9
- package/dist/screenplay/RemotionRenderer/components/layouts/MotionStillStudioBackdrop.js +46 -9
- package/dist/screenplay/RemotionRenderer/components/layouts/SimpleFrame.js +21 -12
- package/dist/screenplay/RemotionRenderer/components/layouts/TextWithVideo.js +41 -8
- 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/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/hooks/useOrientationBased.js +7 -3
- package/dist/screenplay/RemotionRenderer/main/lib/layouts/DefaultLayout.js +2 -1
- package/dist/screenplay/RemotionRenderer/main/lib/layouts/DynamicTriangleLayout.js +3 -2
- package/dist/screenplay/RemotionRenderer/main/lib/layouts/HandoffLayout.js +3 -2
- package/dist/screenplay/RemotionRenderer/main/lib/layouts/IntroVideoLayout.js +3 -1
- package/dist/screenplay/RemotionRenderer/main/lib/layouts/KeywordLayout.js +3 -2
- package/dist/screenplay/RemotionRenderer/main/lib/layouts/MotionStillLayout.js +3 -2
- package/dist/screenplay/RemotionRenderer/main/lib/layouts/TextWithVideoLayout.js +3 -2
- 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 +9 -2
- package/dist/screenplay/RemotionRenderer/tracks/LayoutVideoTrack.js +20 -20
- package/package.json +47 -47
|
@@ -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,
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
# StretchText Component
|
|
2
|
-
|
|
3
|
-
A React component that renders text that stretches to fit the parent's width. Words with fewer characters will have a larger font size than words with more characters. The component uses SVG for rendering text, which ensures proper text-stroke rendering in headless mode.
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
```jsx
|
|
8
|
-
import StretchText from './StretchText';
|
|
9
|
-
|
|
10
|
-
// Basic usage
|
|
11
|
-
<StretchText text="Hello World" />
|
|
12
|
-
|
|
13
|
-
// With custom styling
|
|
14
|
-
<StretchText
|
|
15
|
-
text="Contribution"
|
|
16
|
-
color="#1a73e8"
|
|
17
|
-
fontFamily="Arial"
|
|
18
|
-
maxFontSize={200}
|
|
19
|
-
minFontSize={10}
|
|
20
|
-
style={{ fontWeight: 'bold' }}
|
|
21
|
-
/>
|
|
22
|
-
|
|
23
|
-
// With text stroke
|
|
24
|
-
<StretchText
|
|
25
|
-
text="Outlined Text"
|
|
26
|
-
color="transparent"
|
|
27
|
-
textStrokeColor="white"
|
|
28
|
-
textStrokeWidth="2px"
|
|
29
|
-
style={{ fontWeight: 'bold' }}
|
|
30
|
-
/>
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Props
|
|
34
|
-
|
|
35
|
-
| Prop | Type | Default | Description |
|
|
36
|
-
|------|------|---------|-------------|
|
|
37
|
-
| `text` | string | required | The text to display |
|
|
38
|
-
| `color` | string | '#000000' | Text color |
|
|
39
|
-
| `fontFamily` | string | 'Arial' | Font family |
|
|
40
|
-
| `maxFontSize` | number | 100 | Maximum font size in pixels |
|
|
41
|
-
| `minFontSize` | number | 10 | Minimum font size in pixels |
|
|
42
|
-
| `textStrokeColor` | string | undefined | Color of the text stroke |
|
|
43
|
-
| `textStrokeWidth` | string | undefined | Width of the text stroke (e.g., '2px') |
|
|
44
|
-
| `textFillColor` | string | undefined | Color of the text fill (overrides `color` if provided) |
|
|
45
|
-
| `style` | object | {} | Additional style properties |
|
|
46
|
-
|
|
47
|
-
## Examples
|
|
48
|
-
|
|
49
|
-
The component automatically calculates the appropriate font size to make the text stretch to fit the parent width. For example:
|
|
50
|
-
|
|
51
|
-
- "Work" (4 characters) will have a larger font size than "Contribution" (12 characters) when both are rendered in containers of the same width.
|
|
52
|
-
- The text will always be contained within the parent container and will not overflow.
|
|
53
|
-
- The component recalculates the font size when the window is resized.
|
|
54
|
-
|
|
55
|
-
## Demo
|
|
56
|
-
|
|
57
|
-
You can see a demo of the StretchText component by running the development environment and looking at the first segment in the video timeline.
|
|
58
|
-
|
|
59
|
-
The demo shows several words of different lengths rendered in containers of the same width:
|
|
60
|
-
|
|
61
|
-
- "Contribution" (longer word, smaller font)
|
|
62
|
-
- "Work" (shorter word, larger font)
|
|
63
|
-
- "Hello" (medium length word, medium font)
|
|
64
|
-
- "Supercalifragilisticexpialidocious" (very long word, very small font)
|
|
65
|
-
|
|
66
|
-
Each word stretches to fill the entire width of its container, demonstrating how the component automatically adjusts the font size based on the text length.
|
|
67
|
-
|
|
68
|
-
## Implementation Details
|
|
69
|
-
|
|
70
|
-
The component uses a binary search algorithm to find the optimal font size that makes the text fit the parent width. It uses a simple approximation for text width calculation (character count * fontSize * 0.75) which works well for most fonts.
|
|
71
|
-
|
|
72
|
-
The component uses SVG for rendering text, which provides several advantages:
|
|
73
|
-
- Proper text-stroke rendering in headless mode
|
|
74
|
-
- Better control over text positioning and alignment
|
|
75
|
-
- Consistent rendering across different browsers and environments
|
|
76
|
-
- Support for advanced SVG features like filters for text shadows
|
|
77
|
-
|
|
78
|
-
For text with stroke effects, the component uses SVG's native stroke and fill attributes, which are more reliable than CSS text-stroke properties, especially in headless rendering environments.
|
|
79
|
-
|
|
80
|
-
The component also includes a resize listener to recalculate the font size when the window size changes.
|
|
1
|
+
# StretchText Component
|
|
2
|
+
|
|
3
|
+
A React component that renders text that stretches to fit the parent's width. Words with fewer characters will have a larger font size than words with more characters. The component uses SVG for rendering text, which ensures proper text-stroke rendering in headless mode.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import StretchText from './StretchText';
|
|
9
|
+
|
|
10
|
+
// Basic usage
|
|
11
|
+
<StretchText text="Hello World" />
|
|
12
|
+
|
|
13
|
+
// With custom styling
|
|
14
|
+
<StretchText
|
|
15
|
+
text="Contribution"
|
|
16
|
+
color="#1a73e8"
|
|
17
|
+
fontFamily="Arial"
|
|
18
|
+
maxFontSize={200}
|
|
19
|
+
minFontSize={10}
|
|
20
|
+
style={{ fontWeight: 'bold' }}
|
|
21
|
+
/>
|
|
22
|
+
|
|
23
|
+
// With text stroke
|
|
24
|
+
<StretchText
|
|
25
|
+
text="Outlined Text"
|
|
26
|
+
color="transparent"
|
|
27
|
+
textStrokeColor="white"
|
|
28
|
+
textStrokeWidth="2px"
|
|
29
|
+
style={{ fontWeight: 'bold' }}
|
|
30
|
+
/>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Props
|
|
34
|
+
|
|
35
|
+
| Prop | Type | Default | Description |
|
|
36
|
+
|------|------|---------|-------------|
|
|
37
|
+
| `text` | string | required | The text to display |
|
|
38
|
+
| `color` | string | '#000000' | Text color |
|
|
39
|
+
| `fontFamily` | string | 'Arial' | Font family |
|
|
40
|
+
| `maxFontSize` | number | 100 | Maximum font size in pixels |
|
|
41
|
+
| `minFontSize` | number | 10 | Minimum font size in pixels |
|
|
42
|
+
| `textStrokeColor` | string | undefined | Color of the text stroke |
|
|
43
|
+
| `textStrokeWidth` | string | undefined | Width of the text stroke (e.g., '2px') |
|
|
44
|
+
| `textFillColor` | string | undefined | Color of the text fill (overrides `color` if provided) |
|
|
45
|
+
| `style` | object | {} | Additional style properties |
|
|
46
|
+
|
|
47
|
+
## Examples
|
|
48
|
+
|
|
49
|
+
The component automatically calculates the appropriate font size to make the text stretch to fit the parent width. For example:
|
|
50
|
+
|
|
51
|
+
- "Work" (4 characters) will have a larger font size than "Contribution" (12 characters) when both are rendered in containers of the same width.
|
|
52
|
+
- The text will always be contained within the parent container and will not overflow.
|
|
53
|
+
- The component recalculates the font size when the window is resized.
|
|
54
|
+
|
|
55
|
+
## Demo
|
|
56
|
+
|
|
57
|
+
You can see a demo of the StretchText component by running the development environment and looking at the first segment in the video timeline.
|
|
58
|
+
|
|
59
|
+
The demo shows several words of different lengths rendered in containers of the same width:
|
|
60
|
+
|
|
61
|
+
- "Contribution" (longer word, smaller font)
|
|
62
|
+
- "Work" (shorter word, larger font)
|
|
63
|
+
- "Hello" (medium length word, medium font)
|
|
64
|
+
- "Supercalifragilisticexpialidocious" (very long word, very small font)
|
|
65
|
+
|
|
66
|
+
Each word stretches to fill the entire width of its container, demonstrating how the component automatically adjusts the font size based on the text length.
|
|
67
|
+
|
|
68
|
+
## Implementation Details
|
|
69
|
+
|
|
70
|
+
The component uses a binary search algorithm to find the optimal font size that makes the text fit the parent width. It uses a simple approximation for text width calculation (character count * fontSize * 0.75) which works well for most fonts.
|
|
71
|
+
|
|
72
|
+
The component uses SVG for rendering text, which provides several advantages:
|
|
73
|
+
- Proper text-stroke rendering in headless mode
|
|
74
|
+
- Better control over text positioning and alignment
|
|
75
|
+
- Consistent rendering across different browsers and environments
|
|
76
|
+
- Support for advanced SVG features like filters for text shadows
|
|
77
|
+
|
|
78
|
+
For text with stroke effects, the component uses SVG's native stroke and fill attributes, which are more reliable than CSS text-stroke properties, especially in headless rendering environments.
|
|
79
|
+
|
|
80
|
+
The component also includes a resize listener to recalculate the font size when the window size changes.
|
|
@@ -2,9 +2,9 @@ import React from "react";
|
|
|
2
2
|
import { AbsoluteFill } from "remotion";
|
|
3
3
|
import StretchText from "./StretchText";
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Demo component to showcase the StretchText component
|
|
7
|
-
* Shows how different words stretch to the same width with different font sizes
|
|
5
|
+
/**
|
|
6
|
+
* Demo component to showcase the StretchText component
|
|
7
|
+
* Shows how different words stretch to the same width with different font sizes
|
|
8
8
|
*/
|
|
9
9
|
var StretchTextDemo = function StretchTextDemo() {
|
|
10
10
|
var containerStyle = {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts seconds and a portion of frames to a numeric value of seconds.
|
|
3
|
-
*
|
|
4
|
-
* @param {number} seconds - The number of full seconds.
|
|
5
|
-
* @param {number} nthFrame - The current frame within the second.
|
|
6
|
-
* @param {number} delayInSeconds - Optional delay that adds up to the calculation
|
|
7
|
-
* @param {number} frameRate - The frame rate (frames per second).
|
|
8
|
-
* @return {number} The total time in seconds (with decimals for frames).
|
|
1
|
+
/**
|
|
2
|
+
* Converts seconds and a portion of frames to a numeric value of seconds.
|
|
3
|
+
*
|
|
4
|
+
* @param {number} seconds - The number of full seconds.
|
|
5
|
+
* @param {number} nthFrame - The current frame within the second.
|
|
6
|
+
* @param {number} delayInSeconds - Optional delay that adds up to the calculation
|
|
7
|
+
* @param {number} frameRate - The frame rate (frames per second).
|
|
8
|
+
* @return {number} The total time in seconds (with decimals for frames).
|
|
9
9
|
*/
|
|
10
10
|
export var convertToSeconds = function convertToSeconds(seconds, nthFrame) {
|
|
11
11
|
var delayInSeconds = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
@@ -4,10 +4,10 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
4
4
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
5
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
6
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
-
/**
|
|
8
|
-
* Calculate video styles based on face detection metadata
|
|
9
|
-
* This helper adjusts video positioning and transform origin to center faces in the viewport
|
|
10
|
-
* when zooming, accounting for objectFit: "cover" behavior
|
|
7
|
+
/**
|
|
8
|
+
* Calculate video styles based on face detection metadata
|
|
9
|
+
* This helper adjusts video positioning and transform origin to center faces in the viewport
|
|
10
|
+
* when zooming, accounting for objectFit: "cover" behavior
|
|
11
11
|
*/
|
|
12
12
|
export var getFaceBasedVideoStyles = function getFaceBasedVideoStyles(_ref) {
|
|
13
13
|
var faceMetadata = _ref.faceMetadata,
|
|
@@ -4,33 +4,33 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
6
|
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); }
|
|
7
|
-
/**
|
|
8
|
-
* Face-Centered Video Transform Calculator
|
|
9
|
-
*
|
|
10
|
-
* This helper calculates transform origin and positioning to ensure a video is ALWAYS
|
|
11
|
-
* centered on a person's face, regardless of aspect ratio (landscape, square, portrait).
|
|
12
|
-
*
|
|
13
|
-
* Key features:
|
|
14
|
-
* - Converts absolute face coordinates to relative values
|
|
15
|
-
* - Handles different target aspect ratios (1920x1080, 1080x1080, 1080x1920)
|
|
16
|
-
* - Provides smooth interpolation between frames
|
|
17
|
-
* - Calculates optimal scale and positioning for face centering
|
|
7
|
+
/**
|
|
8
|
+
* Face-Centered Video Transform Calculator
|
|
9
|
+
*
|
|
10
|
+
* This helper calculates transform origin and positioning to ensure a video is ALWAYS
|
|
11
|
+
* centered on a person's face, regardless of aspect ratio (landscape, square, portrait).
|
|
12
|
+
*
|
|
13
|
+
* Key features:
|
|
14
|
+
* - Converts absolute face coordinates to relative values
|
|
15
|
+
* - Handles different target aspect ratios (1920x1080, 1080x1080, 1080x1920)
|
|
16
|
+
* - Provides smooth interpolation between frames
|
|
17
|
+
* - Calculates optimal scale and positioning for face centering
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import { useCurrentFrame } from "remotion";
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* Calculate face-centered video transforms
|
|
24
|
-
* @param {Object} params - Configuration object
|
|
25
|
-
* @param {Object} params.faceMetadata - Face detection metadata
|
|
26
|
-
* @param {number} params.targetWidth - Target video width (1920 for landscape, 1080 for square/portrait)
|
|
27
|
-
* @param {number} params.targetHeight - Target video height (1080 for landscape/square, 1920 for portrait)
|
|
28
|
-
* @param {number} params.currentFrame - Current frame number (optional, will use useCurrentFrame if not provided)
|
|
29
|
-
* @param {boolean} params.enableInterpolation - Whether to interpolate between frames
|
|
30
|
-
* @param {number} params.faceScale - Scale factor for face area (1.0 = face fills frame, 0.5 = face takes half frame)
|
|
31
|
-
* @param {boolean} params.useAveragePosition - Whether to use average face position for entire video duration
|
|
32
|
-
* @param {boolean} params.centerHorizontally - Whether to only center horizontally (X axis), not vertically (Y axis)
|
|
33
|
-
* @returns {Object} Transform styles and debug info
|
|
22
|
+
/**
|
|
23
|
+
* Calculate face-centered video transforms
|
|
24
|
+
* @param {Object} params - Configuration object
|
|
25
|
+
* @param {Object} params.faceMetadata - Face detection metadata
|
|
26
|
+
* @param {number} params.targetWidth - Target video width (1920 for landscape, 1080 for square/portrait)
|
|
27
|
+
* @param {number} params.targetHeight - Target video height (1080 for landscape/square, 1920 for portrait)
|
|
28
|
+
* @param {number} params.currentFrame - Current frame number (optional, will use useCurrentFrame if not provided)
|
|
29
|
+
* @param {boolean} params.enableInterpolation - Whether to interpolate between frames
|
|
30
|
+
* @param {number} params.faceScale - Scale factor for face area (1.0 = face fills frame, 0.5 = face takes half frame)
|
|
31
|
+
* @param {boolean} params.useAveragePosition - Whether to use average face position for entire video duration
|
|
32
|
+
* @param {boolean} params.centerHorizontally - Whether to only center horizontally (X axis), not vertically (Y axis)
|
|
33
|
+
* @returns {Object} Transform styles and debug info
|
|
34
34
|
*/
|
|
35
35
|
export var calculateFaceCenteredTransforms = function calculateFaceCenteredTransforms(_ref) {
|
|
36
36
|
var _faceMetadata$metadat, _faceMetadata$metadat2;
|
|
@@ -173,10 +173,10 @@ export var calculateFaceCenteredTransforms = function calculateFaceCenteredTrans
|
|
|
173
173
|
};
|
|
174
174
|
};
|
|
175
175
|
|
|
176
|
-
/**
|
|
177
|
-
* Calculate average face position from all frames with face data
|
|
178
|
-
* @param {Array} frames - Array of frame data
|
|
179
|
-
* @returns {Object|null} Average face data or null if no face data available
|
|
176
|
+
/**
|
|
177
|
+
* Calculate average face position from all frames with face data
|
|
178
|
+
* @param {Array} frames - Array of frame data
|
|
179
|
+
* @returns {Object|null} Average face data or null if no face data available
|
|
180
180
|
*/
|
|
181
181
|
function getAverageFaceData(frames) {
|
|
182
182
|
if (!frames || frames.length === 0) return null;
|
|
@@ -225,8 +225,8 @@ function getAverageFaceData(frames) {
|
|
|
225
225
|
return averageFaceData;
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
/**
|
|
229
|
-
* Get face data for a specific frame with optional interpolation
|
|
228
|
+
/**
|
|
229
|
+
* Get face data for a specific frame with optional interpolation
|
|
230
230
|
*/
|
|
231
231
|
function getFaceDataForFrame(frames, targetFrame, enableInterpolation) {
|
|
232
232
|
if (!frames || frames.length === 0) return null;
|
|
@@ -285,8 +285,8 @@ function getFaceDataForFrame(frames, targetFrame, enableInterpolation) {
|
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
/**
|
|
289
|
-
* Preset configurations for common aspect ratios
|
|
288
|
+
/**
|
|
289
|
+
* Preset configurations for common aspect ratios
|
|
290
290
|
*/
|
|
291
291
|
export var ASPECT_RATIO_PRESETS = {
|
|
292
292
|
LANDSCAPE: {
|
|
@@ -303,17 +303,17 @@ export var ASPECT_RATIO_PRESETS = {
|
|
|
303
303
|
}
|
|
304
304
|
};
|
|
305
305
|
|
|
306
|
-
/**
|
|
307
|
-
* Calculate face-centered object-position values
|
|
308
|
-
* @param {Object} params - Configuration object
|
|
309
|
-
* @param {Object} params.faceMetadata - Face detection metadata
|
|
310
|
-
* @param {number} params.targetWidth - Target video width (1920 for landscape, 1080 for square/portrait)
|
|
311
|
-
* @param {number} params.targetHeight - Target video height (1080 for landscape/square, 1920 for portrait)
|
|
312
|
-
* @param {number} params.currentFrame - Current frame number (optional, will use useCurrentFrame if not provided)
|
|
313
|
-
* @param {boolean} params.enableInterpolation - Whether to interpolate between frames
|
|
314
|
-
* @param {boolean} params.useAveragePosition - Whether to use average face position for entire video duration
|
|
315
|
-
* @param {boolean} params.centerHorizontally - Whether to only center horizontally (X axis), not vertically (Y axis)
|
|
316
|
-
* @returns {Object} Object-position styles and debug info
|
|
306
|
+
/**
|
|
307
|
+
* Calculate face-centered object-position values
|
|
308
|
+
* @param {Object} params - Configuration object
|
|
309
|
+
* @param {Object} params.faceMetadata - Face detection metadata
|
|
310
|
+
* @param {number} params.targetWidth - Target video width (1920 for landscape, 1080 for square/portrait)
|
|
311
|
+
* @param {number} params.targetHeight - Target video height (1080 for landscape/square, 1920 for portrait)
|
|
312
|
+
* @param {number} params.currentFrame - Current frame number (optional, will use useCurrentFrame if not provided)
|
|
313
|
+
* @param {boolean} params.enableInterpolation - Whether to interpolate between frames
|
|
314
|
+
* @param {boolean} params.useAveragePosition - Whether to use average face position for entire video duration
|
|
315
|
+
* @param {boolean} params.centerHorizontally - Whether to only center horizontally (X axis), not vertically (Y axis)
|
|
316
|
+
* @returns {Object} Object-position styles and debug info
|
|
317
317
|
*/
|
|
318
318
|
export var calculateFaceCenteredObjectPosition = function calculateFaceCenteredObjectPosition(_ref2) {
|
|
319
319
|
var _faceMetadata$metadat4, _faceMetadata$metadat5;
|
|
@@ -435,8 +435,8 @@ export var calculateFaceCenteredObjectPosition = function calculateFaceCenteredO
|
|
|
435
435
|
};
|
|
436
436
|
};
|
|
437
437
|
|
|
438
|
-
/**
|
|
439
|
-
* Helper function to get transforms for specific aspect ratios
|
|
438
|
+
/**
|
|
439
|
+
* Helper function to get transforms for specific aspect ratios
|
|
440
440
|
*/
|
|
441
441
|
export var getFaceCenteredTransformsForAspectRatio = function getFaceCenteredTransformsForAspectRatio(aspectRatio, faceMetadata) {
|
|
442
442
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
@@ -451,8 +451,8 @@ export var getFaceCenteredTransformsForAspectRatio = function getFaceCenteredTra
|
|
|
451
451
|
}, options));
|
|
452
452
|
};
|
|
453
453
|
|
|
454
|
-
/**
|
|
455
|
-
* Helper function to get object-position for specific aspect ratios
|
|
454
|
+
/**
|
|
455
|
+
* Helper function to get object-position for specific aspect ratios
|
|
456
456
|
*/
|
|
457
457
|
export var getFaceCenteredObjectPositionForAspectRatio = function getFaceCenteredObjectPositionForAspectRatio(aspectRatio, faceMetadata) {
|
|
458
458
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { useVideoConfig } from "remotion";
|
|
2
|
-
export var useOrientationBased = function useOrientationBased(perOrientationStyles) {
|
|
2
|
+
export var useOrientationBased = function useOrientationBased(perOrientationStyles, orientationOverride) {
|
|
3
3
|
var _useVideoConfig = useVideoConfig(),
|
|
4
4
|
_useVideoConfig$props = _useVideoConfig.props.output,
|
|
5
5
|
_useVideoConfig$props2 = _useVideoConfig$props === void 0 ? {
|
|
6
6
|
orientation: window.screenplayProps.output.orientation
|
|
7
7
|
} : _useVideoConfig$props,
|
|
8
8
|
orientation = _useVideoConfig$props2.orientation;
|
|
9
|
+
var resolvedOrientation = orientationOverride || orientation;
|
|
9
10
|
var result;
|
|
10
|
-
switch (
|
|
11
|
+
switch (resolvedOrientation) {
|
|
11
12
|
case "portrait":
|
|
12
13
|
{
|
|
13
14
|
result = perOrientationStyles.portrait;
|
|
@@ -24,6 +25,9 @@ export var useOrientationBased = function useOrientationBased(perOrientationStyl
|
|
|
24
25
|
break;
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
|
-
result
|
|
28
|
+
if (!result) {
|
|
29
|
+
result = perOrientationStyles.landscape || perOrientationStyles.portrait || perOrientationStyles.square || {};
|
|
30
|
+
}
|
|
31
|
+
result.orientation = resolvedOrientation;
|
|
28
32
|
return result;
|
|
29
33
|
};
|
|
@@ -32,7 +32,7 @@ export var Layout = /*#__PURE__*/function (_Sequence) {
|
|
|
32
32
|
return _createClass(Layout, [{
|
|
33
33
|
key: "getLayoutProps",
|
|
34
34
|
value: function getLayoutProps(props) {
|
|
35
|
-
var _props$data, _props$data2, _props$data$sourceVid, _props$data3, _props$data$noBackgro, _props$data$noBackgro2;
|
|
35
|
+
var _props$data, _props$data2, _props$data$sourceVid, _props$data3, _props$data4, _props$data$noBackgro, _props$data$noBackgro2;
|
|
36
36
|
var sourceVideoOrientation = getVideoOrientation(props.data.sourceVideo.aspectRatio);
|
|
37
37
|
var trimLeft = ((_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.trimLeft) || 0;
|
|
38
38
|
var trimRight = ((_props$data2 = props.data) === null || _props$data2 === void 0 ? void 0 : _props$data2.trimRight) || 0;
|
|
@@ -60,6 +60,7 @@ export var Layout = /*#__PURE__*/function (_Sequence) {
|
|
|
60
60
|
sourceVideoOrientation: sourceVideoOrientation,
|
|
61
61
|
startVideoFrom: toFrames(this.fps * (((_props$data$sourceVid = props.data.sourceVideo) === null || _props$data$sourceVid === void 0 ? void 0 : _props$data$sourceVid.start) + trimLeft), true) || 0,
|
|
62
62
|
disableTransitionSounds: (_props$data3 = props.data) === null || _props$data3 === void 0 ? void 0 : _props$data3.disableTransitionSounds,
|
|
63
|
+
useSquareInLandscape: ((_props$data4 = props.data) === null || _props$data4 === void 0 ? void 0 : _props$data4.useSquareInLandscape) || false,
|
|
63
64
|
trimLeft: trimLeft,
|
|
64
65
|
trimRight: trimRight,
|
|
65
66
|
words: props.data.words,
|
|
@@ -24,7 +24,7 @@ export var DynamicTriangleLayout = /*#__PURE__*/function (_Layout) {
|
|
|
24
24
|
return _createClass(DynamicTriangleLayout, [{
|
|
25
25
|
key: "getVideoProps",
|
|
26
26
|
value: function getVideoProps(props) {
|
|
27
|
-
var _props$data$sourceVid, _props$data$sourceVid2, _props$data, _props$data2, _props$data3, _props$data4, _props$data5, _props$data6, _props$data7, _props$data8, _props$data9, _props$data10, _props$data11, _props$data12, _props$data13;
|
|
27
|
+
var _props$data$sourceVid, _props$data$sourceVid2, _props$data, _props$data2, _props$data3, _props$data4, _props$data5, _props$data6, _props$data7, _props$data8, _props$data9, _props$data10, _props$data11, _props$data12, _props$data13, _props$data14;
|
|
28
28
|
this.props = {
|
|
29
29
|
videoUrl: (_props$data$sourceVid = props.data.sourceVideo) === null || _props$data$sourceVid === void 0 ? void 0 : _props$data$sourceVid.videoUrl,
|
|
30
30
|
videoZoom: ((_props$data$sourceVid2 = props.data.sourceVideo) === null || _props$data$sourceVid2 === void 0 ? void 0 : _props$data$sourceVid2.zoom) || 1,
|
|
@@ -47,7 +47,8 @@ export var DynamicTriangleLayout = /*#__PURE__*/function (_Layout) {
|
|
|
47
47
|
maskAnimationDuration: ((_props$data11 = props.data) === null || _props$data11 === void 0 ? void 0 : _props$data11.maskAnimationDuration) || 2,
|
|
48
48
|
// Duration in seconds for mask animation
|
|
49
49
|
sentenceText: (_props$data12 = props.data) === null || _props$data12 === void 0 ? void 0 : _props$data12.sentenceText,
|
|
50
|
-
text: (_props$data13 = props.data) === null || _props$data13 === void 0 ? void 0 : _props$data13.text
|
|
50
|
+
text: (_props$data13 = props.data) === null || _props$data13 === void 0 ? void 0 : _props$data13.text,
|
|
51
|
+
useSquareInLandscape: ((_props$data14 = props.data) === null || _props$data14 === void 0 ? void 0 : _props$data14.useSquareInLandscape) || false
|
|
51
52
|
};
|
|
52
53
|
}
|
|
53
54
|
}]);
|
|
@@ -27,7 +27,7 @@ export var HandoffLayout = /*#__PURE__*/function (_Layout) {
|
|
|
27
27
|
return _createClass(HandoffLayout, [{
|
|
28
28
|
key: "getVideoProps",
|
|
29
29
|
value: function getVideoProps(props) {
|
|
30
|
-
var _props$data$sourceVid, _props$data, _props$data2, _props$data3, _props$data4, _props$data5, _props$data6, _props$data6$firstNoB, _props$data7, _props$data7$firstNoB, _props$data8, _props$data9, _props$data10, _props$data11, _props$data11$secondN, _props$data12, _props$data12$secondN, _props$data$sourceVid2, _props$data$sourceVid3, _props$data13, _props$data14;
|
|
30
|
+
var _props$data$sourceVid, _props$data, _props$data2, _props$data3, _props$data4, _props$data5, _props$data6, _props$data6$firstNoB, _props$data7, _props$data7$firstNoB, _props$data8, _props$data9, _props$data10, _props$data11, _props$data11$secondN, _props$data12, _props$data12$secondN, _props$data$sourceVid2, _props$data$sourceVid3, _props$data13, _props$data14, _props$data15;
|
|
31
31
|
var sourceVideoOrientation = getVideoOrientation((_props$data$sourceVid = props.data.sourceVideo) === null || _props$data$sourceVid === void 0 ? void 0 : _props$data$sourceVid.aspectRatio);
|
|
32
32
|
this.props = {
|
|
33
33
|
startFirstVideoFrom: toFrames(this.fps * (((_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.startFirstVideoFrom) + (((_props$data2 = props.data) === null || _props$data2 === void 0 ? void 0 : _props$data2.trimLeft) || 0)), true) || 0,
|
|
@@ -44,8 +44,9 @@ export var HandoffLayout = /*#__PURE__*/function (_Layout) {
|
|
|
44
44
|
sourceVideoOrientation: sourceVideoOrientation,
|
|
45
45
|
videoZoom: ((_props$data$sourceVid3 = props.data.sourceVideo) === null || _props$data$sourceVid3 === void 0 ? void 0 : _props$data$sourceVid3.zoom) || 1,
|
|
46
46
|
useSquareInLandscapeFirstVideo: ((_props$data13 = props.data) === null || _props$data13 === void 0 ? void 0 : _props$data13.useSquareInLandscapeFirstVideo) || false,
|
|
47
|
+
useSquareInLandscapeSecondVideo: ((_props$data14 = props.data) === null || _props$data14 === void 0 ? void 0 : _props$data14.useSquareInLandscapeSecondVideo) || false,
|
|
47
48
|
text: props.data.text,
|
|
48
|
-
handoffOverlapSeconds: ((_props$
|
|
49
|
+
handoffOverlapSeconds: ((_props$data15 = props.data) === null || _props$data15 === void 0 ? void 0 : _props$data15.handoffOverlapSeconds) || 0
|
|
49
50
|
};
|
|
50
51
|
}
|
|
51
52
|
}]);
|
|
@@ -24,9 +24,11 @@ export var IntroVideoLayout = /*#__PURE__*/function (_Layout) {
|
|
|
24
24
|
return _createClass(IntroVideoLayout, [{
|
|
25
25
|
key: "getVideoProps",
|
|
26
26
|
value: function getVideoProps(props) {
|
|
27
|
+
var _props$data;
|
|
27
28
|
this.props = {
|
|
28
29
|
sentenceText: props.data.sentenceText,
|
|
29
|
-
sentenceTextTwo: props.data.sentenceTextTwo
|
|
30
|
+
sentenceTextTwo: props.data.sentenceTextTwo,
|
|
31
|
+
useSquareInLandscape: ((_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.useSquareInLandscape) || false
|
|
30
32
|
};
|
|
31
33
|
}
|
|
32
34
|
}]);
|
|
@@ -24,12 +24,13 @@ export var KeywordLayout = /*#__PURE__*/function (_Layout) {
|
|
|
24
24
|
return _createClass(KeywordLayout, [{
|
|
25
25
|
key: "getVideoProps",
|
|
26
26
|
value: function getVideoProps(props) {
|
|
27
|
-
var _props$data$sourceVid, _props$data$sourceVid2, _props$data;
|
|
27
|
+
var _props$data$sourceVid, _props$data$sourceVid2, _props$data, _props$data2;
|
|
28
28
|
this.props = {
|
|
29
29
|
videoUrl: (_props$data$sourceVid = props.data.sourceVideo) === null || _props$data$sourceVid === void 0 ? void 0 : _props$data$sourceVid.videoUrl,
|
|
30
30
|
videoZoom: ((_props$data$sourceVid2 = props.data.sourceVideo) === null || _props$data$sourceVid2 === void 0 ? void 0 : _props$data$sourceVid2.zoom) || 1,
|
|
31
31
|
disableTransitionSounds: (_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.disableTransitionSounds,
|
|
32
|
-
words: props.data.words
|
|
32
|
+
words: props.data.words,
|
|
33
|
+
useSquareInLandscape: ((_props$data2 = props.data) === null || _props$data2 === void 0 ? void 0 : _props$data2.useSquareInLandscape) || false
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
36
|
}]);
|
|
@@ -24,12 +24,13 @@ export var MotionStillLayout = /*#__PURE__*/function (_Layout) {
|
|
|
24
24
|
return _createClass(MotionStillLayout, [{
|
|
25
25
|
key: "getVideoProps",
|
|
26
26
|
value: function getVideoProps(props) {
|
|
27
|
-
var _props$data$sourceVid, _props$data$sourceVid2, _props$data;
|
|
27
|
+
var _props$data$sourceVid, _props$data$sourceVid2, _props$data, _props$data2;
|
|
28
28
|
this.props = {
|
|
29
29
|
videoUrl: (_props$data$sourceVid = props.data.sourceVideo) === null || _props$data$sourceVid === void 0 ? void 0 : _props$data$sourceVid.videoUrl,
|
|
30
30
|
imageUrl: props.data.imageUrl,
|
|
31
31
|
videoZoom: ((_props$data$sourceVid2 = props.data.sourceVideo) === null || _props$data$sourceVid2 === void 0 ? void 0 : _props$data$sourceVid2.zoom) || 1,
|
|
32
|
-
disableTransitionSounds: (_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.disableTransitionSounds
|
|
32
|
+
disableTransitionSounds: (_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.disableTransitionSounds,
|
|
33
|
+
useSquareInLandscape: ((_props$data2 = props.data) === null || _props$data2 === void 0 ? void 0 : _props$data2.useSquareInLandscape) || false
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
36
|
}]);
|
|
@@ -38,14 +38,15 @@ export var TextWithVideoLayout = /*#__PURE__*/function (_Layout) {
|
|
|
38
38
|
}, {
|
|
39
39
|
key: "getVideoProps",
|
|
40
40
|
value: function getVideoProps(props) {
|
|
41
|
-
var _props$data$sourceVid, _props$data$sourceVid2, _props$data$sourceVid3, _props$data;
|
|
41
|
+
var _props$data$sourceVid, _props$data$sourceVid2, _props$data$sourceVid3, _props$data, _props$data2;
|
|
42
42
|
var sourceVideoOrientation = getVideoOrientation((_props$data$sourceVid = props.data.sourceVideo) === null || _props$data$sourceVid === void 0 ? void 0 : _props$data$sourceVid.aspectRatio);
|
|
43
43
|
this.props = {
|
|
44
44
|
videoUrl: (_props$data$sourceVid2 = props.data.sourceVideo) === null || _props$data$sourceVid2 === void 0 ? void 0 : _props$data$sourceVid2.videoUrl,
|
|
45
45
|
sourceVideoOrientation: sourceVideoOrientation,
|
|
46
46
|
videoZoom: ((_props$data$sourceVid3 = props.data.sourceVideo) === null || _props$data$sourceVid3 === void 0 ? void 0 : _props$data$sourceVid3.zoom) || 1,
|
|
47
47
|
text: props.data.text,
|
|
48
|
-
disableTransitionSounds: (_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.disableTransitionSounds
|
|
48
|
+
disableTransitionSounds: (_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.disableTransitionSounds,
|
|
49
|
+
useSquareInLandscape: ((_props$data2 = props.data) === null || _props$data2 === void 0 ? void 0 : _props$data2.useSquareInLandscape) || false
|
|
49
50
|
};
|
|
50
51
|
}
|
|
51
52
|
}]);
|
|
@@ -29,58 +29,58 @@ export var screenplaySchema = z.object({
|
|
|
29
29
|
}), z.object({
|
|
30
30
|
type: "segmentx"
|
|
31
31
|
})])),
|
|
32
|
-
/* z.object({
|
|
33
|
-
type: "segment",
|
|
34
|
-
segments: z.array(
|
|
35
|
-
z.object({
|
|
36
|
-
layout: z.any(),
|
|
37
|
-
effects: z.array(effectSchema),
|
|
38
|
-
})
|
|
39
|
-
),
|
|
32
|
+
/* z.object({
|
|
33
|
+
type: "segment",
|
|
34
|
+
segments: z.array(
|
|
35
|
+
z.object({
|
|
36
|
+
layout: z.any(),
|
|
37
|
+
effects: z.array(effectSchema),
|
|
38
|
+
})
|
|
39
|
+
),
|
|
40
40
|
})*/
|
|
41
|
-
/*z.object({
|
|
42
|
-
type: "effect",
|
|
43
|
-
segments: z.array(effectSchema),
|
|
44
|
-
}),
|
|
45
|
-
z.object({
|
|
46
|
-
type: z.enum(segmentTypes),
|
|
47
|
-
segments: z.array([
|
|
48
|
-
{
|
|
49
|
-
type: "caption",
|
|
50
|
-
segments: z.array(
|
|
51
|
-
z.object({
|
|
52
|
-
type: "caption_simple",
|
|
53
|
-
data: {
|
|
54
|
-
transcript_text: z.array(
|
|
55
|
-
z.object({
|
|
56
|
-
text: z.string(),
|
|
57
|
-
offset: z.number(),
|
|
58
|
-
duration: z.number(),
|
|
59
|
-
})
|
|
60
|
-
),
|
|
61
|
-
duration: z.number().optional(),
|
|
62
|
-
offset: z.number().optional(),
|
|
63
|
-
},
|
|
64
|
-
})
|
|
65
|
-
),
|
|
66
|
-
},
|
|
67
|
-
]),
|
|
68
|
-
}),
|
|
69
|
-
z.object({
|
|
70
|
-
type: "audio",
|
|
71
|
-
segments: z.array([
|
|
72
|
-
z.object({
|
|
73
|
-
type: z.string(),
|
|
74
|
-
data: {
|
|
75
|
-
sourceAudio: {
|
|
76
|
-
url: z.string().url(),
|
|
77
|
-
volume: z.number().min(0).max(1),
|
|
78
|
-
start: z.number(),
|
|
79
|
-
},
|
|
80
|
-
offset: z.number(),
|
|
81
|
-
},
|
|
82
|
-
}),
|
|
83
|
-
]),
|
|
41
|
+
/*z.object({
|
|
42
|
+
type: "effect",
|
|
43
|
+
segments: z.array(effectSchema),
|
|
44
|
+
}),
|
|
45
|
+
z.object({
|
|
46
|
+
type: z.enum(segmentTypes),
|
|
47
|
+
segments: z.array([
|
|
48
|
+
{
|
|
49
|
+
type: "caption",
|
|
50
|
+
segments: z.array(
|
|
51
|
+
z.object({
|
|
52
|
+
type: "caption_simple",
|
|
53
|
+
data: {
|
|
54
|
+
transcript_text: z.array(
|
|
55
|
+
z.object({
|
|
56
|
+
text: z.string(),
|
|
57
|
+
offset: z.number(),
|
|
58
|
+
duration: z.number(),
|
|
59
|
+
})
|
|
60
|
+
),
|
|
61
|
+
duration: z.number().optional(),
|
|
62
|
+
offset: z.number().optional(),
|
|
63
|
+
},
|
|
64
|
+
})
|
|
65
|
+
),
|
|
66
|
+
},
|
|
67
|
+
]),
|
|
68
|
+
}),
|
|
69
|
+
z.object({
|
|
70
|
+
type: "audio",
|
|
71
|
+
segments: z.array([
|
|
72
|
+
z.object({
|
|
73
|
+
type: z.string(),
|
|
74
|
+
data: {
|
|
75
|
+
sourceAudio: {
|
|
76
|
+
url: z.string().url(),
|
|
77
|
+
volume: z.number().min(0).max(1),
|
|
78
|
+
start: z.number(),
|
|
79
|
+
},
|
|
80
|
+
offset: z.number(),
|
|
81
|
+
},
|
|
82
|
+
}),
|
|
83
|
+
]),
|
|
84
84
|
}),*/
|
|
85
85
|
output: z.object({
|
|
86
86
|
orientation: z["enum"](orientations),
|