@zync/zync-screnplay-player 0.1.244 → 0.1.246

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,
@@ -73,14 +73,7 @@ var Square = function Square(_ref) {
73
73
  left: mainVideoLeftTransition,
74
74
  zIndex: 2
75
75
  }
76
- }, showVirtual && virtualBgUrl ? /*#__PURE__*/React.createElement(VirtualBackgroundUnderlay, {
77
- url: virtualBgUrl,
78
- top: 0,
79
- left: 0,
80
- width: "100%",
81
- height: "100%",
82
- zIndex: 2
83
- }) : null, faceMetadata ? /*#__PURE__*/React.createElement(FaceCenteredVideo, {
76
+ }, faceMetadata ? /*#__PURE__*/React.createElement(FaceCenteredVideo, {
84
77
  startFrom: startVideoFrom,
85
78
  src: noBackgroundVideoUrl,
86
79
  faceMetadata: faceMetadata,
@@ -88,6 +81,8 @@ var Square = function Square(_ref) {
88
81
  containerHeight: mainVideoHeightTransition,
89
82
  useAveragePosition: true,
90
83
  centerHorizontally: true,
84
+ translateY: 100,
85
+ anchorToBottom: true,
91
86
  transparent: true
92
87
  }) : /*#__PURE__*/React.createElement(OffthreadVideo, {
93
88
  pauseWhenBuffering: true,
@@ -111,7 +106,14 @@ var Square = function Square(_ref) {
111
106
  left: mainVideoLeftTransition,
112
107
  zIndex: 0
113
108
  }
114
- }, faceMetadata ? /*#__PURE__*/React.createElement(FaceCenteredVideo, {
109
+ }, showVirtual && virtualBgUrl ? /*#__PURE__*/React.createElement(VirtualBackgroundUnderlay, {
110
+ url: virtualBgUrl,
111
+ top: 0,
112
+ left: 0,
113
+ width: "100%",
114
+ height: "100%",
115
+ zIndex: 0
116
+ }) : faceMetadata ? /*#__PURE__*/React.createElement(FaceCenteredVideo, {
115
117
  startFrom: startVideoFrom,
116
118
  src: videoUrl,
117
119
  transparent: false,
@@ -120,6 +122,8 @@ var Square = function Square(_ref) {
120
122
  containerHeight: mainVideoHeightTransition,
121
123
  useAveragePosition: true,
122
124
  centerHorizontally: true,
125
+ translateY: 100,
126
+ anchorToBottom: true,
123
127
  muted: true,
124
128
  style: {
125
129
  zIndex: 0,
@@ -162,6 +166,8 @@ var Square = function Square(_ref) {
162
166
  faceMetadata: faceMetadata,
163
167
  useAveragePosition: true,
164
168
  centerHorizontally: true,
169
+ translateY: 100,
170
+ anchorToBottom: true,
165
171
  noBackgroundVideoEffects: noBackgroundVideoEffects,
166
172
  transparent: true,
167
173
  muted: true
@@ -182,14 +188,12 @@ var Square = function Square(_ref) {
182
188
  muted: true,
183
189
  transparent: true,
184
190
  style: {
185
- position: "relative",
186
- top: "50%",
187
191
  objectFit: "cover",
188
- width: mainVideoWidthTransition,
189
- height: mainVideoHeightTransition,
192
+ height: "100%",
193
+ width: "100%",
194
+ objectPosition: sourceVideoOrientation === "portrait" ? "0% 30%" : undefined,
190
195
  borderRadius: "30px",
191
- filter: noBackgroundVideoEffects !== null && noBackgroundVideoEffects !== void 0 && noBackgroundVideoEffects.facePop ? "brightness(1.1) contrast(1.15) saturate(1.05)" : undefined,
192
- transform: "translateY(-50%)"
196
+ filter: noBackgroundVideoEffects !== null && noBackgroundVideoEffects !== void 0 && noBackgroundVideoEffects.facePop ? "brightness(1.1) contrast(1.15) saturate(1.05)" : undefined
193
197
  }
194
198
  })) : null, /*#__PURE__*/React.createElement(AbsoluteFill, {
195
199
  style: {
@@ -282,15 +286,7 @@ var Portrait = function Portrait(_ref2) {
282
286
  left: mainVideoLeftTransition,
283
287
  zIndex: 2
284
288
  }
285
- }, showVirtual && virtualBgUrl ? /*#__PURE__*/React.createElement(VirtualBackgroundUnderlay, {
286
- url: virtualBgUrl,
287
- top: 0,
288
- left: 0,
289
- width: "100%",
290
- height: "100%",
291
- borderRadius: "20px",
292
- zIndex: 2
293
- }) : null, faceMetadata ? /*#__PURE__*/React.createElement(FaceCenteredVideo, {
289
+ }, faceMetadata ? /*#__PURE__*/React.createElement(FaceCenteredVideo, {
294
290
  startFrom: startVideoFrom,
295
291
  src: noBackgroundVideoUrl,
296
292
  faceMetadata: faceMetadata,
@@ -298,6 +294,8 @@ var Portrait = function Portrait(_ref2) {
298
294
  containerHeight: mainVideoHeightTransition,
299
295
  useAveragePosition: true,
300
296
  centerHorizontally: false,
297
+ translateY: 100,
298
+ anchorToBottom: true,
301
299
  transparent: true
302
300
  }) : /*#__PURE__*/React.createElement(OffthreadVideo, {
303
301
  pauseWhenBuffering: true,
@@ -323,7 +321,15 @@ var Portrait = function Portrait(_ref2) {
323
321
  transform: "scale(1)",
324
322
  zIndex: 0
325
323
  }
326
- }, faceMetadata ? /*#__PURE__*/React.createElement(FaceCenteredVideo, {
324
+ }, showVirtual && virtualBgUrl ? /*#__PURE__*/React.createElement(VirtualBackgroundUnderlay, {
325
+ url: virtualBgUrl,
326
+ top: 0,
327
+ left: 0,
328
+ width: "100%",
329
+ height: "100%",
330
+ borderRadius: "20px",
331
+ zIndex: 0
332
+ }) : faceMetadata ? /*#__PURE__*/React.createElement(FaceCenteredVideo, {
327
333
  startFrom: startVideoFrom,
328
334
  src: videoUrl,
329
335
  faceMetadata: faceMetadata,
@@ -331,6 +337,8 @@ var Portrait = function Portrait(_ref2) {
331
337
  containerHeight: mainVideoHeightTransition,
332
338
  noBackgroundVideoEffects: noBackgroundVideoEffects,
333
339
  useAveragePosition: true,
340
+ translateY: 100,
341
+ anchorToBottom: true,
334
342
  muted: true,
335
343
  transparent: false,
336
344
  style: {
@@ -375,6 +383,8 @@ var Portrait = function Portrait(_ref2) {
375
383
  faceMetadata: faceMetadata,
376
384
  useAveragePosition: true,
377
385
  centerHorizontally: false,
386
+ translateY: 100,
387
+ anchorToBottom: true,
378
388
  noBackgroundVideoEffects: noBackgroundVideoEffects,
379
389
  transparent: true,
380
390
  muted: true
@@ -397,14 +407,12 @@ var Portrait = function Portrait(_ref2) {
397
407
  muted: true,
398
408
  transparent: true,
399
409
  style: {
400
- position: "relative",
401
- width: mainVideoWidthTransition,
402
- height: mainVideoHeightTransition,
403
- top: "50%",
404
410
  objectFit: "cover",
411
+ height: "100%",
412
+ width: "100%",
413
+ objectPosition: sourceVideoOrientation === "portrait" ? "0% 30%" : undefined,
405
414
  borderRadius: "30px",
406
- filter: noBackgroundVideoEffects !== null && noBackgroundVideoEffects !== void 0 && noBackgroundVideoEffects.facePop ? "brightness(1.1) contrast(1.15) saturate(1.05)" : undefined,
407
- transform: "translateY(-50%)"
415
+ filter: noBackgroundVideoEffects !== null && noBackgroundVideoEffects !== void 0 && noBackgroundVideoEffects.facePop ? "brightness(1.1) contrast(1.15) saturate(1.05)" : undefined
408
416
  }
409
417
  })) : null, /*#__PURE__*/React.createElement(AbsoluteFill, {
410
418
  style: {
@@ -491,21 +499,15 @@ var Landscape = function Landscape(_ref3) {
491
499
  left: mainVideoLeftTransition,
492
500
  zIndex: 2
493
501
  }
494
- }, showVirtual && virtualBgUrl ? /*#__PURE__*/React.createElement(VirtualBackgroundUnderlay, {
495
- url: virtualBgUrl,
496
- top: 0,
497
- left: 0,
498
- width: "100%",
499
- height: "100%",
500
- borderRadius: "20px",
501
- zIndex: 2
502
- }) : null, faceMetadata ? /*#__PURE__*/React.createElement(FaceCenteredVideo, {
502
+ }, faceMetadata ? /*#__PURE__*/React.createElement(FaceCenteredVideo, {
503
503
  startFrom: startVideoFrom,
504
504
  src: noBackgroundVideoUrl,
505
505
  faceMetadata: faceMetadata,
506
506
  containerWidth: mainVideoWidthTransition,
507
507
  containerHeight: mainVideoHeightTransition,
508
508
  useAveragePosition: true,
509
+ translateY: 100,
510
+ anchorToBottom: true,
509
511
  transparent: true
510
512
  }) : /*#__PURE__*/React.createElement(OffthreadVideo, {
511
513
  pauseWhenBuffering: true,
@@ -543,6 +545,8 @@ var Landscape = function Landscape(_ref3) {
543
545
  faceMetadata: faceMetadata,
544
546
  useAveragePosition: true,
545
547
  centerHorizontally: false,
548
+ translateY: 100,
549
+ anchorToBottom: true,
546
550
  noBackgroundVideoEffects: noBackgroundVideoEffects,
547
551
  transparent: true,
548
552
  muted: true
@@ -564,14 +568,12 @@ var Landscape = function Landscape(_ref3) {
564
568
  muted: true,
565
569
  transparent: true,
566
570
  style: {
567
- position: "relative",
568
- top: "50%",
569
571
  height: "100%",
570
572
  objectFit: "cover",
571
573
  width: "100%",
574
+ objectPosition: sourceVideoOrientation === "portrait" ? "0% 30%" : undefined,
572
575
  borderRadius: "30px",
573
- filter: noBackgroundVideoEffects !== null && noBackgroundVideoEffects !== void 0 && noBackgroundVideoEffects.facePop ? "brightness(1.1) contrast(1.15) saturate(1.05)" : undefined,
574
- transform: "translateY(-50%)"
576
+ filter: noBackgroundVideoEffects !== null && noBackgroundVideoEffects !== void 0 && noBackgroundVideoEffects.facePop ? "brightness(1.1) contrast(1.15) saturate(1.05)" : undefined
575
577
  }
576
578
  })) : null, /*#__PURE__*/React.createElement(AbsoluteFill, {
577
579
  style: {
@@ -1,5 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["src", "faceMetadata", "containerWidth", "containerHeight", "enableInterpolation", "useAveragePosition", "centerHorizontally", "translateX", "translateY", "showDebugInfo", "style", "className", "containerStyle", "noBackgroundVideoEffects", "noBackgroundEffects", "transparent"];
2
+ var _excluded = ["src", "faceMetadata", "containerWidth", "containerHeight", "enableInterpolation", "useAveragePosition", "centerHorizontally", "anchorToBottom", "translateX", "translateY", "showDebugInfo", "style", "className", "containerStyle", "noBackgroundVideoEffects", "noBackgroundEffects", "transparent"];
3
3
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
4
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -8,34 +8,35 @@ 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 {boolean} params.anchorToBottom - Whether to anchor the video to the container bottom edge
36
+ * @param {number} params.translateX - Additional translateX offset
37
+ * @param {number} params.translateY - Additional translateY offset
38
+ * @param {string} params.orientation - Viewport orientation (portrait, square, landscape)
39
+ * @returns {Object} Transform styles and debug info
39
40
  */
40
41
  var calculateFaceCenteredTranslation = function calculateFaceCenteredTranslation(_ref) {
41
42
  var _faceMetadata$metadat, _faceMetadata$metadat2;
@@ -50,6 +51,8 @@ var calculateFaceCenteredTranslation = function calculateFaceCenteredTranslation
50
51
  useAveragePosition = _ref$useAveragePositi === void 0 ? false : _ref$useAveragePositi,
51
52
  _ref$centerHorizontal = _ref.centerHorizontally,
52
53
  centerHorizontally = _ref$centerHorizontal === void 0 ? false : _ref$centerHorizontal,
54
+ _ref$anchorToBottom = _ref.anchorToBottom,
55
+ anchorToBottom = _ref$anchorToBottom === void 0 ? false : _ref$anchorToBottom,
53
56
  _ref$translateX = _ref.translateX,
54
57
  translateX = _ref$translateX === void 0 ? 0 : _ref$translateX,
55
58
  _ref$translateY = _ref.translateY,
@@ -120,17 +123,18 @@ var calculateFaceCenteredTranslation = function calculateFaceCenteredTranslation
120
123
  }
121
124
  }
122
125
 
123
- // Calculate translation needed to center the face in the container
124
- // When scale > 1, translate happens in scaled coordinate system, so we need to adjust
126
+ // Calculate translation needed to center the face in the container or anchor
127
+ // the source video bottom edge to the container bottom edge.
128
+ // When scale > 1, translate happens in scaled coordinate system, so we need to adjust.
125
129
  var baseTranslateX = containerCenterX - faceX + translateX;
126
- var baseTranslateY = centerHorizontally ? translateY : containerCenterY - faceY + translateY;
130
+ var baseTranslateY = anchorToBottom ? containerHeight - sourceHeight + translateY : centerHorizontally ? translateY : containerCenterY - faceY + translateY;
127
131
 
128
132
  // Adjust translation for scaling - divide by scale factor when scale > 1
129
133
  var finalTranslateX = scale > 1 ? baseTranslateX / scale : baseTranslateX;
130
134
  var finalTranslateY = scale > 1 ? baseTranslateY / scale : baseTranslateY;
131
135
 
132
136
  // Add additional translateY adjustment when scale > 1 to keep video contained within container
133
- if (!centerHorizontally) {
137
+ if (!centerHorizontally && !anchorToBottom) {
134
138
  // Calculate the scaled video height
135
139
  var scaledVideoHeight = sourceHeight * scale;
136
140
 
@@ -185,7 +189,7 @@ var calculateFaceCenteredTranslation = function calculateFaceCenteredTranslation
185
189
 
186
190
  // Transform origin should be at the face position for proper scaling
187
191
  var transformOriginX = (relativeFaceX * 100).toFixed(2);
188
- var transformOriginY = (relativeFaceY * 100).toFixed(2);
192
+ var transformOriginY = anchorToBottom ? "100.00" : (relativeFaceY * 100).toFixed(2);
189
193
  var transformOrigin = "".concat(transformOriginX, "% ").concat(transformOriginY, "%");
190
194
  return {
191
195
  transform: transform,
@@ -208,14 +212,15 @@ var calculateFaceCenteredTranslation = function calculateFaceCenteredTranslation
208
212
  containerHeight: containerHeight,
209
213
  useAveragePosition: useAveragePosition,
210
214
  centerHorizontally: centerHorizontally,
215
+ anchorToBottom: anchorToBottom,
211
216
  scalingApplied: scale > 1,
212
217
  orientation: orientation
213
218
  }
214
219
  };
215
220
  };
216
221
 
217
- /**
218
- * Get face data for a specific frame with optional interpolation
222
+ /**
223
+ * Get face data for a specific frame with optional interpolation
219
224
  */
220
225
  function getFaceDataForFrame(frames, frameIndex, enableInterpolation) {
221
226
  var _prevFrame, _nextFrame;
@@ -274,8 +279,8 @@ function getFaceDataForFrame(frames, frameIndex, enableInterpolation) {
274
279
  return ((_prevFrame = prevFrame) === null || _prevFrame === void 0 ? void 0 : _prevFrame.data) || ((_nextFrame = nextFrame) === null || _nextFrame === void 0 ? void 0 : _nextFrame.data) || null;
275
280
  }
276
281
 
277
- /**
278
- * Calculate average face position from all frames with face data
282
+ /**
283
+ * Calculate average face position from all frames with face data
279
284
  */
280
285
  function getAverageFaceData(frames) {
281
286
  if (!frames || frames.length === 0) return null;
@@ -310,14 +315,14 @@ function getAverageFaceData(frames) {
310
315
  };
311
316
  }
312
317
 
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
318
+ /**
319
+ * Calculate the negative space offset when face-centering a video
320
+ *
321
+ * @param {Object} faceMetadata - Face detection metadata object
322
+ * @param {number} containerWidth - Container width in pixels
323
+ * @param {number} containerHeight - Container height in pixels
324
+ * @param {number} scale - Scale factor applied to the video
325
+ * @returns {Object} Object containing horizontal and vertical offsets and which side has negative space
321
326
  */
322
327
  export var calculateNegativeSpaceOffset = function calculateNegativeSpaceOffset(faceMetadata, containerWidth, containerHeight) {
323
328
  var _faceMetadata$metadat4, _faceMetadata$metadat5;
@@ -415,22 +420,23 @@ export var calculateNegativeSpaceOffset = function calculateNegativeSpaceOffset(
415
420
  };
416
421
  };
417
422
 
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
423
+ /**
424
+ * FaceCenteredVideo Component
425
+ * @param {Object} props - Component props
426
+ * @param {string} props.src - Video source URL
427
+ * @param {Object} props.faceMetadata - Face detection metadata
428
+ * @param {number} props.containerWidth - Container width in pixels (required)
429
+ * @param {number} props.containerHeight - Container height in pixels (required)
430
+ * @param {boolean} props.enableInterpolation - Whether to interpolate between frames
431
+ * @param {boolean} props.useAveragePosition - Whether to use average face position for entire video duration
432
+ * @param {boolean} props.centerHorizontally - Whether to only center horizontally (X axis), not vertically (Y axis)
433
+ * @param {boolean} props.anchorToBottom - Whether to anchor the video to the container bottom edge
434
+ * @param {number} props.translateX - Additional translateX offset (optional)
435
+ * @param {number} props.translateY - Additional translateY offset (optional)
436
+ * @param {boolean} props.showDebugInfo - Whether to show debug information
437
+ * @param {Object} props.style - Additional styles to apply to video
438
+ * @param {string} props.className - CSS class name
439
+ * @param {...Object} props.otherProps - Other props to pass to OffthreadVideo
434
440
  */
435
441
  export var FaceCenteredVideo = function FaceCenteredVideo(_ref2) {
436
442
  var _faceMetadata$metadat7, _faceMetadata$metadat8, _faceMetadata$metadat9, _faceMetadata$metadat10;
@@ -444,6 +450,8 @@ export var FaceCenteredVideo = function FaceCenteredVideo(_ref2) {
444
450
  useAveragePosition = _ref2$useAveragePosit === void 0 ? true : _ref2$useAveragePosit,
445
451
  _ref2$centerHorizonta = _ref2.centerHorizontally,
446
452
  centerHorizontally = _ref2$centerHorizonta === void 0 ? false : _ref2$centerHorizonta,
453
+ _ref2$anchorToBottom = _ref2.anchorToBottom,
454
+ anchorToBottom = _ref2$anchorToBottom === void 0 ? false : _ref2$anchorToBottom,
447
455
  _ref2$translateX = _ref2.translateX,
448
456
  translateX = _ref2$translateX === void 0 ? 0 : _ref2$translateX,
449
457
  _ref2$translateY = _ref2.translateY,
@@ -482,6 +490,7 @@ export var FaceCenteredVideo = function FaceCenteredVideo(_ref2) {
482
490
  enableInterpolation: enableInterpolation,
483
491
  useAveragePosition: useAveragePosition,
484
492
  centerHorizontally: centerHorizontally,
493
+ anchorToBottom: anchorToBottom,
485
494
  translateX: translateX,
486
495
  translateY: translateY,
487
496
  orientation: orientation
@@ -492,7 +501,7 @@ export var FaceCenteredVideo = function FaceCenteredVideo(_ref2) {
492
501
  var videoStyle = _objectSpread({
493
502
  width: sourceWidth || "100%",
494
503
  height: sourceHeight || "100%",
495
- transform: sourceHeight === containerHeight && sourceWidth === containerWidth ? undefined : transform,
504
+ transform: !anchorToBottom && sourceHeight === containerHeight && sourceWidth === containerWidth ? undefined : transform,
496
505
  transformOrigin: transformOrigin || "center center",
497
506
  position: "absolute",
498
507
  top: 0,
@@ -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,