@zync/zync-screnplay-player 0.1.198 → 0.1.199
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 +25 -14
- package/dist/screenplay/RemotionRenderer/development.js +2 -0
- package/dist/screenplay/RemotionRenderer/helpers/normalizeDisabledTranscripts.js +620 -0
- package/dist/screenplay/RemotionRenderer/tracks/LayoutVideoTrack.js +7 -3
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ import { screenplaySchema } from "./main/screenplaySchema.js";
|
|
|
12
12
|
import { LayoutFactory } from "./main/lib/layouts/LayoutFactory.js";
|
|
13
13
|
import { toFrames, toPascalCase } from "./main/lib/Sequence.js";
|
|
14
14
|
import { transitionThemes } from "./config.js";
|
|
15
|
+
import { normalizeDisabledTranscripts } from "./helpers/normalizeDisabledTranscripts.js";
|
|
15
16
|
export var RemotionRenderer = /*#__PURE__*/function () {
|
|
16
17
|
function RemotionRenderer(screenplay) {
|
|
17
18
|
_classCallCheck(this, RemotionRenderer);
|
|
@@ -23,7 +24,7 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
23
24
|
_defineProperty(this, "captionsVideoTrack", []);
|
|
24
25
|
_defineProperty(this, "audioTrack", []);
|
|
25
26
|
_defineProperty(this, "output", void 0);
|
|
26
|
-
this.screenplay = screenplay;
|
|
27
|
+
this.screenplay = normalizeDisabledTranscripts(screenplay);
|
|
27
28
|
this.output = this.getRemotionOutputSettings();
|
|
28
29
|
}
|
|
29
30
|
return _createClass(RemotionRenderer, [{
|
|
@@ -65,17 +66,20 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
var segmentTrack = this.getSegmentTrack();
|
|
68
|
-
var segments = segmentTrack.segments;
|
|
69
|
+
var segments = segmentTrack.segments || [];
|
|
69
70
|
compositionMetadata.durationInFrames = segments.reduce(function (durationInFrames, segment, index, array) {
|
|
70
|
-
var
|
|
71
|
-
var
|
|
72
|
-
var
|
|
71
|
+
var _segment$layout, _segment$layout$data, _segment$layout2, _segment$layout2$data, _segment$layout3, _segment$layout3$data, _segment$transitionAf;
|
|
72
|
+
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;
|
|
73
|
+
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;
|
|
74
|
+
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;
|
|
73
75
|
var netDuration = segmentDuration - trimLeft - trimRight;
|
|
74
76
|
var duration = durationInFrames + netDuration * _this.fps;
|
|
75
77
|
var transitionTheme = transitionThemes[theme];
|
|
78
|
+
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;
|
|
76
79
|
if (transitionTheme) {
|
|
77
80
|
var isLast = index === array.length - 1;
|
|
78
|
-
|
|
81
|
+
var shouldApplyTransition = !isLast && transitionAfter !== false;
|
|
82
|
+
return toFrames(duration) - (shouldApplyTransition ? transitionTheme.durationInFrames : 0);
|
|
79
83
|
}
|
|
80
84
|
return toFrames(duration);
|
|
81
85
|
}, 0);
|
|
@@ -129,9 +133,12 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
129
133
|
}, {
|
|
130
134
|
key: "toRemotionSegment",
|
|
131
135
|
value: function toRemotionSegment(screenPlaySegment) {
|
|
132
|
-
var _this2 = this
|
|
136
|
+
var _this2 = this,
|
|
137
|
+
_ref,
|
|
138
|
+
_screenPlaySegment$tr;
|
|
133
139
|
var layout = screenPlaySegment.layout,
|
|
134
|
-
|
|
140
|
+
_screenPlaySegment$ef = screenPlaySegment.effects,
|
|
141
|
+
effects = _screenPlaySegment$ef === void 0 ? [] : _screenPlaySegment$ef;
|
|
135
142
|
return {
|
|
136
143
|
layout: LayoutFactory.createObject(layout),
|
|
137
144
|
effects: effects.map(function (effect) {
|
|
@@ -139,7 +146,8 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
139
146
|
return _this2.toRemotionCaptionSegment(effect, layout);
|
|
140
147
|
}
|
|
141
148
|
return _this2.toRemotionFragment(effect, layout);
|
|
142
|
-
})
|
|
149
|
+
}),
|
|
150
|
+
transitionAfter: (_ref = (_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 && _ref !== void 0 ? _ref : true
|
|
143
151
|
};
|
|
144
152
|
}
|
|
145
153
|
}, {
|
|
@@ -150,9 +158,12 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
150
158
|
}, {
|
|
151
159
|
key: "toRemotionCaptionSegment",
|
|
152
160
|
value: function toRemotionCaptionSegment(screenPlaySegment, screenplayLayout) {
|
|
153
|
-
var
|
|
154
|
-
|
|
155
|
-
|
|
161
|
+
var _screenplayLayout$dat,
|
|
162
|
+
_screenPlaySegment$da11,
|
|
163
|
+
_this3 = this;
|
|
164
|
+
var trimLeft = (screenplayLayout === null || screenplayLayout === void 0 ? void 0 : (_screenplayLayout$dat = screenplayLayout.data) === null || _screenplayLayout$dat === void 0 ? void 0 : _screenplayLayout$dat.trimLeft) || 0;
|
|
165
|
+
var segmentOffset = Number(screenPlaySegment === null || screenPlaySegment === void 0 ? void 0 : (_screenPlaySegment$da11 = screenPlaySegment.data) === null || _screenPlaySegment$da11 === void 0 ? void 0 : _screenPlaySegment$da11.offset);
|
|
166
|
+
var from = Number.isFinite(segmentOffset) ? this.fps * (segmentOffset + trimLeft) : 0;
|
|
156
167
|
var transcripts = screenPlaySegment.data.transcript_text;
|
|
157
168
|
if (!transcripts) {
|
|
158
169
|
throw new Error("No transcript_text provided in transcript segment");
|
|
@@ -243,8 +254,8 @@ export var RemotionRenderer = /*#__PURE__*/function () {
|
|
|
243
254
|
throw new Error("Caption track not found");
|
|
244
255
|
}
|
|
245
256
|
var segments = screenPlayCaptionTrack.segments;
|
|
246
|
-
segments.forEach(function (segment,
|
|
247
|
-
_objectDestructuringEmpty(
|
|
257
|
+
segments.forEach(function (segment, _ref2) {
|
|
258
|
+
_objectDestructuringEmpty(_ref2);
|
|
248
259
|
_this6.captionsVideoTrack.push(_this6.toRemotionCaptionSegment(segment));
|
|
249
260
|
});
|
|
250
261
|
}
|
|
@@ -65,6 +65,7 @@ var renderer = new RemotionRenderer({
|
|
|
65
65
|
}]
|
|
66
66
|
}, {
|
|
67
67
|
offset: 1.6,
|
|
68
|
+
disabled: true,
|
|
68
69
|
duration: 1.2200000000000002,
|
|
69
70
|
text: "recording for",
|
|
70
71
|
punctuations: [{
|
|
@@ -79,6 +80,7 @@ var renderer = new RemotionRenderer({
|
|
|
79
80
|
}, {
|
|
80
81
|
offset: 2.8799997,
|
|
81
82
|
duration: 1.8600003000000003,
|
|
83
|
+
disabled: false,
|
|
82
84
|
text: "question, video.",
|
|
83
85
|
punctuations: [{
|
|
84
86
|
index: 0,
|