@zync/zync-screnplay-player 0.1.197 → 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.
@@ -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 segmentDuration = segment.layout.data.duration || 0;
71
- var trimLeft = segment.layout.data.trimLeft || 0;
72
- var trimRight = segment.layout.data.trimRight || 0;
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
- return toFrames(duration) - (isLast ? 0 : transitionTheme.durationInFrames);
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
- effects = screenPlaySegment.effects;
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 _this3 = this;
154
- var trimLeft = screenplayLayout.data.trimLeft || 0;
155
- var from = this.fps * (screenPlaySegment.data.offset + trimLeft) || 0;
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, _ref) {
247
- _objectDestructuringEmpty(_ref);
257
+ segments.forEach(function (segment, _ref2) {
258
+ _objectDestructuringEmpty(_ref2);
248
259
  _this6.captionsVideoTrack.push(_this6.toRemotionCaptionSegment(segment));
249
260
  });
250
261
  }
@@ -241,10 +241,6 @@ export var CreatorCollabSplit = function CreatorCollabSplit(_ref) {
241
241
  easing: Easing.out(Easing.cubic),
242
242
  extrapolateRight: "clamp"
243
243
  });
244
- var columnOutTranslate = interpolate(frame, [0, 18], [40, 0], {
245
- easing: Easing.out(Easing.cubic),
246
- extrapolateRight: "clamp"
247
- });
248
244
  var columnOpacity = interpolate(frame, [0, 18], [0, 1], {
249
245
  easing: Easing.out(Easing.ease),
250
246
  extrapolateRight: "clamp"
@@ -305,7 +301,6 @@ export var CreatorCollabSplit = function CreatorCollabSplit(_ref) {
305
301
  var activeFilter = "saturate(1.05)";
306
302
  var creatorFrameWidth = videoWidth;
307
303
  var creatorFrameHeight = videoHeight;
308
- var creatorColumnTransform = isLandscape ? "translateX(".concat(columnOutTranslate, "px)") : "translateY(".concat(columnOutTranslate, "px)");
309
304
  var nowName = safeFullName || "Host";
310
305
  var nextName = safeCollaboratorName || "Guest";
311
306
  var squareBarHeight = Math.min(height * 0.36, 320);
@@ -665,8 +660,7 @@ export var CreatorCollabSplit = function CreatorCollabSplit(_ref) {
665
660
  display: "flex",
666
661
  alignItems: "center",
667
662
  justifyContent: "center",
668
- transform: creatorColumnTransform,
669
- opacity: columnOpacity * (creatorActive ? 1 : inactiveOpacity)
663
+ opacity: creatorActive ? 1 : inactiveOpacity
670
664
  }
671
665
  }, /*#__PURE__*/React.createElement("div", {
672
666
  style: {
@@ -693,7 +687,7 @@ export var CreatorCollabSplit = function CreatorCollabSplit(_ref) {
693
687
  borderRadius: isSquare ? surfaceRadius : 0,
694
688
  overflow: "hidden",
695
689
  border: creatorActive ? "2px solid ".concat(ringColor) : "1px solid ".concat(cardBorder),
696
- opacity: columnOpacity * (creatorActive ? 1 : inactiveOpacity),
690
+ opacity: creatorActive ? 1 : inactiveOpacity,
697
691
  zIndex: 1
698
692
  }
699
693
  }, /*#__PURE__*/React.createElement("div", {
@@ -36,7 +36,7 @@ var renderer = new RemotionRenderer({
36
36
  frameColor: "#29402F",
37
37
  disableTransitionSounds: false,
38
38
  paddingLeft: 1.92,
39
- paddingRight: 0.8499998
39
+ paddingRight: 0.4249999
40
40
  }
41
41
  },
42
42
  effects: [{
@@ -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,
@@ -96,20 +98,22 @@ var renderer = new RemotionRenderer({
96
98
  layout: {
97
99
  type: "creator_collab_split",
98
100
  data: {
99
- text: "This is a session title",
100
- fullName: "this is speaker full name - you can use nametag effect as example of data point",
101
- title: "this is speaker title - you can use nametag effect as example of data point",
102
- collaboratorName: "this is collaborator full name - get it from seeker details",
103
- collaboratorTitle: "this is collaborator title - get it from seeker details",
101
+ text: "rafal test: Mixpanel Tests",
102
+ fullName: "rafal test",
103
+ title: "Super Dev",
104
+ collaboratorName: "rafal test",
105
+ collaboratorTitle: null,
104
106
  firstVideoFile: "https://stream.mux.com/QVXpL01pAdZ00htZ4yiy002wy02025oqCGED7TBchWFuI01SA/highest.mp4",
105
107
  secondVideoFile: "https://stream.mux.com/ZkbRuHLYAX7ChWJqqdP9Mri343DB02QlA9YLlgw1JWs8/highest.mp4",
106
- duration: 4.6493332,
107
- // the same as first video duration
108
+ duration: 3.47,
108
109
  sourceVideo: {
109
110
  videoUrl: "https://stream.mux.com/QVXpL01pAdZ00htZ4yiy002wy02025oqCGED7TBchWFuI01SA/highest.mp4",
110
111
  start: 7.7599998,
111
- aspectRatio: "16:9"
112
- }
112
+ aspectRatio: "16:9",
113
+ durationSeconds: 12.409333
114
+ },
115
+ paddingLeft: 0.4249999,
116
+ paddingRight: 1.1793331999999999
113
117
  }
114
118
  },
115
119
  effects: [{
@@ -131,8 +135,7 @@ var renderer = new RemotionRenderer({
131
135
  index: 2,
132
136
  start: 0.9600002000000005,
133
137
  end: 1.4400001999999992
134
- }],
135
- speaker: "seeker"
138
+ }]
136
139
  }, {
137
140
  offset: 1.4400001999999992,
138
141
  duration: 1.2800000000000011,
@@ -149,8 +152,7 @@ var renderer = new RemotionRenderer({
149
152
  index: 2,
150
153
  start: 2.3200002,
151
154
  end: 2.7200002000000003
152
- }],
153
- speaker: "seeker"
155
+ }]
154
156
  }, {
155
157
  offset: 2.7200002000000003,
156
158
  duration: 0.5,
@@ -159,77 +161,84 @@ var renderer = new RemotionRenderer({
159
161
  index: 0,
160
162
  start: 2.7200002000000003,
161
163
  end: 3.2200002000000003
162
- }],
163
- speaker: "seeker"
164
- }, {
165
- offset: 3.4700000000000006,
164
+ }]
165
+ }]
166
+ }
167
+ }]
168
+ }, {
169
+ recordingIndex: 0,
170
+ layout: {
171
+ type: "simple_frame",
172
+ data: {
173
+ noBackgroundVideoEffects: {
174
+ facePop: true,
175
+ backgroundDim: true,
176
+ backgroundBlur: false
177
+ },
178
+ sourceVideo: {
179
+ videoUrl: "https://stream.mux.com/ZkbRuHLYAX7ChWJqqdP9Mri343DB02QlA9YLlgw1JWs8/highest.mp4",
180
+ start: 1.36,
181
+ aspectRatio: "16:9",
182
+ durationSeconds: 13.509333
183
+ },
184
+ duration: 4.1899999999999995,
185
+ logoUrl: "https://cdn.zync.ai/assets/static/default_blank_logo.png",
186
+ frameColor: "#29402F",
187
+ disableTransitionSounds: false,
188
+ paddingLeft: 1.36,
189
+ paddingRight: 1.025
190
+ }
191
+ },
192
+ effects: [{
193
+ type: "caption_word_boom",
194
+ data: {
195
+ transcript_text: [{
196
+ offset: 0,
166
197
  duration: 1.7799998999999997,
167
198
  text: "This is a response",
168
199
  punctuations: [{
169
200
  index: 0,
170
- start: 3.4700000000000006,
171
- end: 3.79,
172
- originalStart: 0,
173
- originalEnd: 0.31999999999999984
201
+ start: 0,
202
+ end: 0.31999999999999984
174
203
  }, {
175
204
  index: 1,
176
- start: 3.79,
177
- end: 4.2899998,
178
- originalStart: 0.31999999999999984,
179
- originalEnd: 0.8199998
205
+ start: 0.31999999999999984,
206
+ end: 0.8199998
180
207
  }, {
181
208
  index: 2,
182
- start: 4.590000000000001,
183
- end: 4.749999900000001,
184
- originalStart: 1.1199999999999999,
185
- originalEnd: 1.2799998999999997
209
+ start: 1.1199999999999999,
210
+ end: 1.2799998999999997
186
211
  }, {
187
212
  index: 3,
188
- start: 4.749999900000001,
189
- end: 5.249999900000001,
190
- originalStart: 1.2799998999999997,
191
- originalEnd: 1.7799998999999997
192
- }],
193
- originalOffset: 0,
194
- speaker: "responder"
213
+ start: 1.2799998999999997,
214
+ end: 1.7799998999999997
215
+ }]
195
216
  }, {
196
- offset: 5.390000000000001,
217
+ offset: 1.9199999999999997,
197
218
  duration: 1.2200000000000002,
198
219
  text: "to the test",
199
220
  punctuations: [{
200
221
  index: 0,
201
- start: 5.390000000000001,
202
- end: 5.5499998,
203
- originalStart: 1.9199999999999997,
204
- originalEnd: 2.0799997999999995
222
+ start: 1.9199999999999997,
223
+ end: 2.0799997999999995
205
224
  }, {
206
225
  index: 1,
207
- start: 5.5499998,
208
- end: 6.0499998,
209
- originalStart: 2.0799997999999995,
210
- originalEnd: 2.5799997999999995
226
+ start: 2.0799997999999995,
227
+ end: 2.5799997999999995
211
228
  }, {
212
229
  index: 2,
213
- start: 6.109999999999999,
214
- end: 6.609999999999999,
215
- originalStart: 2.6399999999999997,
216
- originalEnd: 3.1399999999999997
217
- }],
218
- originalOffset: 1.9199999999999997,
219
- speaker: "responder"
230
+ start: 2.6399999999999997,
231
+ end: 3.1399999999999997
232
+ }]
220
233
  }, {
221
- offset: 6.909999699999998,
234
+ offset: 3.4399996999999995,
222
235
  duration: 0.5,
223
236
  text: "question.",
224
237
  punctuations: [{
225
238
  index: 0,
226
- start: 6.909999699999998,
227
- end: 7.409999699999998,
228
- originalStart: 3.4399996999999995,
229
- originalEnd: 3.9399996999999995
230
- }],
231
- originalOffset: 3.4399996999999995,
232
- speaker: "responder"
239
+ start: 3.4399996999999995,
240
+ end: 3.9399996999999995
241
+ }]
233
242
  }]
234
243
  }
235
244
  }]
@@ -253,7 +262,7 @@ var renderer = new RemotionRenderer({
253
262
  logoUrl: "https://cdn.zync.ai/assets/static/default_blank_logo.png",
254
263
  frameColor: "#29402F",
255
264
  disableTransitionSounds: false,
256
- paddingLeft: 2.05,
265
+ paddingLeft: 1.025,
257
266
  paddingRight: 0.8393329999999999
258
267
  }
259
268
  },
@@ -315,6 +324,14 @@ var renderer = new RemotionRenderer({
315
324
  }, {
316
325
  type: "effect",
317
326
  segments: [{
327
+ type: "title",
328
+ theme: null,
329
+ data: {
330
+ text: "rafal test: Mixpanel Tests",
331
+ offset: 1,
332
+ duration: 5
333
+ }
334
+ }, {
318
335
  type: "watermark",
319
336
  data: {
320
337
  duration: 10,
@@ -331,10 +348,10 @@ var renderer = new RemotionRenderer({
331
348
  type: "soundtrack",
332
349
  data: {
333
350
  musicConfig: "default",
334
- randomMusicUrl: "https://storage.googleapis.com/zync-media/media/music/13.mp3",
335
- customMusicUrl: "https://storage.googleapis.com/zync-media/media/music/13.mp3",
351
+ randomMusicUrl: "https://storage.googleapis.com/zync-media/media/music/4.mp3",
352
+ customMusicUrl: "https://storage.googleapis.com/zync-media/media/music/4.mp3",
336
353
  sourceAudio: {
337
- url: "https://storage.googleapis.com/zync-media/media/music/13.mp3",
354
+ url: "https://storage.googleapis.com/zync-media/media/music/4.mp3",
338
355
  volume: 0.05,
339
356
  start: 0,
340
357
  loop: true
@@ -344,15 +361,15 @@ var renderer = new RemotionRenderer({
344
361
  }]
345
362
  }],
346
363
  output: {
347
- orientation: "portrait",
364
+ orientation: "landscape",
348
365
  fps: 60,
349
- callbackUrl: "https://contentkit-test.zync.ai/api/processor/callback",
366
+ callbackUrl: "http://localhost:1230/api/processor/callback",
350
367
  callbackMetadata: {
351
368
  taskDetails: {
352
369
  processorId: "VIDEO_SCREENPLAY",
370
+ groupId: "5lURyf",
353
371
  workspaceId: "q9ZThUTP",
354
- meetingSeriesId: "VEn6dHb1",
355
- groupId: "5lURyf"
372
+ meetingSeriesId: "VEn6dHb1"
356
373
  }
357
374
  }
358
375
  }