@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.
- package/dist/bundle.js +1 -1
- package/dist/screenplay/RemotionRenderer/RemotionRenderer.js +43 -42
- package/dist/screenplay/RemotionRenderer/assets/wordObjects/LICENSE +21 -0
- package/dist/screenplay/RemotionRenderer/assets/wordObjects/images.js +24 -0
- package/dist/screenplay/RemotionRenderer/assets/wordObjects/manifest.json +67 -0
- package/dist/screenplay/RemotionRenderer/components/effects/CaptionWordObjectOverlay.js +243 -0
- package/dist/screenplay/RemotionRenderer/components/effects/Sentence.js +10 -3
- 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/MotionStillInset.js +51 -5
- package/dist/screenplay/RemotionRenderer/components/layouts/SimpleFrameSentence.js +3 -1
- package/dist/screenplay/RemotionRenderer/components/utils/FaceCenteredVideo.js +9 -0
- package/dist/screenplay/RemotionRenderer/helpers/captionWordObjectGeometry.js +139 -0
- package/dist/screenplay/RemotionRenderer/helpers/captionWordObjects.js +112 -0
- package/dist/screenplay/RemotionRenderer/helpers/headingColors.js +12 -0
- package/dist/screenplay/RemotionRenderer/helpers/normalizeDisabledTranscripts.js +3 -629
- package/dist/screenplay/RemotionRenderer/main/lib/layouts/SimpleFrameLayout.js +8 -3
- package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionPunctuated.js +29 -6
- package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionWordBoom.js +30 -7
- package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionWordBubble.js +30 -7
- package/dist/screenplay/RemotionRenderer/theme/themes/default/Sentence/AnimatedSentence.js +1 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/default/Sentence.js +8 -4
- package/dist/screenplay/RemotionRenderer/theme/themes/fullcover/TextFullCover.js +10 -5
- package/dist/screenplay/RemotionRenderer/theme/themes/glassmorphism/Sentence.js +14 -4
- package/dist/screenplay/RemotionRenderer/tracks/LayoutVideoTrack.js +1 -1
- package/dist/screenplay/RemotionRenderer/tracks/Soundtrack.js +20 -3
- package/dist/timing.cjs +1050 -0
- package/package.json +8 -4
|
@@ -8,13 +8,13 @@ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r),
|
|
|
8
8
|
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; }
|
|
9
9
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
10
10
|
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); }
|
|
11
|
+
import { prepareCaptionWordObjects } from "./helpers/captionWordObjects.js";
|
|
11
12
|
import { applyLogoVisibility } from "./helpers/applyLogoVisibility.js";
|
|
12
13
|
import { screenplaySchema } from "./main/screenplaySchema.js";
|
|
13
14
|
import { LayoutFactory } from "./main/lib/layouts/LayoutFactory.js";
|
|
14
15
|
import { toFrames, toPascalCase } from "./main/lib/Sequence.js";
|
|
15
16
|
import { getCreatorCollabEffectProps } from "./main/lib/layouts/creatorCollabProps.js";
|
|
16
|
-
import
|
|
17
|
-
import { normalizeDisabledTranscripts } from "./helpers/normalizeDisabledTranscripts.js";
|
|
17
|
+
import timing from "../../timing.cjs";
|
|
18
18
|
import { coerceRenderableText, coerceRenderableTextProps, RENDERABLE_TEXT_PROP_KEYS } from "./helpers/coerceRenderableText.js";
|
|
19
19
|
export var RemotionRenderer = /*#__PURE__*/function () {
|
|
20
20
|
function RemotionRenderer(screenplay) {
|
|
@@ -27,7 +27,8 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
27
27
|
_defineProperty(this, "captionsVideoTrack", []);
|
|
28
28
|
_defineProperty(this, "audioTrack", []);
|
|
29
29
|
_defineProperty(this, "output", void 0);
|
|
30
|
-
this.screenplay =
|
|
30
|
+
this.screenplay = timing.prepareScreenplay(applyLogoVisibility(screenplay));
|
|
31
|
+
this.wordObjectStats = prepareCaptionWordObjects(this.screenplay, this.fps);
|
|
31
32
|
this.output = this.getRemotionOutputSettings();
|
|
32
33
|
}
|
|
33
34
|
return _createClass(RemotionRenderer, [{
|
|
@@ -44,10 +45,8 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
44
45
|
}, {
|
|
45
46
|
key: "getRemotionOutputSettings",
|
|
46
47
|
value: function getRemotionOutputSettings() {
|
|
47
|
-
var _this = this;
|
|
48
48
|
var compositionMetadata = {};
|
|
49
49
|
var orientation = this.screenplay.output.orientation;
|
|
50
|
-
var theme = this.screenplay.input.theme || "default";
|
|
51
50
|
switch (orientation) {
|
|
52
51
|
case "landscape":
|
|
53
52
|
{
|
|
@@ -68,24 +67,9 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
68
67
|
break;
|
|
69
68
|
}
|
|
70
69
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
var _segment$layout, _segment$layout$data, _segment$layout2, _segment$layout2$data, _segment$layout3, _segment$layout3$data, _segment$transitionAf;
|
|
75
|
-
var segmentDuration = (segment === null || segment === void 0 ? void 0 : (_segment$layout = segment.layout) === null || _segment$layout === void 0 ? void 0 : (_segment$layout$data = _segment$layout.data) === null || _segment$layout$data === void 0 ? void 0 : _segment$layout$data.duration) || 0;
|
|
76
|
-
var trimLeft = (segment === null || segment === void 0 ? void 0 : (_segment$layout2 = segment.layout) === null || _segment$layout2 === void 0 ? void 0 : (_segment$layout2$data = _segment$layout2.data) === null || _segment$layout2$data === void 0 ? void 0 : _segment$layout2$data.trimLeft) || 0;
|
|
77
|
-
var trimRight = (segment === null || segment === void 0 ? void 0 : (_segment$layout3 = segment.layout) === null || _segment$layout3 === void 0 ? void 0 : (_segment$layout3$data = _segment$layout3.data) === null || _segment$layout3$data === void 0 ? void 0 : _segment$layout3$data.trimRight) || 0;
|
|
78
|
-
var netDuration = segmentDuration - trimLeft - trimRight;
|
|
79
|
-
var duration = durationInFrames + netDuration * _this.fps;
|
|
80
|
-
var transitionTheme = transitionThemes[theme];
|
|
81
|
-
var transitionAfter = (_segment$transitionAf = segment === null || segment === void 0 ? void 0 : segment.transitionAfter) !== null && _segment$transitionAf !== void 0 ? _segment$transitionAf : segment === null || segment === void 0 ? void 0 : segment.__transitionAfter;
|
|
82
|
-
if (transitionTheme) {
|
|
83
|
-
var isLast = index === array.length - 1;
|
|
84
|
-
var shouldApplyTransition = !isLast && transitionAfter !== false;
|
|
85
|
-
return toFrames(duration) - (shouldApplyTransition ? transitionTheme.durationInFrames : 0);
|
|
86
|
-
}
|
|
87
|
-
return toFrames(duration);
|
|
88
|
-
}, 0);
|
|
70
|
+
compositionMetadata.durationInFrames = timing.getScreenplayTiming(this.screenplay, {
|
|
71
|
+
prepared: true
|
|
72
|
+
}).durationInFrames;
|
|
89
73
|
compositionMetadata.theme = this.screenplay.input.theme || "default";
|
|
90
74
|
compositionMetadata.fps = this.fps;
|
|
91
75
|
return _objectSpread(_objectSpread({}, this.screenplay.output), compositionMetadata);
|
|
@@ -146,7 +130,7 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
146
130
|
}, {
|
|
147
131
|
key: "toRemotionSegment",
|
|
148
132
|
value: function toRemotionSegment(screenPlaySegment) {
|
|
149
|
-
var
|
|
133
|
+
var _this = this,
|
|
150
134
|
_ref2,
|
|
151
135
|
_screenPlaySegment$tr;
|
|
152
136
|
var layout = screenPlaySegment.layout,
|
|
@@ -156,9 +140,9 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
156
140
|
layout: LayoutFactory.createObject(layout),
|
|
157
141
|
effects: effects.map(function (effect) {
|
|
158
142
|
if (effect.type.includes("caption")) {
|
|
159
|
-
return
|
|
143
|
+
return _this.toRemotionCaptionSegment(effect, layout);
|
|
160
144
|
}
|
|
161
|
-
return
|
|
145
|
+
return _this.toRemotionFragment(effect, layout);
|
|
162
146
|
}),
|
|
163
147
|
transitionAfter: (_ref2 = (_screenPlaySegment$tr = screenPlaySegment === null || screenPlaySegment === void 0 ? void 0 : screenPlaySegment.transitionAfter) !== null && _screenPlaySegment$tr !== void 0 ? _screenPlaySegment$tr : screenPlaySegment === null || screenPlaySegment === void 0 ? void 0 : screenPlaySegment.__transitionAfter) !== null && _ref2 !== void 0 ? _ref2 : true
|
|
164
148
|
};
|
|
@@ -173,7 +157,12 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
173
157
|
value: function toRemotionCaptionSegment(screenPlaySegment, screenplayLayout) {
|
|
174
158
|
var _screenplayLayout$dat,
|
|
175
159
|
_screenPlaySegment$da23,
|
|
176
|
-
|
|
160
|
+
_this2 = this,
|
|
161
|
+
_screenplayLayout$dat2,
|
|
162
|
+
_screenplayLayout$dat3,
|
|
163
|
+
_screenplayLayout$dat4,
|
|
164
|
+
_screenplayLayout$dat5,
|
|
165
|
+
_screenplayLayout$dat6;
|
|
177
166
|
var trimLeft = (screenplayLayout === null || screenplayLayout === void 0 ? void 0 : (_screenplayLayout$dat = screenplayLayout.data) === null || _screenplayLayout$dat === void 0 ? void 0 : _screenplayLayout$dat.trimLeft) || 0;
|
|
178
167
|
var segmentOffset = Number(screenPlaySegment === null || screenPlaySegment === void 0 ? void 0 : (_screenPlaySegment$da23 = screenPlaySegment.data) === null || _screenPlaySegment$da23 === void 0 ? void 0 : _screenPlaySegment$da23.offset);
|
|
179
168
|
var from = Number.isFinite(segmentOffset) ? this.fps * (segmentOffset + trimLeft) : 0;
|
|
@@ -182,16 +171,16 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
182
171
|
throw new Error("No transcript_text provided in transcript segment");
|
|
183
172
|
}
|
|
184
173
|
transcripts = transcripts.map(function (transcript) {
|
|
185
|
-
var transcriptFrom =
|
|
186
|
-
var transcriptDurationInFrames = toFrames(
|
|
174
|
+
var transcriptFrom = _this2.fps * (transcript.offset - trimLeft) || 0;
|
|
175
|
+
var transcriptDurationInFrames = toFrames(_this2.fps * transcript.duration);
|
|
187
176
|
return {
|
|
188
177
|
text: coerceRenderableText(transcript.text),
|
|
189
178
|
from: transcriptFrom,
|
|
190
179
|
durationInFrames: transcriptDurationInFrames,
|
|
191
180
|
punctuations: transcript.punctuations ? transcript.punctuations.map(function (p) {
|
|
192
181
|
return _objectSpread(_objectSpread({}, p), {}, {
|
|
193
|
-
start: toFrames(
|
|
194
|
-
end: toFrames(
|
|
182
|
+
start: toFrames(_this2.fps * (p.start - trimLeft)),
|
|
183
|
+
end: toFrames(_this2.fps * (p.end - trimLeft))
|
|
195
184
|
});
|
|
196
185
|
}) : []
|
|
197
186
|
};
|
|
@@ -202,7 +191,12 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
202
191
|
from: from,
|
|
203
192
|
transcripts: transcripts,
|
|
204
193
|
theme: screenPlaySegment.theme,
|
|
205
|
-
color: screenPlaySegment.data.color
|
|
194
|
+
color: screenPlaySegment.data.color,
|
|
195
|
+
wordObjectGeometry: screenplayLayout ? {
|
|
196
|
+
faceMetadata: (_screenplayLayout$dat2 = screenplayLayout.data) === null || _screenplayLayout$dat2 === void 0 ? void 0 : (_screenplayLayout$dat3 = _screenplayLayout$dat2.noBackgroundVideo) === null || _screenplayLayout$dat3 === void 0 ? void 0 : _screenplayLayout$dat3.faceMetadata,
|
|
197
|
+
videoZoom: screenplayLayout.type === "simple_frame_zoom_cut" ? 1.2 : ((_screenplayLayout$dat4 = screenplayLayout.data) === null || _screenplayLayout$dat4 === void 0 ? void 0 : (_screenplayLayout$dat5 = _screenplayLayout$dat4.sourceVideo) === null || _screenplayLayout$dat5 === void 0 ? void 0 : _screenplayLayout$dat5.zoom) || 1,
|
|
198
|
+
framePadding: (_screenplayLayout$dat6 = screenplayLayout.data) !== null && _screenplayLayout$dat6 !== void 0 && _screenplayLayout$dat6.frameColor ? 30 : 0
|
|
199
|
+
} : undefined
|
|
206
200
|
};
|
|
207
201
|
}
|
|
208
202
|
}, {
|
|
@@ -234,17 +228,23 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
234
228
|
}, {
|
|
235
229
|
key: "generateLayoutTrack",
|
|
236
230
|
value: function generateLayoutTrack() {
|
|
237
|
-
var
|
|
231
|
+
var _this3 = this;
|
|
238
232
|
var segmentTrack = this.getSegmentTrack();
|
|
239
233
|
var segments = segmentTrack.segments;
|
|
240
|
-
|
|
241
|
-
|
|
234
|
+
var _timing$getScreenplay = timing.getScreenplayTiming(this.screenplay, {
|
|
235
|
+
prepared: true
|
|
236
|
+
}),
|
|
237
|
+
sequences = _timing$getScreenplay.sequences;
|
|
238
|
+
segments.forEach(function (segment, index) {
|
|
239
|
+
var rendered = _this3.toRemotionSegment(segment);
|
|
240
|
+
if (_this3.screenplay.input.theme === "none") rendered.transitionAfter = sequences[index].overlapFrames > 0;
|
|
241
|
+
_this3.layoutVideoTrack.push(rendered);
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
244
|
}, {
|
|
245
245
|
key: "generateEffectsTrack",
|
|
246
246
|
value: function generateEffectsTrack() {
|
|
247
|
-
var
|
|
247
|
+
var _this4 = this;
|
|
248
248
|
var screenPlayEffectTrack = this.screenplay.tracks.find(function (track) {
|
|
249
249
|
return track.type === "effect";
|
|
250
250
|
});
|
|
@@ -253,13 +253,13 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
253
253
|
}
|
|
254
254
|
var segments = screenPlayEffectTrack.segments;
|
|
255
255
|
segments.forEach(function (segment) {
|
|
256
|
-
|
|
256
|
+
_this4.effectsVideoTrack.push(_this4.toEffectSegment(segment));
|
|
257
257
|
});
|
|
258
258
|
}
|
|
259
259
|
}, {
|
|
260
260
|
key: "generateCaptionsTrack",
|
|
261
261
|
value: function generateCaptionsTrack() {
|
|
262
|
-
var
|
|
262
|
+
var _this5 = this;
|
|
263
263
|
var screenPlayCaptionTrack = this.screenplay.tracks.find(function (track) {
|
|
264
264
|
return track.type === "caption";
|
|
265
265
|
});
|
|
@@ -269,13 +269,13 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
269
269
|
var segments = screenPlayCaptionTrack.segments;
|
|
270
270
|
segments.forEach(function (segment, _ref3) {
|
|
271
271
|
_objectDestructuringEmpty(_ref3);
|
|
272
|
-
|
|
272
|
+
_this5.captionsVideoTrack.push(_this5.toRemotionCaptionSegment(segment));
|
|
273
273
|
});
|
|
274
274
|
}
|
|
275
275
|
}, {
|
|
276
276
|
key: "generateAudioTrack",
|
|
277
277
|
value: function generateAudioTrack() {
|
|
278
|
-
var
|
|
278
|
+
var _this6 = this;
|
|
279
279
|
var screenPlayAudioTrack = this.screenplay.tracks.find(function (track) {
|
|
280
280
|
return track.type === "audio";
|
|
281
281
|
});
|
|
@@ -285,7 +285,7 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
285
285
|
}
|
|
286
286
|
var segments = screenPlayAudioTrack.segments;
|
|
287
287
|
segments.forEach(function (segment) {
|
|
288
|
-
|
|
288
|
+
_this6.audioTrack.push(_this6.toRemotionAudioFragment(segment));
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
291
|
}, {
|
|
@@ -298,7 +298,8 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
298
298
|
effectsVideoTrack: this.effectsVideoTrack,
|
|
299
299
|
captionsVideoTrack: this.captionsVideoTrack,
|
|
300
300
|
audioTrack: this.audioTrack,
|
|
301
|
-
output: this.output
|
|
301
|
+
output: this.output,
|
|
302
|
+
captionWordObjectStats: this.wordObjectStats
|
|
302
303
|
};
|
|
303
304
|
}
|
|
304
305
|
}]);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE
|