@zync/zync-screnplay-player 0.1.250 → 0.1.251
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/components/layouts/CreatorCollabConversationSpine.js +1 -1
- package/dist/screenplay/RemotionRenderer/components/layouts/CreatorCollabRackFocus.js +1 -1
- package/dist/screenplay/RemotionRenderer/components/layouts/Keyword.js +9 -7
- package/dist/screenplay/RemotionRenderer/components/layouts/KeywordStudioBackdrop.js +7 -5
- package/dist/screenplay/RemotionRenderer/components/layouts/MotionStillInset.js +51 -5
- package/dist/screenplay/RemotionRenderer/main/lib/layouts/LayoutFactory.js +15 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionWordBoom.js +40 -12
- package/package.json +1 -1
package/dist/screenplay/RemotionRenderer/components/layouts/CreatorCollabConversationSpine.js
CHANGED
|
@@ -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 || '#
|
|
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 || '#
|
|
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;
|
|
@@ -3,7 +3,7 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
3
3
|
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; }
|
|
4
4
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
5
5
|
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); }
|
|
6
|
-
import { AbsoluteFill, Audio, Easing, Img, interpolate, OffthreadVideo, useCurrentFrame, useVideoConfig } from "remotion";
|
|
6
|
+
import { AbsoluteFill, Audio, Easing, Img, interpolate, OffthreadVideo, staticFile, useCurrentFrame, useVideoConfig } from "remotion";
|
|
7
7
|
import { FONT_FAMILIES } from "../../fontRegistry.js";
|
|
8
8
|
import React from "react";
|
|
9
9
|
import { useOrientationBased } from "../../hooks/useOrientationBased.js";
|
|
@@ -50,9 +50,11 @@ var Logo = function Logo(_ref) {
|
|
|
50
50
|
var Word = function Word(_ref2) {
|
|
51
51
|
var word = _ref2.word,
|
|
52
52
|
index = _ref2.index;
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
var _React$useMemo = React.useMemo(function () {
|
|
54
|
+
return distributeTextToFit(word, 300, 120, 50);
|
|
55
|
+
}, [word]),
|
|
56
|
+
fontSize = _React$useMemo.fontSize,
|
|
57
|
+
lines = _React$useMemo.lines;
|
|
56
58
|
var frame = useCurrentFrame();
|
|
57
59
|
var timings = [0, 90];
|
|
58
60
|
var options = {};
|
|
@@ -355,7 +357,7 @@ var KeywordComponent = function KeywordComponent(_ref4) {
|
|
|
355
357
|
height: "100%",
|
|
356
358
|
mixBlendMode: "screen"
|
|
357
359
|
},
|
|
358
|
-
src: "
|
|
360
|
+
src: staticFile("plexus1-1080.mp4"),
|
|
359
361
|
startFrom: 120
|
|
360
362
|
}), /*#__PURE__*/React.createElement(RotatingWordsContainer, {
|
|
361
363
|
words: words
|
|
@@ -436,7 +438,7 @@ var KeywordComponent = function KeywordComponent(_ref4) {
|
|
|
436
438
|
height: "100%",
|
|
437
439
|
mixBlendMode: "screen"
|
|
438
440
|
},
|
|
439
|
-
src: "
|
|
441
|
+
src: staticFile("plexus1-1080.mp4"),
|
|
440
442
|
startFrom: 120
|
|
441
443
|
}), /*#__PURE__*/React.createElement(RotatingWordsContainer, {
|
|
442
444
|
words: words
|
|
@@ -496,7 +498,7 @@ var KeywordComponent = function KeywordComponent(_ref4) {
|
|
|
496
498
|
height: "100%",
|
|
497
499
|
mixBlendMode: "screen"
|
|
498
500
|
},
|
|
499
|
-
src: "
|
|
501
|
+
src: staticFile("plexus1-1080.mp4"),
|
|
500
502
|
startFrom: 120
|
|
501
503
|
}), /*#__PURE__*/React.createElement(RotatingWordsContainer, {
|
|
502
504
|
words: words
|
|
@@ -5,7 +5,7 @@ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Sym
|
|
|
5
5
|
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
6
6
|
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; }
|
|
7
7
|
import React from "react";
|
|
8
|
-
import { AbsoluteFill, Audio, OffthreadVideo, useCurrentFrame, useVideoConfig, spring, interpolate, Easing } from "remotion";
|
|
8
|
+
import { AbsoluteFill, Audio, OffthreadVideo, staticFile, useCurrentFrame, useVideoConfig, spring, interpolate, Easing } from "remotion";
|
|
9
9
|
import { FONT_FAMILIES } from "../../fontRegistry.js";
|
|
10
10
|
import { useOrientationBased } from "../../hooks/useOrientationBased.js";
|
|
11
11
|
import { CHROME_PADDING } from "../../config.js";
|
|
@@ -67,9 +67,11 @@ var Word = function Word(_ref2) {
|
|
|
67
67
|
maxWidth = _ref3.maxWidth,
|
|
68
68
|
maxHeight = _ref3.maxHeight,
|
|
69
69
|
maxFontSize = _ref3.maxFontSize;
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
var _React$useMemo = React.useMemo(function () {
|
|
71
|
+
return distributeTextToFit(word, maxWidth !== null && maxWidth !== void 0 ? maxWidth : 350, maxHeight !== null && maxHeight !== void 0 ? maxHeight : 120, maxFontSize !== null && maxFontSize !== void 0 ? maxFontSize : 54);
|
|
72
|
+
}, [word, maxWidth, maxHeight, maxFontSize]),
|
|
73
|
+
lines = _React$useMemo.lines,
|
|
74
|
+
fontSize = _React$useMemo.fontSize;
|
|
73
75
|
var frame = useCurrentFrame();
|
|
74
76
|
var _useVideoConfig = useVideoConfig(),
|
|
75
77
|
fps = _useVideoConfig.fps;
|
|
@@ -544,7 +546,7 @@ var BackdropFrame = function BackdropFrame(_ref5) {
|
|
|
544
546
|
mixBlendMode: "screen",
|
|
545
547
|
opacity: 0.35 // softer integration
|
|
546
548
|
},
|
|
547
|
-
src: "
|
|
549
|
+
src: staticFile("plexus1-1080.mp4"),
|
|
548
550
|
startFrom: 120,
|
|
549
551
|
muted: true
|
|
550
552
|
}), /*#__PURE__*/React.createElement(RotatingWordsContainer, {
|
|
@@ -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:
|
|
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:
|
|
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:
|
|
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(
|
|
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,
|
|
@@ -1,4 +1,7 @@
|
|
|
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
|
+
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; }
|
|
3
|
+
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; }
|
|
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; }
|
|
2
5
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
3
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
4
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
@@ -28,7 +31,19 @@ export var LayoutFactory = /*#__PURE__*/function () {
|
|
|
28
31
|
return _createClass(LayoutFactory, null, [{
|
|
29
32
|
key: "createObject",
|
|
30
33
|
value: function createObject(props) {
|
|
34
|
+
var _props$data;
|
|
31
35
|
var layout;
|
|
36
|
+
var sourceVideo = (_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.sourceVideo;
|
|
37
|
+
var proxyVideoUrl = sourceVideo === null || sourceVideo === void 0 ? void 0 : sourceVideo.proxyVideoUrl;
|
|
38
|
+
if (typeof proxyVideoUrl === "string" && proxyVideoUrl.trim() && proxyVideoUrl !== sourceVideo.videoUrl) {
|
|
39
|
+
props = _objectSpread(_objectSpread({}, props), {}, {
|
|
40
|
+
data: _objectSpread(_objectSpread({}, props.data), {}, {
|
|
41
|
+
sourceVideo: _objectSpread(_objectSpread({}, sourceVideo), {}, {
|
|
42
|
+
videoUrl: proxyVideoUrl
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
}
|
|
32
47
|
switch (props.type) {
|
|
33
48
|
case "text_with_video":
|
|
34
49
|
{
|
|
@@ -1,3 +1,12 @@
|
|
|
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
|
+
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; }
|
|
3
|
+
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; }
|
|
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
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
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
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
8
|
+
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; } }
|
|
9
|
+
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; }
|
|
1
10
|
import { AbsoluteFill, Sequence, useCurrentFrame, useVideoConfig } from "remotion";
|
|
2
11
|
import React from "react";
|
|
3
12
|
import { FONT_FAMILIES } from "../../../fontRegistry.js";
|
|
@@ -36,10 +45,33 @@ export var CaptionWordBoom = function CaptionWordBoom(_ref) {
|
|
|
36
45
|
var containerWidth = width * 0.8;
|
|
37
46
|
var frame = useCurrentFrame();
|
|
38
47
|
var brighterColor = getBrighterColor(primaryColor, accentColor);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
var preparedTranscripts = React.useMemo(function () {
|
|
49
|
+
return transcripts.map(function (transcript) {
|
|
50
|
+
var _distributeTextToFit = distributeTextToFit(transcript.text, width * 0.7, fontSize * 1.6, fontSize),
|
|
51
|
+
textFontSize = _distributeTextToFit.fontSize;
|
|
52
|
+
var punctuationsByIndex = new Map();
|
|
53
|
+
var _iterator = _createForOfIteratorHelper(transcript.punctuations),
|
|
54
|
+
_step;
|
|
55
|
+
try {
|
|
56
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
57
|
+
var punctuation = _step.value;
|
|
58
|
+
if (!punctuationsByIndex.has(punctuation.index)) {
|
|
59
|
+
punctuationsByIndex.set(punctuation.index, punctuation);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
} catch (err) {
|
|
63
|
+
_iterator.e(err);
|
|
64
|
+
} finally {
|
|
65
|
+
_iterator.f();
|
|
66
|
+
}
|
|
67
|
+
return _objectSpread(_objectSpread({}, transcript), {}, {
|
|
68
|
+
textFontSize: textFontSize,
|
|
69
|
+
words: transcript.text.split(" "),
|
|
70
|
+
punctuationsByIndex: punctuationsByIndex
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}, [transcripts, width, fontSize]);
|
|
74
|
+
return /*#__PURE__*/React.createElement(AbsoluteFill, null, preparedTranscripts.map(function (transcript, index) {
|
|
43
75
|
return /*#__PURE__*/React.createElement(Sequence, {
|
|
44
76
|
key: index,
|
|
45
77
|
from: transcript.from,
|
|
@@ -57,7 +89,7 @@ export var CaptionWordBoom = function CaptionWordBoom(_ref) {
|
|
|
57
89
|
width: containerWidth,
|
|
58
90
|
margin: "0 auto",
|
|
59
91
|
transform: "translateX(-50%)",
|
|
60
|
-
fontSize: textFontSize,
|
|
92
|
+
fontSize: transcript.textFontSize,
|
|
61
93
|
textTransform: "uppercase",
|
|
62
94
|
textAlign: "center",
|
|
63
95
|
fontFamily: fontFamily,
|
|
@@ -66,13 +98,9 @@ export var CaptionWordBoom = function CaptionWordBoom(_ref) {
|
|
|
66
98
|
fontWeight: 400,
|
|
67
99
|
color: "#fff"
|
|
68
100
|
}
|
|
69
|
-
}, transcript.
|
|
70
|
-
var
|
|
71
|
-
var isPunctuated = frame >= Number((
|
|
72
|
-
return p.index === wordIndex;
|
|
73
|
-
})) === null || _transcript$punctuati === void 0 ? void 0 : _transcript$punctuati.start) || 0) && Number(frame <= ((_transcript$punctuati2 = transcript.punctuations.find(function (p) {
|
|
74
|
-
return p.index === wordIndex;
|
|
75
|
-
})) === null || _transcript$punctuati2 === void 0 ? void 0 : _transcript$punctuati2.end));
|
|
101
|
+
}, transcript.words.map(function (word, wordIndex) {
|
|
102
|
+
var punctuation = transcript.punctuationsByIndex.get(wordIndex);
|
|
103
|
+
var isPunctuated = frame >= Number((punctuation === null || punctuation === void 0 ? void 0 : punctuation.start) || 0) && Number(frame <= (punctuation === null || punctuation === void 0 ? void 0 : punctuation.end));
|
|
76
104
|
return /*#__PURE__*/React.createElement("span", {
|
|
77
105
|
key: wordIndex,
|
|
78
106
|
style: {
|