@zync/zync-screnplay-player 0.1.251 → 0.1.253

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 (32) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/bundle.js.LICENSE.txt +24 -0
  3. package/dist/screenplay/RemotionRenderer/RemotionRenderer.js +51 -42
  4. package/dist/screenplay/RemotionRenderer/assets/wordObjects/LICENSE +21 -0
  5. package/dist/screenplay/RemotionRenderer/assets/wordObjects/emojiCatalog.json +1 -0
  6. package/dist/screenplay/RemotionRenderer/assets/wordObjects/images.js +24 -0
  7. package/dist/screenplay/RemotionRenderer/assets/wordObjects/manifest.json +67 -0
  8. package/dist/screenplay/RemotionRenderer/components/effects/CaptionWordObjectOverlay.js +275 -0
  9. package/dist/screenplay/RemotionRenderer/components/effects/Sentence.js +10 -3
  10. package/dist/screenplay/RemotionRenderer/components/layouts/Keyword.js +7 -9
  11. package/dist/screenplay/RemotionRenderer/components/layouts/KeywordStudioBackdrop.js +5 -7
  12. package/dist/screenplay/RemotionRenderer/components/layouts/SimpleFrameSentence.js +3 -1
  13. package/dist/screenplay/RemotionRenderer/components/utils/FaceCenteredVideo.js +9 -0
  14. package/dist/screenplay/RemotionRenderer/helpers/captionWordObjectGeometry.js +143 -0
  15. package/dist/screenplay/RemotionRenderer/helpers/captionWordObjects.js +143 -0
  16. package/dist/screenplay/RemotionRenderer/helpers/emojiCatalog.js +17 -0
  17. package/dist/screenplay/RemotionRenderer/helpers/headingColors.js +12 -0
  18. package/dist/screenplay/RemotionRenderer/helpers/loadWordObjectArtwork.js +56 -0
  19. package/dist/screenplay/RemotionRenderer/helpers/normalizeDisabledTranscripts.js +3 -629
  20. package/dist/screenplay/RemotionRenderer/main/lib/layouts/LayoutFactory.js +0 -15
  21. package/dist/screenplay/RemotionRenderer/main/lib/layouts/SimpleFrameLayout.js +8 -3
  22. package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionPunctuated.js +29 -6
  23. package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionWordBoom.js +42 -47
  24. package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionWordBubble.js +30 -7
  25. package/dist/screenplay/RemotionRenderer/theme/themes/default/Sentence/AnimatedSentence.js +1 -0
  26. package/dist/screenplay/RemotionRenderer/theme/themes/default/Sentence.js +8 -4
  27. package/dist/screenplay/RemotionRenderer/theme/themes/fullcover/TextFullCover.js +10 -5
  28. package/dist/screenplay/RemotionRenderer/theme/themes/glassmorphism/Sentence.js +14 -4
  29. package/dist/screenplay/RemotionRenderer/tracks/LayoutVideoTrack.js +1 -1
  30. package/dist/screenplay/RemotionRenderer/tracks/Soundtrack.js +20 -3
  31. package/dist/timing.cjs +1050 -0
  32. package/package.json +8 -4
@@ -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; }
@@ -14,6 +17,7 @@ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf
14
17
  import { Layout } from "./DefaultLayout.js";
15
18
  import { cleanFacemetadata } from "../../../helpers/cleanFacemetadata";
16
19
  import { SimpleFrameSentence } from "../../../components/layouts/SimpleFrameSentence";
20
+ import { getHeadingColors } from "../../../helpers/headingColors.js";
17
21
  export var SimpleFrameLayout = /*#__PURE__*/function (_Layout) {
18
22
  function SimpleFrameLayout(props) {
19
23
  var _this;
@@ -27,7 +31,7 @@ export var SimpleFrameLayout = /*#__PURE__*/function (_Layout) {
27
31
  key: "getVideoProps",
28
32
  value: function getVideoProps(props) {
29
33
  var _props$data$noBackgro, _props$data$noBackgro2, _props$data$sourceVid, _props$data$sourceVid2, _props$data, _props$data2, _props$data3, _props$data4;
30
- this.props = {
34
+ this.props = _objectSpread(_objectSpread({
31
35
  noBackgroundVideoEffects: props.data.noBackgroundVideoEffects,
32
36
  noBackgroundVideoUrl: (_props$data$noBackgro = props.data.noBackgroundVideo) === null || _props$data$noBackgro === void 0 ? void 0 : _props$data$noBackgro.videoUrl,
33
37
  faceMetadata: cleanFacemetadata((_props$data$noBackgro2 = props.data.noBackgroundVideo) === null || _props$data$noBackgro2 === void 0 ? void 0 : _props$data$noBackgro2.faceMetadata),
@@ -36,9 +40,10 @@ export var SimpleFrameLayout = /*#__PURE__*/function (_Layout) {
36
40
  disableTransitionSounds: (_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.disableTransitionSounds,
37
41
  useSquareInLandscape: (props === null || props === void 0 ? void 0 : (_props$data2 = props.data) === null || _props$data2 === void 0 ? void 0 : _props$data2.useSquareInLandscape) || false,
38
42
  brollUrl: (_props$data3 = props.data) === null || _props$data3 === void 0 ? void 0 : _props$data3.brollUrl,
39
- sentenceText: (_props$data4 = props.data) === null || _props$data4 === void 0 ? void 0 : _props$data4.sentenceText,
43
+ sentenceText: (_props$data4 = props.data) === null || _props$data4 === void 0 ? void 0 : _props$data4.sentenceText
44
+ }, getHeadingColors(props.data)), {}, {
40
45
  theme: props === null || props === void 0 ? void 0 : props.theme
41
- };
46
+ });
42
47
  }
43
48
  }]);
44
49
  }(Layout);
@@ -1,5 +1,6 @@
1
1
  import { AbsoluteFill, Sequence, useCurrentFrame, useVideoConfig } from "remotion";
2
2
  import React from "react";
3
+ import { CaptionWordObjectOverlay } from "../../../components/effects/CaptionWordObjectOverlay";
3
4
  import { FONT_FAMILIES } from "../../../fontRegistry.js";
4
5
  import { useOrientationBased } from "../../../hooks/useOrientationBased.js";
5
6
  import { distributeTextToFit } from "./Sentence/SentenceSimple.helpers.js";
@@ -7,9 +8,14 @@ import { useTheme } from "../../hooks/useTheme";
7
8
  import { getBrighterColor } from "../../../helpers/hexToRgb";
8
9
  import { CAPTION_PORTRAIT_BOTTOM_OFFSET } from "./constants";
9
10
  var fontFamily = FONT_FAMILIES.POPPINS;
10
- export var CaptionPunctuated = function CaptionPunctuated(_ref) {
11
+ var _CaptionPunctuated = function CaptionPunctuated(_ref) {
11
12
  var transcripts = _ref.transcripts,
12
- color = _ref.color;
13
+ color = _ref.color,
14
+ wordObjectGeometry = _ref.wordObjectGeometry,
15
+ _ref$measurementRef = _ref.measurementRef,
16
+ measurementRef = _ref$measurementRef === void 0 ? null : _ref$measurementRef,
17
+ _ref$measurementFrame = _ref.measurementFrame,
18
+ measurementFrame = _ref$measurementFrame === void 0 ? null : _ref$measurementFrame;
13
19
  var _useVideoConfig = useVideoConfig(),
14
20
  width = _useVideoConfig.width;
15
21
  var _useOrientationBased = useOrientationBased({
@@ -34,7 +40,8 @@ export var CaptionPunctuated = function CaptionPunctuated(_ref) {
34
40
  accentColor = _useTheme.accentColor,
35
41
  accentContrast = _useTheme.accentContrast;
36
42
  var containerWidth = width * 0.8;
37
- var frame = useCurrentFrame();
43
+ var currentFrame = useCurrentFrame();
44
+ var frame = measurementFrame !== null && measurementFrame !== void 0 ? measurementFrame : currentFrame;
38
45
  var brighterColor = getBrighterColor(primaryColor, accentColor);
39
46
  return /*#__PURE__*/React.createElement(AbsoluteFill, null, transcripts.map(function (transcript, index) {
40
47
  var _distributeTextToFit = distributeTextToFit(transcript.text, width * 0.7, fontSize * 1.6, fontSize),
@@ -42,9 +49,10 @@ export var CaptionPunctuated = function CaptionPunctuated(_ref) {
42
49
  textFontSize = _distributeTextToFit.fontSize;
43
50
  return /*#__PURE__*/React.createElement(Sequence, {
44
51
  key: index,
45
- from: transcript.from,
46
- durationInFrames: transcript.durationInFrames
52
+ from: measurementRef ? 0 : transcript.from,
53
+ durationInFrames: measurementRef ? undefined : transcript.durationInFrames
47
54
  }, /*#__PURE__*/React.createElement("p", {
55
+ ref: measurementRef,
48
56
  style: {
49
57
  display: "flex",
50
58
  alignItems: "center",
@@ -73,11 +81,26 @@ export var CaptionPunctuated = function CaptionPunctuated(_ref) {
73
81
  })) === null || _transcript$punctuati2 === void 0 ? void 0 : _transcript$punctuati2.end));
74
82
  return /*#__PURE__*/React.createElement("span", {
75
83
  key: wordIndex,
84
+ "data-word-index": wordIndex,
76
85
  style: {
77
86
  color: isPunctuated ? color || brighterColor : "white",
78
87
  textShadow: "3px 3px 3px #000"
79
88
  }
80
89
  }, word);
81
90
  })));
91
+ }), !measurementRef && /*#__PURE__*/React.createElement(CaptionWordObjectOverlay, {
92
+ transcripts: transcripts,
93
+ geometry: wordObjectGeometry,
94
+ fontFamily: fontFamily,
95
+ color: color,
96
+ renderSource: function renderSource(transcript, wordIndex, at, ref) {
97
+ return /*#__PURE__*/React.createElement(_CaptionPunctuated, {
98
+ transcripts: [transcript],
99
+ color: color,
100
+ measurementRef: ref,
101
+ measurementFrame: at
102
+ });
103
+ }
82
104
  }));
83
- };
105
+ };
106
+ export { _CaptionPunctuated as CaptionPunctuated };
@@ -1,14 +1,6 @@
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; }
10
1
  import { AbsoluteFill, Sequence, useCurrentFrame, useVideoConfig } from "remotion";
11
2
  import React from "react";
3
+ import { CaptionWordObjectOverlay } from "../../../components/effects/CaptionWordObjectOverlay";
12
4
  import { FONT_FAMILIES } from "../../../fontRegistry.js";
13
5
  import { useOrientationBased } from "../../../hooks/useOrientationBased.js";
14
6
  import { distributeTextToFit } from "./Sentence/SentenceSimple.helpers.js";
@@ -16,9 +8,14 @@ import { useTheme } from "../../hooks/useTheme";
16
8
  import { getBrighterColor } from "../../../helpers/hexToRgb";
17
9
  import { CAPTION_PORTRAIT_BOTTOM_OFFSET } from "./constants";
18
10
  var fontFamily = FONT_FAMILIES.TITAN_ONE;
19
- export var CaptionWordBoom = function CaptionWordBoom(_ref) {
11
+ var _CaptionWordBoom = function CaptionWordBoom(_ref) {
20
12
  var transcripts = _ref.transcripts,
21
- color = _ref.color;
13
+ color = _ref.color,
14
+ wordObjectGeometry = _ref.wordObjectGeometry,
15
+ _ref$measurementRef = _ref.measurementRef,
16
+ measurementRef = _ref$measurementRef === void 0 ? null : _ref$measurementRef,
17
+ _ref$measurementFrame = _ref.measurementFrame,
18
+ measurementFrame = _ref$measurementFrame === void 0 ? null : _ref$measurementFrame;
22
19
  var _useVideoConfig = useVideoConfig(),
23
20
  width = _useVideoConfig.width;
24
21
  var _useOrientationBased = useOrientationBased({
@@ -43,40 +40,19 @@ export var CaptionWordBoom = function CaptionWordBoom(_ref) {
43
40
  accentColor = _useTheme.accentColor,
44
41
  accentContrast = _useTheme.accentContrast;
45
42
  var containerWidth = width * 0.8;
46
- var frame = useCurrentFrame();
43
+ var currentFrame = useCurrentFrame();
44
+ var frame = measurementFrame !== null && measurementFrame !== void 0 ? measurementFrame : currentFrame;
47
45
  var brighterColor = getBrighterColor(primaryColor, accentColor);
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) {
46
+ return /*#__PURE__*/React.createElement(AbsoluteFill, null, transcripts.map(function (transcript, index) {
47
+ var _distributeTextToFit = distributeTextToFit(transcript.text, width * 0.7, fontSize * 1.6, fontSize),
48
+ lines = _distributeTextToFit.lines,
49
+ textFontSize = _distributeTextToFit.fontSize;
75
50
  return /*#__PURE__*/React.createElement(Sequence, {
76
51
  key: index,
77
- from: transcript.from,
78
- durationInFrames: transcript.durationInFrames
52
+ from: measurementRef ? 0 : transcript.from,
53
+ durationInFrames: measurementRef ? undefined : transcript.durationInFrames
79
54
  }, /*#__PURE__*/React.createElement("p", {
55
+ ref: measurementRef,
80
56
  style: {
81
57
  display: "flex",
82
58
  alignItems: "center",
@@ -89,7 +65,7 @@ export var CaptionWordBoom = function CaptionWordBoom(_ref) {
89
65
  width: containerWidth,
90
66
  margin: "0 auto",
91
67
  transform: "translateX(-50%)",
92
- fontSize: transcript.textFontSize,
68
+ fontSize: textFontSize,
93
69
  textTransform: "uppercase",
94
70
  textAlign: "center",
95
71
  fontFamily: fontFamily,
@@ -98,18 +74,37 @@ export var CaptionWordBoom = function CaptionWordBoom(_ref) {
98
74
  fontWeight: 400,
99
75
  color: "#fff"
100
76
  }
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));
77
+ }, transcript.text.split(" ").map(function (word, wordIndex) {
78
+ var _transcript$punctuati, _transcript$punctuati2;
79
+ var isPunctuated = frame >= Number(((_transcript$punctuati = transcript.punctuations.find(function (p) {
80
+ return p.index === wordIndex;
81
+ })) === null || _transcript$punctuati === void 0 ? void 0 : _transcript$punctuati.start) || 0) && Number(frame <= ((_transcript$punctuati2 = transcript.punctuations.find(function (p) {
82
+ return p.index === wordIndex;
83
+ })) === null || _transcript$punctuati2 === void 0 ? void 0 : _transcript$punctuati2.end));
104
84
  return /*#__PURE__*/React.createElement("span", {
105
85
  key: wordIndex,
86
+ "data-word-index": wordIndex,
106
87
  style: {
107
88
  color: isPunctuated ? color || accentColor : "white",
108
89
  transform: "scaleX(".concat(isPunctuated ? 1.15 : 1, ") scaleY(").concat(isPunctuated ? 1.3 : 1, ")"),
109
- transition: "transform 0.2s",
90
+ transition: measurementRef ? undefined : "transform 0.2s",
110
91
  textShadow: "0px 0px 4px #000000, 0px 0px 4px #000000, 0px 0px 4px #000000, 0px 0px 10px #000000, 0px 0px 10px #000000"
111
92
  }
112
93
  }, word);
113
94
  })));
95
+ }), !measurementRef && /*#__PURE__*/React.createElement(CaptionWordObjectOverlay, {
96
+ transcripts: transcripts,
97
+ geometry: wordObjectGeometry,
98
+ fontFamily: fontFamily,
99
+ color: color,
100
+ renderSource: function renderSource(transcript, wordIndex, at, ref) {
101
+ return /*#__PURE__*/React.createElement(_CaptionWordBoom, {
102
+ transcripts: [transcript],
103
+ color: color,
104
+ measurementRef: ref,
105
+ measurementFrame: at
106
+ });
107
+ }
114
108
  }));
115
- };
109
+ };
110
+ export { _CaptionWordBoom as CaptionWordBoom };
@@ -1,5 +1,6 @@
1
1
  import { AbsoluteFill, Sequence, useCurrentFrame, useVideoConfig } from "remotion";
2
2
  import React from "react";
3
+ import { CaptionWordObjectOverlay } from "../../../components/effects/CaptionWordObjectOverlay";
3
4
  import { FONT_FAMILIES } from "../../../fontRegistry.js";
4
5
  import { useOrientationBased } from "../../../hooks/useOrientationBased.js";
5
6
  import { distributeTextToFit } from "./Sentence/SentenceSimple.helpers.js";
@@ -7,9 +8,14 @@ import { useTheme } from "../../hooks/useTheme";
7
8
  import { getBrighterColor } from "../../../helpers/hexToRgb";
8
9
  import { CAPTION_PORTRAIT_BOTTOM_OFFSET } from "./constants";
9
10
  var fontFamily = FONT_FAMILIES.MONTSERRAT;
10
- export var CaptionWordBubble = function CaptionWordBubble(_ref) {
11
+ var _CaptionWordBubble = function CaptionWordBubble(_ref) {
11
12
  var transcripts = _ref.transcripts,
12
- color = _ref.color;
13
+ color = _ref.color,
14
+ wordObjectGeometry = _ref.wordObjectGeometry,
15
+ _ref$measurementRef = _ref.measurementRef,
16
+ measurementRef = _ref$measurementRef === void 0 ? null : _ref$measurementRef,
17
+ _ref$measurementFrame = _ref.measurementFrame,
18
+ measurementFrame = _ref$measurementFrame === void 0 ? null : _ref$measurementFrame;
13
19
  var _useVideoConfig = useVideoConfig(),
14
20
  width = _useVideoConfig.width;
15
21
  var _useOrientationBased = useOrientationBased({
@@ -34,7 +40,8 @@ export var CaptionWordBubble = function CaptionWordBubble(_ref) {
34
40
  accentColor = _useTheme.accentColor,
35
41
  accentContrast = _useTheme.accentContrast;
36
42
  var containerWidth = width * 0.8;
37
- var frame = useCurrentFrame();
43
+ var currentFrame = useCurrentFrame();
44
+ var frame = measurementFrame !== null && measurementFrame !== void 0 ? measurementFrame : currentFrame;
38
45
  var brighterColor = getBrighterColor(primaryColor, accentColor);
39
46
  return /*#__PURE__*/React.createElement(AbsoluteFill, null, transcripts.map(function (transcript, index) {
40
47
  var _distributeTextToFit = distributeTextToFit(transcript.text, width * 0.7, fontSize * 1.6, fontSize),
@@ -42,9 +49,10 @@ export var CaptionWordBubble = function CaptionWordBubble(_ref) {
42
49
  textFontSize = _distributeTextToFit.fontSize;
43
50
  return /*#__PURE__*/React.createElement(Sequence, {
44
51
  key: index,
45
- from: transcript.from,
46
- durationInFrames: transcript.durationInFrames
52
+ from: measurementRef ? 0 : transcript.from,
53
+ durationInFrames: measurementRef ? undefined : transcript.durationInFrames
47
54
  }, /*#__PURE__*/React.createElement("p", {
55
+ ref: measurementRef,
48
56
  style: {
49
57
  display: "flex",
50
58
  gap: textFontSize / 2,
@@ -75,16 +83,31 @@ export var CaptionWordBubble = function CaptionWordBubble(_ref) {
75
83
  })) === null || _transcript$punctuati2 === void 0 ? void 0 : _transcript$punctuati2.end));
76
84
  return /*#__PURE__*/React.createElement("span", {
77
85
  key: wordIndex,
86
+ "data-word-index": wordIndex,
78
87
  style: {
79
88
  borderRadius: "10px",
80
89
  padding: "0.5rem 0.75rem 0.5rem 0.75rem",
81
90
  color: isPunctuated ? color || accentColor : "white",
82
91
  background: isPunctuated ? accentContrast : "transparent",
83
92
  transform: "scaleX(".concat(isPunctuated ? 1.15 : 1, ") scaleY(").concat(isPunctuated ? 1.3 : 1, ")"),
84
- transition: "transform 0.2s",
93
+ transition: measurementRef ? undefined : "transform 0.2s",
85
94
  textShadow: isPunctuated ? "" : "-3px 0 black, 0 3px black, 3px 0 black, 0 -3px black"
86
95
  }
87
96
  }, word);
88
97
  })));
98
+ }), !measurementRef && /*#__PURE__*/React.createElement(CaptionWordObjectOverlay, {
99
+ transcripts: transcripts,
100
+ geometry: wordObjectGeometry,
101
+ fontFamily: fontFamily,
102
+ color: color,
103
+ renderSource: function renderSource(transcript, wordIndex, at, ref) {
104
+ return /*#__PURE__*/React.createElement(_CaptionWordBubble, {
105
+ transcripts: [transcript],
106
+ color: color,
107
+ measurementRef: ref,
108
+ measurementFrame: at
109
+ });
110
+ }
89
111
  }));
90
- };
112
+ };
113
+ export { _CaptionWordBubble as CaptionWordBubble };
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import { Easing, interpolate, useCurrentFrame, useVideoConfig } from "remotion";
2
3
  var ANIMATION_DELAY_FACTOR = 0.25;
3
4
  var ANIMATION_DURATION = 60;
@@ -17,7 +17,9 @@ export var Sentence = function Sentence(_ref) {
17
17
  var lines = _ref.lines,
18
18
  fontSize = _ref.fontSize,
19
19
  maxWidth = _ref.maxWidth,
20
- maxHeight = _ref.maxHeight;
20
+ maxHeight = _ref.maxHeight,
21
+ headingTextColor = _ref.headingTextColor,
22
+ headingBackgroundColor = _ref.headingBackgroundColor;
21
23
  var opacity = useTimeInterpolate([0, 0.5], [0, 1]);
22
24
  var _useOrientationBased = useOrientationBased({
23
25
  landscape: {
@@ -58,11 +60,13 @@ export var Sentence = function Sentence(_ref) {
58
60
  opacity: opacity
59
61
  }
60
62
  }, /*#__PURE__*/React.createElement("div", {
61
- style: _objectSpread({
63
+ style: _objectSpread(_objectSpread({
62
64
  borderRadius: "30px",
63
65
  textAlign: "right",
64
66
  padding: CHROME_PADDING
65
- }, defaultGlassmorphismStyles)
67
+ }, defaultGlassmorphismStyles), headingBackgroundColor ? {
68
+ background: headingBackgroundColor
69
+ } : {})
66
70
  }, lines.map(function (line, index) {
67
71
  return /*#__PURE__*/React.createElement(AnimatedSentenceDefault, {
68
72
  key: index,
@@ -71,7 +75,7 @@ export var Sentence = function Sentence(_ref) {
71
75
  }, /*#__PURE__*/React.createElement("p", {
72
76
  style: {
73
77
  animationDelay: "".concat(index * 1000, "ms"),
74
- color: "#000",
78
+ color: headingTextColor || "#000",
75
79
  fontWeight: 700,
76
80
  fontSize: fontSize,
77
81
  textTransform: "uppercase",
@@ -91,7 +91,8 @@ var getWordStepFrames = function getWordStepFrames(_ref3) {
91
91
  return Math.max(1, Math.min(MAX_WORD_STEP_FRAMES, maxStepFrames));
92
92
  };
93
93
  var PositionedWords = function PositionedWords(_ref4) {
94
- var backgroundWipeFrames = _ref4.backgroundWipeFrames,
94
+ var headingTextColor = _ref4.headingTextColor,
95
+ backgroundWipeFrames = _ref4.backgroundWipeFrames,
95
96
  fontSize = _ref4.fontSize,
96
97
  frame = _ref4.frame,
97
98
  staticUntilIndex = _ref4.staticUntilIndex,
@@ -147,7 +148,7 @@ var PositionedWords = function PositionedWords(_ref4) {
147
148
  return /*#__PURE__*/React.createElement("span", {
148
149
  key: "".concat(word, "-").concat(index),
149
150
  style: {
150
- color: TEXT_COLOR,
151
+ color: headingTextColor || TEXT_COLOR,
151
152
  fontFamily: fontFamily,
152
153
  fontSize: fontSize,
153
154
  fontWeight: 900,
@@ -162,7 +163,9 @@ var PositionedWords = function PositionedWords(_ref4) {
162
163
  };
163
164
  export var TextFullCover = function TextFullCover(_ref5) {
164
165
  var _ref6, _ref7;
165
- var text = _ref5.text,
166
+ var headingTextColor = _ref5.headingTextColor,
167
+ headingBackgroundColor = _ref5.headingBackgroundColor,
168
+ text = _ref5.text,
166
169
  sentence = _ref5.sentence,
167
170
  sentenceText = _ref5.sentenceText,
168
171
  children = _ref5.children,
@@ -194,8 +197,8 @@ export var TextFullCover = function TextFullCover(_ref5) {
194
197
  var stepIndex = Math.min(lastStepIndex, Math.floor(frame / wordStepFrames));
195
198
  var previousStepIndex = Math.max(0, stepIndex - 1);
196
199
  var frameInWord = frame - stepIndex * wordStepFrames;
197
- var currentBackgroundColor = getBackgroundColor(stepIndex);
198
- var previousBackgroundColor = getBackgroundColor(Math.max(0, stepIndex - 1));
200
+ var currentBackgroundColor = headingBackgroundColor || getBackgroundColor(stepIndex);
201
+ var previousBackgroundColor = headingBackgroundColor || getBackgroundColor(Math.max(0, stepIndex - 1));
199
202
  var shouldWipe = stepIndex > 0 && frameInWord < backgroundWipeFrames;
200
203
  var wipeProgress = shouldWipe ? interpolate(frameInWord, [0, backgroundWipeFrames], [0, 1], {
201
204
  easing: Easing.out(Easing.cubic),
@@ -235,6 +238,7 @@ export var TextFullCover = function TextFullCover(_ref5) {
235
238
  width: "100%"
236
239
  }
237
240
  })) : null, shouldWipe ? /*#__PURE__*/React.createElement(PositionedWords, {
241
+ headingTextColor: headingTextColor,
238
242
  backgroundWipeFrames: backgroundWipeFrames,
239
243
  fontSize: fontSize,
240
244
  frame: frame,
@@ -254,6 +258,7 @@ export var TextFullCover = function TextFullCover(_ref5) {
254
258
  zIndex: 1
255
259
  }
256
260
  }, /*#__PURE__*/React.createElement(PositionedWords, {
261
+ headingTextColor: headingTextColor,
257
262
  backgroundWipeFrames: backgroundWipeFrames,
258
263
  fontSize: fontSize,
259
264
  frame: frame,
@@ -1,3 +1,9 @@
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); }
1
7
  import { AbsoluteFill } from "remotion";
2
8
  import { useTimeInterpolate } from "../../../hooks/useTimeInterpolate.js";
3
9
  import { AnimatedSentence } from "../default/Sentence/AnimatedSentence";
@@ -8,7 +14,9 @@ export var Sentence = function Sentence(_ref) {
8
14
  var lines = _ref.lines,
9
15
  fontSize = _ref.fontSize,
10
16
  maxWidth = _ref.maxWidth,
11
- maxHeight = _ref.maxHeight;
17
+ maxHeight = _ref.maxHeight,
18
+ headingTextColor = _ref.headingTextColor,
19
+ headingBackgroundColor = _ref.headingBackgroundColor;
12
20
  var opacity = useTimeInterpolate([0, 0.5], [0, 1]);
13
21
  return /*#__PURE__*/React.createElement(AbsoluteFill, {
14
22
  style: {
@@ -19,7 +27,7 @@ export var Sentence = function Sentence(_ref) {
19
27
  style: {
20
28
  width: maxWidth,
21
29
  height: maxHeight,
22
- background: "rgba(255, 255, 255, 0.75)",
30
+ background: headingBackgroundColor || "rgba(255, 255, 255, 0.75)",
23
31
  borderRadius: "30px",
24
32
  display: "flex",
25
33
  flexDirection: "column",
@@ -33,7 +41,9 @@ export var Sentence = function Sentence(_ref) {
33
41
  index: index,
34
42
  linesCount: lines.length
35
43
  }, /*#__PURE__*/React.createElement("p", {
36
- style: {
44
+ style: _objectSpread(_objectSpread({}, headingTextColor ? {
45
+ color: headingTextColor
46
+ } : {}), {}, {
37
47
  text: "#101840",
38
48
  fontSize: fontSize,
39
49
  fontWeight: "bold",
@@ -42,7 +52,7 @@ export var Sentence = function Sentence(_ref) {
42
52
  margin: 0,
43
53
  fontFamily: fontFamily,
44
54
  textWrap: "nowrap"
45
- }
55
+ })
46
56
  }, line));
47
57
  })));
48
58
  };
@@ -380,7 +380,7 @@ var TransitionVideoTrack = function TransitionVideoTrack(_ref9) {
380
380
  transitionAfter = _ref10$transitionAfte === void 0 ? true : _ref10$transitionAfte;
381
381
  var ComponentToRender = RegisteredComponents[component];
382
382
  var hasNextSegment = index < array.length - 1;
383
- var shouldTransition = hasNextSegment && transitionAfter !== false;
383
+ var shouldTransition = hasNextSegment && transitionAfter !== false && otherProps.durationInFrames >= transition.durationInFrames && array[index + 1].layout.durationInFrames >= transition.durationInFrames;
384
384
  if (!ComponentToRender) {
385
385
  return null;
386
386
  }
@@ -1,16 +1,33 @@
1
- import { Audio } from "remotion";
1
+ import { Audio, Sequence } from "remotion";
2
2
  import React from "react";
3
3
  export var Soundtrack = function Soundtrack() {
4
4
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
5
5
  src = _ref.src,
6
6
  volume = _ref.volume,
7
- loop = _ref.loop;
7
+ loop = _ref.loop,
8
+ _ref$startAudioFrom = _ref.startAudioFrom,
9
+ startAudioFrom = _ref$startAudioFrom === void 0 ? 0 : _ref$startAudioFrom;
8
10
  if (!src) {
9
11
  return null;
10
12
  }
13
+
14
+ // Advance the loop's local timeline while keeping the entire media period.
15
+ // trimBefore would shorten every repetition and can exceed media duration.
16
+ if (loop) {
17
+ return /*#__PURE__*/React.createElement(Sequence, {
18
+ from: -startAudioFrom,
19
+ layout: "none",
20
+ showInTimeline: false
21
+ }, /*#__PURE__*/React.createElement(Audio, {
22
+ src: src,
23
+ volume: volume,
24
+ loop: true
25
+ }));
26
+ }
11
27
  return /*#__PURE__*/React.createElement(Audio, {
12
28
  src: src,
13
29
  volume: volume,
14
- loop: loop
30
+ loop: loop,
31
+ trimBefore: startAudioFrom
15
32
  });
16
33
  };