@zync/zync-screnplay-player 0.1.224 → 0.1.226

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.
@@ -8,6 +8,8 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
8
8
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
9
9
  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); }
10
10
  var EPSILON = 1e-6;
11
+ var DEFAULT_FPS = 30;
12
+ var MIN_CHUNK_DURATION_SECONDS = 1 / DEFAULT_FPS;
11
13
  var cloneValue = function cloneValue(value) {
12
14
  if (value === undefined) {
13
15
  return undefined;
@@ -37,6 +39,9 @@ var buildInterval = function buildInterval(start, end) {
37
39
  end: end
38
40
  };
39
41
  };
42
+ var isMeaningfulDuration = function isMeaningfulDuration(duration) {
43
+ return Number.isFinite(duration) && duration > Math.max(EPSILON, MIN_CHUNK_DURATION_SECONDS - EPSILON);
44
+ };
40
45
  var mergeIntervals = function mergeIntervals() {
41
46
  var intervals = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
42
47
  if (!Array.isArray(intervals) || intervals.length === 0) {
@@ -455,10 +460,13 @@ var normalizeSegmentTrack = function normalizeSegmentTrack(segmentTrack, globalC
455
460
  return;
456
461
  }
457
462
  keptRanges.forEach(function (keptRange, chunkIndex) {
463
+ var chunkDuration = keptRange.end - keptRange.start;
464
+ if (!isMeaningfulDuration(chunkDuration)) {
465
+ return;
466
+ }
458
467
  var clonedChunk = cloneValue(segment);
459
468
  clonedChunk.layout.data.trimLeft = keptRange.start;
460
469
  clonedChunk.layout.data.trimRight = Math.max(0, duration - keptRange.end);
461
- clonedChunk.layout.data.__baseTrimLeft = timing.playableStart;
462
470
  clonedChunk.__transitionAfter = chunkIndex === keptRanges.length - 1;
463
471
  clonedChunk.__originSegmentIndex = segmentIndex;
464
472
  if (Array.isArray(clonedChunk.effects)) {
@@ -559,7 +567,7 @@ var normalizeTimedTrack = function normalizeTimedTrack(track, globalCuts, trackT
559
567
  }, globalCuts);
560
568
  keptRanges.forEach(function (keptRange) {
561
569
  var chunkDuration = keptRange.end - keptRange.start;
562
- if (chunkDuration <= EPSILON) {
570
+ if (!isMeaningfulDuration(chunkDuration)) {
563
571
  return;
564
572
  }
565
573
  var clonedChunk = cloneValue(segment);
@@ -32,7 +32,7 @@ export var Layout = /*#__PURE__*/function (_Sequence) {
32
32
  return _createClass(Layout, [{
33
33
  key: "getLayoutProps",
34
34
  value: function getLayoutProps(props) {
35
- var _props$data, _props$data2, _props$data$sourceVid, _props$data3, _props$data4, _props$data$__baseTri, _props$data5, _props$data$noBackgro, _props$data$noBackgro2;
35
+ var _props$data, _props$data2, _props$data$sourceVid, _props$data3, _props$data4, _props$data$noBackgro, _props$data$noBackgro2;
36
36
  var sourceVideoOrientation = getVideoOrientation(props.data.sourceVideo.aspectRatio);
37
37
  var trimLeft = ((_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.trimLeft) || 0;
38
38
  var trimRight = ((_props$data2 = props.data) === null || _props$data2 === void 0 ? void 0 : _props$data2.trimRight) || 0;
@@ -62,7 +62,6 @@ export var Layout = /*#__PURE__*/function (_Sequence) {
62
62
  disableTransitionSounds: (_props$data3 = props.data) === null || _props$data3 === void 0 ? void 0 : _props$data3.disableTransitionSounds,
63
63
  useSquareInLandscape: ((_props$data4 = props.data) === null || _props$data4 === void 0 ? void 0 : _props$data4.useSquareInLandscape) || false,
64
64
  trimLeft: trimLeft,
65
- baseTrimLeft: (_props$data$__baseTri = (_props$data5 = props.data) === null || _props$data5 === void 0 ? void 0 : _props$data5.__baseTrimLeft) !== null && _props$data$__baseTri !== void 0 ? _props$data$__baseTri : trimLeft,
66
65
  trimRight: trimRight,
67
66
  words: props.data.words,
68
67
  noBackgroundVideoUrl: (_props$data$noBackgro = props.data.noBackgroundVideo) === null || _props$data$noBackgro === void 0 ? void 0 : _props$data$noBackgro.videoUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zync/zync-screnplay-player",
3
- "version": "0.1.224",
3
+ "version": "0.1.226",
4
4
  "files": [
5
5
  "dist"
6
6
  ],