eyevinn-channel-engine 5.0.4 → 5.0.5

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.
@@ -118,10 +118,10 @@ declare class Session {
118
118
  _insertSlate(currentVod: any): Promise<any>;
119
119
  _tickAsync(): Promise<void>;
120
120
  _getNextVod(): Promise<any>;
121
- _loadSlate(afterVod: any, reps: any): Promise<any>;
121
+ _loadSlate(afterVod: any, reps: any, unixTs: any): Promise<any>;
122
122
  _truncateVod(vodResponse: any): Promise<any>;
123
- _truncateSlate(afterVod: any, requestedDuration: any, vodUri: any): Promise<any>;
124
- _fillGap(afterVod: any, desiredDuration: any): Promise<any>;
123
+ _truncateSlate(afterVod: any, requestedDuration: any, vodUri: any, unixTs: any): Promise<any>;
124
+ _fillGap(afterVod: any, desiredDuration: any, unixTs: any): Promise<any>;
125
125
  _getNextVodById(id: any): Promise<any>;
126
126
  _getFirstDuration(manifest: any): Promise<any>;
127
127
  _getCurrentDeltaTime(): Promise<any>;
@@ -1785,7 +1785,7 @@ var Session = /** @class */ (function () {
1785
1785
  case 15:
1786
1786
  if (vodResponse.type === 'gap') {
1787
1787
  loadPromise = new Promise(function (resolve, reject) {
1788
- _this._fillGap(null, vodResponse.desiredDuration)
1788
+ _this._fillGap(null, vodResponse.desiredDuration, vodResponse.unixTs)
1789
1789
  .then(function (gapVod) {
1790
1790
  currentVod = gapVod;
1791
1791
  resolve(gapVod);
@@ -2035,7 +2035,7 @@ var Session = /** @class */ (function () {
2035
2035
  return [3 /*break*/, 51];
2036
2036
  case 50:
2037
2037
  loadPromise = new Promise(function (resolve, reject) {
2038
- _this._fillGap(currentVod, vodResponse.desiredDuration)
2038
+ _this._fillGap(currentVod, vodResponse.desiredDuration, vodResponse.unixTs)
2039
2039
  .then(function (gapVod) {
2040
2040
  newVod = gapVod;
2041
2041
  resolve(newVod);
@@ -2382,7 +2382,7 @@ var Session = /** @class */ (function () {
2382
2382
  .catch(reject);
2383
2383
  });
2384
2384
  };
2385
- Session.prototype._loadSlate = function (afterVod, reps) {
2385
+ Session.prototype._loadSlate = function (afterVod, reps, unixTs) {
2386
2386
  var _this = this;
2387
2387
  return new Promise(function (resolve, reject) {
2388
2388
  try {
@@ -2401,7 +2401,7 @@ var Session = /** @class */ (function () {
2401
2401
  skipSerializeMediaSequences: _this.partialStoreHLSVod,
2402
2402
  calculatePDT: _this.rollingPDT
2403
2403
  };
2404
- var timestamp = Date.now();
2404
+ var timestamp = unixTs ? unixTs : Date.now();
2405
2405
  hlsVod_1 = new HLSVod(_this.slateUri, null, timestamp, null, m3u8Header(_this._instanceId), hlsOpts);
2406
2406
  hlsVod_1.addMetadata('id', "slate-".concat(timestamp));
2407
2407
  hlsVod_1.addMetadata('start-date', new Date(timestamp).toISOString());
@@ -2503,7 +2503,7 @@ var Session = /** @class */ (function () {
2503
2503
  }
2504
2504
  });
2505
2505
  };
2506
- Session.prototype._truncateSlate = function (afterVod, requestedDuration, vodUri) {
2506
+ Session.prototype._truncateSlate = function (afterVod, requestedDuration, vodUri, unixTs) {
2507
2507
  var _this = this;
2508
2508
  return new Promise(function (resolve, reject) {
2509
2509
  var nexVodUri = null;
@@ -2529,7 +2529,7 @@ var Session = /** @class */ (function () {
2529
2529
  skipSerializeMediaSequences: _this.partialStoreHLSVod,
2530
2530
  calculatePDT: _this.rollingPDT
2531
2531
  };
2532
- var timestamp = Date.now();
2532
+ var timestamp = unixTs ? unixTs : Date.now();
2533
2533
  hlsVod_2 = new HLSVod(nexVodUri, null, timestamp, null, m3u8Header(_this._instanceId), hlsOpts);
2534
2534
  hlsVod_2.addMetadata('id', "slate-".concat(timestamp));
2535
2535
  hlsVod_2.addMetadata('start-date', new Date(timestamp).toISOString());
@@ -2586,7 +2586,7 @@ var Session = /** @class */ (function () {
2586
2586
  }
2587
2587
  });
2588
2588
  };
2589
- Session.prototype._fillGap = function (afterVod, desiredDuration) {
2589
+ Session.prototype._fillGap = function (afterVod, desiredDuration, unixTs) {
2590
2590
  var _this = this;
2591
2591
  return new Promise(function (resolve, reject) {
2592
2592
  var loadSlatePromise;
@@ -2594,12 +2594,12 @@ var Session = /** @class */ (function () {
2594
2594
  if (desiredDuration > _this.slateDuration) {
2595
2595
  var reps = Math.floor(desiredDuration / _this.slateDuration);
2596
2596
  debug("[".concat(_this._sessionId, "]: Trying to fill a gap of ").concat(desiredDuration, " milliseconds (").concat(reps, " repetitions)"));
2597
- loadSlatePromise = _this._loadSlate(afterVod, reps);
2597
+ loadSlatePromise = _this._loadSlate(afterVod, reps, unixTs);
2598
2598
  durationMs = (reps || _this.slateRepetitions) * _this.slateDuration;
2599
2599
  }
2600
2600
  else {
2601
2601
  debug("[".concat(_this._sessionId, "]: Trying to fill a gap of ").concat(desiredDuration, " milliseconds by truncating filler slate (").concat(_this.slateDuration, ")"));
2602
- loadSlatePromise = _this._truncateSlate(afterVod, desiredDuration / 1000);
2602
+ loadSlatePromise = _this._truncateSlate(afterVod, desiredDuration / 1000, null, unixTs);
2603
2603
  durationMs = desiredDuration;
2604
2604
  }
2605
2605
  loadSlatePromise.then(function (hlsVod) {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyevinn-channel-engine",
3
- "version": "5.0.4",
3
+ "version": "5.0.5",
4
4
  "description": "OTT TV Channel Engine",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  "dependencies": {
32
32
  "@eyevinn/hls-repeat": "^0.2.1",
33
33
  "@eyevinn/hls-truncate": "^0.3.3",
34
- "@eyevinn/hls-vodtolive": "^4.1.8",
34
+ "@eyevinn/hls-vodtolive": "^4.1.9",
35
35
  "@eyevinn/m3u8": "^0.5.6",
36
36
  "@fastify/static": "^8.1.1",
37
37
  "abort-controller": "^3.0.0",
package/engine/session.js CHANGED
@@ -1300,7 +1300,7 @@ class Session {
1300
1300
  } else {
1301
1301
  if (vodResponse.type === 'gap') {
1302
1302
  loadPromise = new Promise((resolve, reject) => {
1303
- this._fillGap(null, vodResponse.desiredDuration)
1303
+ this._fillGap(null, vodResponse.desiredDuration, vodResponse.unixTs)
1304
1304
  .then(gapVod => {
1305
1305
  currentVod = gapVod;
1306
1306
  resolve(gapVod);
@@ -1502,7 +1502,7 @@ class Session {
1502
1502
  }
1503
1503
  } else {
1504
1504
  loadPromise = new Promise((resolve, reject) => {
1505
- this._fillGap(currentVod, vodResponse.desiredDuration)
1505
+ this._fillGap(currentVod, vodResponse.desiredDuration, vodResponse.unixTs)
1506
1506
  .then(gapVod => {
1507
1507
  newVod = gapVod;
1508
1508
  resolve(newVod);
@@ -1771,7 +1771,7 @@ class Session {
1771
1771
  });
1772
1772
  }
1773
1773
 
1774
- _loadSlate(afterVod, reps) {
1774
+ _loadSlate(afterVod, reps, unixTs) {
1775
1775
  return new Promise((resolve, reject) => {
1776
1776
  try {
1777
1777
  const slateVod = new HLSRepeatVod(this.slateUri, reps || this.slateRepetitions);
@@ -1789,7 +1789,7 @@ class Session {
1789
1789
  skipSerializeMediaSequences: this.partialStoreHLSVod,
1790
1790
  calculatePDT: this.rollingPDT
1791
1791
  };
1792
- const timestamp = Date.now();
1792
+ const timestamp = unixTs ? unixTs : Date.now();
1793
1793
  hlsVod = new HLSVod(this.slateUri, null, timestamp, null, m3u8Header(this._instanceId), hlsOpts);
1794
1794
  hlsVod.addMetadata('id', `slate-${timestamp}`);
1795
1795
  hlsVod.addMetadata('start-date', new Date(timestamp).toISOString());
@@ -1887,7 +1887,7 @@ class Session {
1887
1887
  });
1888
1888
  }
1889
1889
 
1890
- _truncateSlate(afterVod, requestedDuration, vodUri) {
1890
+ _truncateSlate(afterVod, requestedDuration, vodUri, unixTs) {
1891
1891
  return new Promise((resolve, reject) => {
1892
1892
  let nexVodUri = null;
1893
1893
  try {
@@ -1913,7 +1913,7 @@ class Session {
1913
1913
  skipSerializeMediaSequences: this.partialStoreHLSVod,
1914
1914
  calculatePDT: this.rollingPDT
1915
1915
  };
1916
- const timestamp = Date.now();
1916
+ const timestamp = unixTs ? unixTs : Date.now();
1917
1917
  hlsVod = new HLSVod(nexVodUri, null, timestamp, null, m3u8Header(this._instanceId), hlsOpts);
1918
1918
  hlsVod.addMetadata('id', `slate-${timestamp}`);
1919
1919
  hlsVod.addMetadata('start-date', new Date(timestamp).toISOString());
@@ -1967,18 +1967,18 @@ class Session {
1967
1967
  });
1968
1968
  }
1969
1969
 
1970
- _fillGap(afterVod, desiredDuration) {
1970
+ _fillGap(afterVod, desiredDuration, unixTs) {
1971
1971
  return new Promise((resolve, reject) => {
1972
1972
  let loadSlatePromise;
1973
1973
  let durationMs;
1974
1974
  if (desiredDuration > this.slateDuration) {
1975
1975
  const reps = Math.floor(desiredDuration / this.slateDuration);
1976
1976
  debug(`[${this._sessionId}]: Trying to fill a gap of ${desiredDuration} milliseconds (${reps} repetitions)`);
1977
- loadSlatePromise = this._loadSlate(afterVod, reps);
1977
+ loadSlatePromise = this._loadSlate(afterVod, reps, unixTs);
1978
1978
  durationMs = (reps || this.slateRepetitions) * this.slateDuration;
1979
1979
  } else {
1980
1980
  debug(`[${this._sessionId}]: Trying to fill a gap of ${desiredDuration} milliseconds by truncating filler slate (${this.slateDuration})`);
1981
- loadSlatePromise = this._truncateSlate(afterVod, desiredDuration / 1000);
1981
+ loadSlatePromise = this._truncateSlate(afterVod, desiredDuration / 1000, null, unixTs);
1982
1982
  durationMs = desiredDuration;
1983
1983
  }
1984
1984
  loadSlatePromise.then(hlsVod => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyevinn-channel-engine",
3
- "version": "5.0.4",
3
+ "version": "5.0.5",
4
4
  "description": "OTT TV Channel Engine",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  "dependencies": {
32
32
  "@eyevinn/hls-repeat": "^0.2.1",
33
33
  "@eyevinn/hls-truncate": "^0.3.3",
34
- "@eyevinn/hls-vodtolive": "^4.1.8",
34
+ "@eyevinn/hls-vodtolive": "^4.1.9",
35
35
  "@eyevinn/m3u8": "^0.5.6",
36
36
  "@fastify/static": "^8.1.1",
37
37
  "abort-controller": "^3.0.0",