@zync/zync-screnplay-player 0.1.250 → 0.1.252

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.
Files changed (28) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/screenplay/RemotionRenderer/RemotionRenderer.js +43 -42
  3. package/dist/screenplay/RemotionRenderer/assets/wordObjects/LICENSE +21 -0
  4. package/dist/screenplay/RemotionRenderer/assets/wordObjects/images.js +24 -0
  5. package/dist/screenplay/RemotionRenderer/assets/wordObjects/manifest.json +67 -0
  6. package/dist/screenplay/RemotionRenderer/components/effects/CaptionWordObjectOverlay.js +243 -0
  7. package/dist/screenplay/RemotionRenderer/components/effects/Sentence.js +10 -3
  8. package/dist/screenplay/RemotionRenderer/components/layouts/CreatorCollabConversationSpine.js +1 -1
  9. package/dist/screenplay/RemotionRenderer/components/layouts/CreatorCollabRackFocus.js +1 -1
  10. package/dist/screenplay/RemotionRenderer/components/layouts/MotionStillInset.js +51 -5
  11. package/dist/screenplay/RemotionRenderer/components/layouts/SimpleFrameSentence.js +3 -1
  12. package/dist/screenplay/RemotionRenderer/components/utils/FaceCenteredVideo.js +9 -0
  13. package/dist/screenplay/RemotionRenderer/helpers/captionWordObjectGeometry.js +139 -0
  14. package/dist/screenplay/RemotionRenderer/helpers/captionWordObjects.js +112 -0
  15. package/dist/screenplay/RemotionRenderer/helpers/headingColors.js +12 -0
  16. package/dist/screenplay/RemotionRenderer/helpers/normalizeDisabledTranscripts.js +3 -629
  17. package/dist/screenplay/RemotionRenderer/main/lib/layouts/SimpleFrameLayout.js +8 -3
  18. package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionPunctuated.js +29 -6
  19. package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionWordBoom.js +30 -7
  20. package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionWordBubble.js +30 -7
  21. package/dist/screenplay/RemotionRenderer/theme/themes/default/Sentence/AnimatedSentence.js +1 -0
  22. package/dist/screenplay/RemotionRenderer/theme/themes/default/Sentence.js +8 -4
  23. package/dist/screenplay/RemotionRenderer/theme/themes/fullcover/TextFullCover.js +10 -5
  24. package/dist/screenplay/RemotionRenderer/theme/themes/glassmorphism/Sentence.js +14 -4
  25. package/dist/screenplay/RemotionRenderer/tracks/LayoutVideoTrack.js +1 -1
  26. package/dist/screenplay/RemotionRenderer/tracks/Soundtrack.js +20 -3
  27. package/dist/timing.cjs +1050 -0
  28. package/package.json +8 -4
@@ -0,0 +1,67 @@
1
+ {
2
+ "upstream": "https://github.com/microsoft/fluentui-emoji",
3
+ "commit": "1ffb34c752ecf5d402f04cfb4b392c77f57c54bc",
4
+ "license": "MIT",
5
+ "assets": {
6
+ "plane": {
7
+ "sourcePath": "assets/Airplane/3D/airplane_3d.png",
8
+ "sha256": "dda8d8e9ccaca71973f4ee75fcab085dcffbb89f3987a9d2cc5401f186268fa1",
9
+ "bytes": 39468
10
+ },
11
+ "clock": {
12
+ "sourcePath": "assets/Alarm clock/3D/alarm_clock_3d.png",
13
+ "sha256": "1aa6929e1baa440db535fd321868dc76ddd888bf3e4f4333d37800ff2ec41c74",
14
+ "bytes": 42751
15
+ },
16
+ "light_bulb": {
17
+ "sourcePath": "assets/Light bulb/3D/light_bulb_3d.png",
18
+ "sha256": "df7b09aa18301507e6fb8c279df66d9afa465b6fed3e63d2efa84dacebdbbf79",
19
+ "bytes": 22450
20
+ },
21
+ "money": {
22
+ "sourcePath": "assets/Money bag/3D/money_bag_3d.png",
23
+ "sha256": "cec19b9cf0beac5bbd27a07dcbe1e68c54b04112b4641165705ccb920f230292",
24
+ "bytes": 34132
25
+ },
26
+ "rocket": {
27
+ "sourcePath": "assets/Rocket/3D/rocket_3d.png",
28
+ "sha256": "4636925a1dfc76a45dc83c08b983699d39143a0978f794a4e2dfb6cbffdcd7ab",
29
+ "bytes": 36274
30
+ },
31
+ "target": {
32
+ "sourcePath": "assets/Bullseye/3D/bullseye_3d.png",
33
+ "sha256": "2b2a2d9eec76c5649b8207b050f9135ce666c9d94694e5577aade50c53768437",
34
+ "bytes": 42883
35
+ },
36
+ "phone": {
37
+ "sourcePath": "assets/Mobile phone/3D/mobile_phone_3d.png",
38
+ "sha256": "c72cf9f888cb74cb8852679184e0dac945ed0340839c98a86c653f51e1e3504d",
39
+ "bytes": 26886
40
+ },
41
+ "computer": {
42
+ "sourcePath": "assets/Laptop/3D/laptop_3d.png",
43
+ "sha256": "3b8a267f6c3d2721af925782bdbc11c4e1bc9ae806c5c875557b100393665aab",
44
+ "bytes": 29028
45
+ },
46
+ "book": {
47
+ "sourcePath": "assets/Books/3D/books_3d.png",
48
+ "sha256": "36f75eaa1e1a849fc950f43962b447c206d96244858468240a6a81beaa97f7be",
49
+ "bytes": 26332
50
+ },
51
+ "key": {
52
+ "sourcePath": "assets/Key/3D/key_3d.png",
53
+ "sha256": "ae59ce2b8dcfaa1afcdfe91bde7cc88cf06a8493686a6676706d1c891bb349eb",
54
+ "bytes": 22458
55
+ },
56
+ "globe": {
57
+ "sourcePath": "assets/Globe showing europe-africa/3D/globe_showing_europe-africa_3d.png",
58
+ "sha256": "a69baec3cc48ed5206d171f5f494e3ab06665277ec4a3acc7e6bf3962ee460ad",
59
+ "bytes": 42555
60
+ },
61
+ "chart": {
62
+ "sourcePath": "assets/Chart increasing/3D/chart_increasing_3d.png",
63
+ "sha256": "dd5e6b29aa4067c5a4d9e152119497832d70e094b380998e5f5b0c51abbb3a64",
64
+ "bytes": 42157
65
+ }
66
+ }
67
+ }
@@ -0,0 +1,243 @@
1
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
4
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
5
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
6
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
8
+ 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; }
9
+ 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; } }
10
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
11
+ import React from "react";
12
+ import { AbsoluteFill, Img, Sequence, continueRender, delayRender, useCurrentFrame, useCurrentScale, useVideoConfig } from "remotion";
13
+ import { WORD_OBJECT_IMAGES } from "../../assets/wordObjects/images.js";
14
+ import { isEnabledWordObject } from "../../helpers/captionWordObjects.js";
15
+ import { getWordObjectMotion, placeCaptionWordObject, projectFaceRects } from "../../helpers/captionWordObjectGeometry.js";
16
+ import { cleanFacemetadata } from "../../helpers/cleanFacemetadata.js";
17
+ import { calculateFaceCenteredTranslation } from "../utils/FaceCenteredVideo";
18
+ var WordObject = function WordObject(_ref) {
19
+ var _props$output;
20
+ var event = _ref.event,
21
+ renderSource = _ref.renderSource,
22
+ geometry = _ref.geometry,
23
+ fontFamily = _ref.fontFamily,
24
+ color = _ref.color;
25
+ var frame = useCurrentFrame();
26
+ var _useVideoConfig = useVideoConfig(),
27
+ width = _useVideoConfig.width,
28
+ height = _useVideoConfig.height,
29
+ fps = _useVideoConfig.fps,
30
+ props = _useVideoConfig.props;
31
+ var playerScale = useCurrentScale();
32
+ var lineRef = React.useRef(null);
33
+ var rootRef = React.useRef(null);
34
+ var measurementRootRef = React.useRef(null);
35
+ var _React$useState = React.useState(null),
36
+ _React$useState2 = _slicedToArray(_React$useState, 2),
37
+ measurement = _React$useState2[0],
38
+ setMeasurement = _React$useState2[1];
39
+ var orientation = (props === null || props === void 0 ? void 0 : (_props$output = props.output) === null || _props$output === void 0 ? void 0 : _props$output.orientation) || (width === height ? "square" : "portrait");
40
+ React.useEffect(function () {
41
+ var _document$fonts;
42
+ var handle = delayRender("Measure caption word object source");
43
+ var cancelled = false;
44
+ var measure = function measure() {
45
+ var _faceMetadata$metadat, _faceMetadata$metadat2, _faceMetadata$metadat3, _faceMetadata$metadat4;
46
+ if (cancelled) return;
47
+ var line = lineRef.current;
48
+ var word = line === null || line === void 0 ? void 0 : line.querySelector("[data-word-index=\"".concat(event.punctuation.index, "\"]"));
49
+ var root = rootRef.current;
50
+ if (!line || !word || !root) {
51
+ setMeasurement({
52
+ placement: null
53
+ });
54
+ continueRender(handle);
55
+ return;
56
+ }
57
+ var rootRect = root.getBoundingClientRect();
58
+ var convert = function convert(rect) {
59
+ return {
60
+ left: (rect.left - rootRect.left) / playerScale,
61
+ top: (rect.top - rootRect.top) / playerScale,
62
+ right: (rect.right - rootRect.left) / playerScale,
63
+ bottom: (rect.bottom - rootRect.top) / playerScale
64
+ };
65
+ };
66
+ var anchor = convert(word.getBoundingClientRect());
67
+ var faceMetadata = cleanFacemetadata(geometry === null || geometry === void 0 ? void 0 : geometry.faceMetadata);
68
+ var videoProperties = faceMetadata === null || faceMetadata === void 0 ? void 0 : (_faceMetadata$metadat = faceMetadata.metadata) === null || _faceMetadata$metadat === void 0 ? void 0 : _faceMetadata$metadat.videoProperties;
69
+ var rawBoxes = ((faceMetadata === null || faceMetadata === void 0 ? void 0 : (_faceMetadata$metadat2 = faceMetadata.metadata) === null || _faceMetadata$metadat2 === void 0 ? void 0 : _faceMetadata$metadat2.frames) || []).map(function (f) {
70
+ var _f$face_data;
71
+ return (_f$face_data = f.face_data) === null || _f$face_data === void 0 ? void 0 : _f$face_data.face_bbox;
72
+ }).filter(Boolean);
73
+ var averageBox = faceMetadata === null || faceMetadata === void 0 ? void 0 : (_faceMetadata$metadat3 = faceMetadata.metadata) === null || _faceMetadata$metadat3 === void 0 ? void 0 : (_faceMetadata$metadat4 = _faceMetadata$metadat3.averageFaceData) === null || _faceMetadata$metadat4 === void 0 ? void 0 : _faceMetadata$metadat4.face_bbox;
74
+ if (averageBox) rawBoxes.push(averageBox);
75
+ var translation = faceMetadata ? calculateFaceCenteredTranslation({
76
+ faceMetadata: faceMetadata,
77
+ containerWidth: width,
78
+ containerHeight: height,
79
+ currentFrame: 0,
80
+ useAveragePosition: true,
81
+ centerHorizontally: false,
82
+ orientation: orientation
83
+ }) : null;
84
+ var sameSize = (videoProperties === null || videoProperties === void 0 ? void 0 : videoProperties.width) === width && (videoProperties === null || videoProperties === void 0 ? void 0 : videoProperties.height) === height;
85
+ var projection = sameSize ? {
86
+ scale: 1,
87
+ translateX: 0,
88
+ translateY: 0,
89
+ originX: 0,
90
+ originY: 0
91
+ } : translation === null || translation === void 0 ? void 0 : translation.projection;
92
+ var faceRects = projectFaceRects({
93
+ boxes: rawBoxes,
94
+ projection: projection,
95
+ width: width,
96
+ height: height,
97
+ videoZoom: geometry === null || geometry === void 0 ? void 0 : geometry.videoZoom,
98
+ framePadding: geometry === null || geometry === void 0 ? void 0 : geometry.framePadding
99
+ });
100
+ var wordRects = _toConsumableArray(measurementRootRef.current.querySelectorAll("[data-word-index]")).map(function (node) {
101
+ return convert(node.getBoundingClientRect());
102
+ });
103
+ // Measure the active-word envelope of every phrase in this segment so an
104
+ // object that outlives its source phrase also clears subsequent captions.
105
+ var captionTop = Math.min.apply(Math, _toConsumableArray(wordRects.map(function (r) {
106
+ return r.top;
107
+ })));
108
+ var placement = placeCaptionWordObject({
109
+ width: width,
110
+ height: height,
111
+ anchor: anchor,
112
+ captionTop: captionTop,
113
+ faceRects: faceRects
114
+ });
115
+ setMeasurement({
116
+ placement: placement,
117
+ anchor: anchor,
118
+ sourceStyle: window.getComputedStyle(word)
119
+ });
120
+ continueRender(handle);
121
+ };
122
+ Promise.resolve((_document$fonts = document.fonts) === null || _document$fonts === void 0 ? void 0 : _document$fonts.ready).then(measure)["catch"](function () {
123
+ if (!cancelled) setMeasurement({
124
+ placement: null
125
+ });
126
+ continueRender(handle);
127
+ });
128
+ return function () {
129
+ cancelled = true;
130
+ continueRender(handle);
131
+ };
132
+ }, [event, geometry, width, height, orientation, playerScale]);
133
+ var placement = measurement === null || measurement === void 0 ? void 0 : measurement.placement;
134
+ var motion = getWordObjectMotion({
135
+ frame: frame,
136
+ fps: fps,
137
+ durationInFrames: event.durationInFrames,
138
+ assetId: event.punctuation.wordObject.assetId
139
+ });
140
+ var scale = width / 1080;
141
+ var wordX = placement ? placement.startX + (placement.x - placement.startX) * motion.rise : 0;
142
+ var wordY = placement ? placement.startY + (placement.y - placement.startY) * motion.rise : 0;
143
+ return /*#__PURE__*/React.createElement(AbsoluteFill, {
144
+ ref: rootRef,
145
+ style: {
146
+ pointerEvents: "none"
147
+ }
148
+ }, /*#__PURE__*/React.createElement(AbsoluteFill, {
149
+ ref: measurementRootRef,
150
+ style: {
151
+ visibility: "hidden"
152
+ },
153
+ "aria-hidden": "true"
154
+ }, renderSource(event.transcript, event.punctuation.index, event.punctuation.start, lineRef), event.sourceTranscripts.filter(function (transcript) {
155
+ return transcript !== event.transcript;
156
+ }).map(function (transcript, index) {
157
+ var _transcript$punctuati, _transcript$punctuati2, _transcript$punctuati3;
158
+ return /*#__PURE__*/React.createElement(React.Fragment, {
159
+ key: index
160
+ }, renderSource(transcript, 0, (_transcript$punctuati = (_transcript$punctuati2 = transcript.punctuations) === null || _transcript$punctuati2 === void 0 ? void 0 : (_transcript$punctuati3 = _transcript$punctuati2[0]) === null || _transcript$punctuati3 === void 0 ? void 0 : _transcript$punctuati3.start) !== null && _transcript$punctuati !== void 0 ? _transcript$punctuati : transcript.from, {
161
+ current: null
162
+ }));
163
+ })), placement ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
164
+ "data-word-object-copy": true,
165
+ style: {
166
+ position: "absolute",
167
+ left: wordX,
168
+ top: wordY,
169
+ transform: "translate(-50%, -50%) ".concat(measurement.sourceStyle.transform === "none" ? "" : measurement.sourceStyle.transform),
170
+ opacity: motion.wordOpacity,
171
+ fontFamily: fontFamily,
172
+ fontSize: measurement.sourceStyle.fontSize,
173
+ fontWeight: measurement.sourceStyle.fontWeight,
174
+ lineHeight: measurement.sourceStyle.lineHeight,
175
+ padding: measurement.sourceStyle.padding,
176
+ backgroundColor: measurement.sourceStyle.backgroundColor,
177
+ borderRadius: measurement.sourceStyle.borderRadius,
178
+ textTransform: "uppercase",
179
+ whiteSpace: "nowrap",
180
+ color: color || measurement.sourceStyle.color,
181
+ textShadow: measurement.sourceStyle.textShadow
182
+ }
183
+ }, event.word), /*#__PURE__*/React.createElement(Img, {
184
+ "data-word-object": event.punctuation.wordObject.assetId,
185
+ src: WORD_OBJECT_IMAGES[event.punctuation.wordObject.assetId],
186
+ style: {
187
+ position: "absolute",
188
+ left: placement.x,
189
+ top: placement.y + motion.hover * scale,
190
+ width: placement.size,
191
+ height: placement.size,
192
+ objectFit: "contain",
193
+ opacity: motion.opacity,
194
+ transform: "translate(-50%, -50%) rotate(".concat(motion.rotation, "deg) scale(").concat(motion.scale, ")"),
195
+ filter: motion.glow ? "drop-shadow(0 0 ".concat(12 * scale, "px rgba(255,220,90,").concat(motion.glow, "))") : "drop-shadow(0 ".concat(3 * scale, "px ").concat(4 * scale, "px rgba(0,0,0,0.35))")
196
+ }
197
+ })) : null);
198
+ };
199
+ export var CaptionWordObjectOverlay = function CaptionWordObjectOverlay(_ref2) {
200
+ var transcripts = _ref2.transcripts,
201
+ renderSource = _ref2.renderSource,
202
+ geometry = _ref2.geometry,
203
+ fontFamily = _ref2.fontFamily,
204
+ color = _ref2.color;
205
+ var _useVideoConfig2 = useVideoConfig(),
206
+ width = _useVideoConfig2.width,
207
+ height = _useVideoConfig2.height,
208
+ fps = _useVideoConfig2.fps;
209
+ var events = React.useMemo(function () {
210
+ return transcripts.flatMap(function (transcript) {
211
+ return (transcript.punctuations || []).filter(function (p) {
212
+ return isEnabledWordObject(p.wordObject) && !p.__wordObjectSuppressed && !p.__wordObjectOnsetClipped && Number.isInteger(p.__wordObjectDurationInFrames) && p.__wordObjectDurationInFrames > 0 && Number.isFinite(p.start);
213
+ }).map(function (punctuation) {
214
+ return {
215
+ transcript: transcript,
216
+ punctuation: punctuation,
217
+ word: transcript.text.split(" ")[punctuation.index],
218
+ durationInFrames: punctuation.__wordObjectDurationInFrames,
219
+ sourceTranscripts: transcripts
220
+ };
221
+ });
222
+ });
223
+ }, [transcripts, fps]);
224
+ if (width > height) return null;
225
+ return /*#__PURE__*/React.createElement(AbsoluteFill, {
226
+ style: {
227
+ zIndex: 20,
228
+ pointerEvents: "none"
229
+ }
230
+ }, events.map(function (event, index) {
231
+ return /*#__PURE__*/React.createElement(Sequence, {
232
+ key: index,
233
+ from: event.punctuation.start,
234
+ durationInFrames: event.durationInFrames
235
+ }, /*#__PURE__*/React.createElement(WordObject, {
236
+ event: event,
237
+ renderSource: renderSource,
238
+ geometry: geometry,
239
+ fontFamily: fontFamily,
240
+ color: color
241
+ }));
242
+ }));
243
+ };
@@ -1,12 +1,16 @@
1
+ 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); }
1
2
  import React from "react";
2
3
  import { useThemedComponents } from "../../theme/hooks/useThemedComponents.js";
3
4
  import { useVideoConfig } from "remotion";
4
5
  import { useOrientationBased } from "../../hooks/useOrientationBased.js";
5
6
  import { distributeTextToFit } from "../../theme/themes/default/Sentence/SentenceSimple.helpers.js";
6
7
  import { KeyPointOverlayDepth } from "../layouts/KeyPointOverlayDepth";
8
+ import { getHeadingColors } from "../../helpers/headingColors.js";
7
9
  export var Sentence = function Sentence(_ref) {
8
10
  var sentence = _ref.sentence,
9
- theme = _ref.theme;
11
+ theme = _ref.theme,
12
+ headingTextColor = _ref.headingTextColor,
13
+ headingBackgroundColor = _ref.headingBackgroundColor;
10
14
  var Sentence = useThemedComponents("Sentence", theme);
11
15
  var _useVideoConfig = useVideoConfig(),
12
16
  width = _useVideoConfig.width,
@@ -40,11 +44,14 @@ export var Sentence = function Sentence(_ref) {
40
44
  var _distributeTextToFit = distributeTextToFit(sentence, maxWidth - sentencePadding * 2, maxHeight - sentencePadding * 2, maxFontSize),
41
45
  lines = _distributeTextToFit.lines,
42
46
  fontSize = _distributeTextToFit.fontSize;
43
- return /*#__PURE__*/React.createElement(Sentence, {
47
+ return /*#__PURE__*/React.createElement(Sentence, _extends({
44
48
  sentence: sentence,
45
49
  lines: lines,
46
50
  fontSize: fontSize,
47
51
  maxHeight: maxHeight,
48
52
  maxWidth: maxWidth
49
- });
53
+ }, getHeadingColors({
54
+ headingTextColor: headingTextColor,
55
+ headingBackgroundColor: headingBackgroundColor
56
+ })));
50
57
  };
@@ -240,7 +240,7 @@ export var CreatorCollabConversationSpine = function CreatorCollabConversationSp
240
240
  guestNameMaxFontSize = _useOrientationBased.guestNameMaxFontSize,
241
241
  guestRoleMaxFontSize = _useOrientationBased.guestRoleMaxFontSize;
242
242
  var isVerticalSpine = spineAxis === 'vertical';
243
- var accent = accentColor || '#38bdf8';
243
+ var accent = accentColor || primaryColor || '#ffffff';
244
244
  var textColor = primaryContrast || '#ffffff';
245
245
  var introOpacity = interpolateWithClamp(frame, [0, fps * 0.9], [0, 1]) * interpolateWithClamp(frame, [fps * 1.85, fps * 2.6], [1, 0]);
246
246
  var introTranslateY = interpolateWithClamp(frame, [0, fps * 0.9, fps * 2.6], [24, 0, -18], Easing.out(Easing.cubic));
@@ -240,7 +240,7 @@ export var CreatorCollabRackFocus = function CreatorCollabRackFocus(_ref) {
240
240
  var layerIn = interpolateWithClamp(frame, [fps * 1.9, fps * 3.1], [0, 1]);
241
241
  var layerTranslateY = interpolateWithClamp(frame, [fps * 1.9, fps * 3.1], [18, 0], Easing.out(Easing.cubic));
242
242
  var layerTranslateX = interpolateWithClamp(frame, [fps * 1.9, fps * 3.1], [34, 0], Easing.out(Easing.cubic));
243
- var accent = accentColor || '#6ec8ff';
243
+ var accent = accentColor || primaryColor || '#ffffff';
244
244
  var textColor = primaryContrast || '#ffffff';
245
245
  var mutedTextColor = withAlpha(textColor, 0.68) || textColor;
246
246
  var softTextColor = withAlpha(textColor, 0.8) || textColor;
@@ -1,8 +1,10 @@
1
1
  import React from "react";
2
2
  import { AbsoluteFill, Audio, Easing, Img, interpolate, OffthreadVideo, useCurrentFrame, useVideoConfig } from "remotion";
3
3
  import { useOrientationBased } from "../../hooks/useOrientationBased.js";
4
+ import { useVirtualBackground } from "../../hooks/useVirtualBackground";
4
5
  import { useTheme } from "../../theme/hooks/useTheme.js";
5
6
  import FaceCenteredVideo from "../utils/FaceCenteredVideo";
7
+ import { VirtualBackgroundUnderlay } from "../backgrounds/VirtualBackgroundUnderlay";
6
8
  var ANIMATION_SECONDS = 1.2;
7
9
  var INSET_ASPECT_RATIO = 9 / 16;
8
10
  var getInsetProgress = function getInsetProgress(_ref) {
@@ -48,6 +50,8 @@ var getInsetMetrics = function getInsetMetrics(_ref2) {
48
50
  var SourceVideo = function SourceVideo(_ref3) {
49
51
  var faceMetadata = _ref3.faceMetadata,
50
52
  height = _ref3.height,
53
+ _ref3$muted = _ref3.muted,
54
+ muted = _ref3$muted === void 0 ? false : _ref3$muted,
51
55
  noBackgroundVideoEffects = _ref3.noBackgroundVideoEffects,
52
56
  sourceVideoOrientation = _ref3.sourceVideoOrientation,
53
57
  src = _ref3.src,
@@ -67,7 +71,7 @@ var SourceVideo = function SourceVideo(_ref3) {
67
71
  useAveragePosition: true,
68
72
  centerHorizontally: false,
69
73
  transparent: transparent,
70
- muted: false,
74
+ muted: muted,
71
75
  noBackgroundVideoEffects: noBackgroundVideoEffects,
72
76
  style: {
73
77
  filter: transparent && noBackgroundVideoEffects !== null && noBackgroundVideoEffects !== void 0 && noBackgroundVideoEffects.facePop ? "brightness(1.1) contrast(1.15) saturate(1.05)" : undefined
@@ -78,7 +82,7 @@ var SourceVideo = function SourceVideo(_ref3) {
78
82
  pauseWhenBuffering: true,
79
83
  startFrom: startVideoFrom,
80
84
  src: src,
81
- muted: false,
85
+ muted: muted,
82
86
  transparent: transparent,
83
87
  style: {
84
88
  filter: transparent && noBackgroundVideoEffects !== null && noBackgroundVideoEffects !== void 0 && noBackgroundVideoEffects.facePop ? "brightness(1.1) contrast(1.15) saturate(1.05)" : undefined,
@@ -97,6 +101,7 @@ var MotionStillInsetContent = function MotionStillInsetContent(_ref4) {
97
101
  frameColor = _ref4.frameColor,
98
102
  height = _ref4.height,
99
103
  imageUrl = _ref4.imageUrl,
104
+ noBackgroundVideoUrl = _ref4.noBackgroundVideoUrl,
100
105
  noBackgroundVideoEffects = _ref4.noBackgroundVideoEffects,
101
106
  outputOrientation = _ref4.outputOrientation,
102
107
  sourceVideoOrientation = _ref4.sourceVideoOrientation,
@@ -112,7 +117,13 @@ var MotionStillInsetContent = function MotionStillInsetContent(_ref4) {
112
117
  fps: fps
113
118
  });
114
119
  var _useTheme = useTheme(),
115
- accentColor = _useTheme.accentColor;
120
+ accentColor = _useTheme.accentColor,
121
+ primaryColor = _useTheme.primaryColor;
122
+ var _useVirtualBackground = useVirtualBackground(),
123
+ isVirtual = _useVirtualBackground.isVirtual,
124
+ virtualBgUrl = _useVirtualBackground.url;
125
+ var showVirtual = isVirtual && !!noBackgroundVideoUrl;
126
+ var borderColor = accentColor || primaryColor;
116
127
  var inset = getInsetMetrics({
117
128
  width: width,
118
129
  height: height,
@@ -153,7 +164,7 @@ var MotionStillInsetContent = function MotionStillInsetContent(_ref4) {
153
164
  }) : null, /*#__PURE__*/React.createElement("div", {
154
165
  style: {
155
166
  borderRadius: sourceBorderRadius,
156
- border: accentColor ? "4px solid ".concat(accentColor) : undefined,
167
+ border: borderColor ? "4px solid ".concat(borderColor) : undefined,
157
168
  boxShadow: progress > 0 ? "0 ".concat(16 * progress, "px ").concat(44 * progress, "px rgba(0, 0, 0, ").concat(0.34 * progress, ")") : undefined,
158
169
  height: sourceHeight,
159
170
  left: sourceLeft,
@@ -164,16 +175,49 @@ var MotionStillInsetContent = function MotionStillInsetContent(_ref4) {
164
175
  width: sourceWidth,
165
176
  zIndex: 2
166
177
  }
178
+ }, /*#__PURE__*/React.createElement("div", {
179
+ style: {
180
+ height: "100%",
181
+ inset: 0,
182
+ position: "absolute",
183
+ width: "100%",
184
+ zIndex: 0
185
+ }
167
186
  }, /*#__PURE__*/React.createElement(SourceVideo, {
168
187
  faceMetadata: faceMetadata,
169
188
  height: sourceHeight,
189
+ muted: false,
170
190
  noBackgroundVideoEffects: noBackgroundVideoEffects,
171
191
  sourceVideoOrientation: sourceVideoOrientation,
172
192
  src: videoUrl,
173
193
  startVideoFrom: startVideoFrom,
174
194
  transparent: false,
175
195
  width: sourceWidth
176
- })), /*#__PURE__*/React.createElement(AbsoluteFill, {
196
+ })), showVirtual && virtualBgUrl ? /*#__PURE__*/React.createElement(VirtualBackgroundUnderlay, {
197
+ url: virtualBgUrl,
198
+ width: "100%",
199
+ height: "100%",
200
+ borderRadius: sourceBorderRadius,
201
+ zIndex: 1
202
+ }) : null, showVirtual ? /*#__PURE__*/React.createElement("div", {
203
+ style: {
204
+ height: "100%",
205
+ inset: 0,
206
+ position: "absolute",
207
+ width: "100%",
208
+ zIndex: 2
209
+ }
210
+ }, /*#__PURE__*/React.createElement(SourceVideo, {
211
+ faceMetadata: faceMetadata,
212
+ height: sourceHeight,
213
+ muted: true,
214
+ noBackgroundVideoEffects: noBackgroundVideoEffects,
215
+ sourceVideoOrientation: sourceVideoOrientation,
216
+ src: noBackgroundVideoUrl,
217
+ startVideoFrom: startVideoFrom,
218
+ transparent: true,
219
+ width: sourceWidth
220
+ })) : null), /*#__PURE__*/React.createElement(AbsoluteFill, {
177
221
  style: {
178
222
  zIndex: 3
179
223
  }
@@ -188,6 +232,7 @@ export var MotionStillInset = function MotionStillInset(_ref5) {
188
232
  faceMetadata = _ref5.faceMetadata,
189
233
  frameColor = _ref5.frameColor,
190
234
  imageUrl = _ref5.imageUrl,
235
+ noBackgroundVideoUrl = _ref5.noBackgroundVideoUrl,
191
236
  noBackgroundVideoEffects = _ref5.noBackgroundVideoEffects,
192
237
  sourceVideoOrientation = _ref5.sourceVideoOrientation,
193
238
  startVideoFrom = _ref5.startVideoFrom,
@@ -225,6 +270,7 @@ export var MotionStillInset = function MotionStillInset(_ref5) {
225
270
  frameColor: frameColor,
226
271
  height: height,
227
272
  imageUrl: imageUrl,
273
+ noBackgroundVideoUrl: noBackgroundVideoUrl,
228
274
  noBackgroundVideoEffects: noBackgroundVideoEffects,
229
275
  outputOrientation: activeOrientation,
230
276
  sourceVideoOrientation: sourceVideoOrientation,
@@ -12,6 +12,8 @@ export var SimpleFrameSentence = function SimpleFrameSentence(props) {
12
12
  }
13
13
  return /*#__PURE__*/React.createElement(SimpleFrame, props, /*#__PURE__*/React.createElement(Sentence, {
14
14
  theme: props.theme,
15
- sentence: props.sentenceText
15
+ sentence: props.sentenceText,
16
+ headingTextColor: props.headingTextColor,
17
+ headingBackgroundColor: props.headingBackgroundColor
16
18
  }), props.children);
17
19
  };
@@ -194,6 +194,14 @@ var calculateFaceCenteredTranslation = function calculateFaceCenteredTranslation
194
194
  return {
195
195
  transform: transform,
196
196
  transformOrigin: transformOrigin,
197
+ // Exact numeric projection for overlays sharing this video's coordinate system.
198
+ projection: {
199
+ scale: scale,
200
+ translateX: (finalTranslateX + horizontalOffset) * scale,
201
+ translateY: finalTranslateY * scale,
202
+ originX: faceX,
203
+ originY: anchorToBottom ? sourceHeight : faceY
204
+ },
197
205
  debugInfo: {
198
206
  frameIndex: useAveragePosition ? "AVERAGE" : frameIndex,
199
207
  relativeFaceX: relativeFaceX.toFixed(3),
@@ -569,4 +577,5 @@ export var FaceCenteredVideo = function FaceCenteredVideo(_ref2) {
569
577
  }
570
578
  }, "Error: ", debugInfo.error)));
571
579
  };
580
+ export { calculateFaceCenteredTranslation };
572
581
  export default FaceCenteredVideo;