eyevinn-channel-engine 4.0.2 → 4.0.4

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.
@@ -21,6 +21,7 @@ export interface ChannelEngineOpts {
21
21
  forceTargetDuration?: boolean;
22
22
  adCopyMgrUri?: string;
23
23
  adXchangeUri?: string;
24
+ noSessionDataTags?: boolean;
24
25
  }
25
26
  export interface VodRequest {
26
27
  sessionId: string;
@@ -406,6 +406,7 @@ var ChannelEngine = /** @class */ (function () {
406
406
  averageSegmentDuration: channel.options && channel.options.averageSegmentDuration ? channel.options.averageSegmentDuration : this.streamerOpts.defaultAverageSegmentDuration,
407
407
  useDemuxedAudio: options.useDemuxedAudio,
408
408
  alwaysNewSegments: options.alwaysNewSegments,
409
+ noSessionDataTags: options.noSessionDataTags,
409
410
  playheadDiffThreshold: channel.options && channel.options.playheadDiffThreshold ? channel.options.playheadDiffThreshold : this.streamerOpts.defaultPlayheadDiffThreshold,
410
411
  maxTickInterval: channel.options && channel.options.maxTickInterval ? channel.options.maxTickInterval : this.streamerOpts.defaultMaxTickInterval,
411
412
  targetDurationPadding: channel.options && channel.options.targetDurationPadding ? channel.options.targetDurationPadding : this.streamerOpts.targetDurationPadding,
@@ -49,6 +49,7 @@ declare class Session {
49
49
  _sessionProfile: any;
50
50
  _audioTracks: any;
51
51
  _closedCaptions: any;
52
+ _noSessionDataTags: any;
52
53
  slateUri: any;
53
54
  slateRepetitions: any;
54
55
  slateDuration: any;
@@ -124,6 +124,9 @@ var Session = /** @class */ (function () {
124
124
  if (config.closedCaptions) {
125
125
  this._closedCaptions = config.closedCaptions;
126
126
  }
127
+ if (config.noSessionDataTags) {
128
+ this._noSessionDataTags = config.noSessionDataTags;
129
+ }
127
130
  if (config.slateUri) {
128
131
  this.slateUri = config.slateUri;
129
132
  this.slateRepetitions = config.slateRepetitions || 10;
@@ -920,7 +923,7 @@ var Session = /** @class */ (function () {
920
923
  case 2:
921
924
  playheadState = _a.sent();
922
925
  if (!(playheadState.vodMediaSeqAudio > sessionState.vodMediaSeqAudio ||
923
- (playheadState.vodMediaSeqAudio < sessionState.vodMediaSeqAudio && playheadState.mediaSeqAudio === this.prevMediaSeqOffset.audio))) return [3 /*break*/, 8];
926
+ (playheadState.vodMediaSeqAudio < sessionState.vodMediaSeqAudio && playheadState.mediaSeqAudio === this.prevMediaSeqOffset.audio))) return [3 /*break*/, 9];
924
927
  return [4 /*yield*/, this._sessionState.get("state")];
925
928
  case 3:
926
929
  state = _a.sent();
@@ -932,14 +935,17 @@ var Session = /** @class */ (function () {
932
935
  return [4 /*yield*/, this._playheadState.getValues(["mediaSeqAudio", "vodMediaSeqAudio"])];
933
936
  case 5:
934
937
  playheadState = _a.sent();
935
- return [3 /*break*/, 8];
938
+ return [3 /*break*/, 9];
936
939
  case 6:
937
940
  debug("[".concat(this._sessionId, "]: Recently Loaded Next Vod. PlayheadState not up-to-date. Delay audio-m3u8 Response by 1000ms"));
938
941
  return [4 /*yield*/, timer(1000)];
939
942
  case 7:
940
943
  _a.sent();
941
- _a.label = 8;
944
+ return [4 /*yield*/, this._playheadState.getValues(["mediaSeqAudio", "vodMediaSeqAudio"])];
942
945
  case 8:
946
+ playheadState = _a.sent();
947
+ _a.label = 9;
948
+ case 9:
943
949
  // local store the prev values
944
950
  if (this.prevVodMediaSeq.audio === null) {
945
951
  this.prevVodMediaSeq.audio = playheadState.vodMediaSeqAudio;
@@ -948,29 +954,29 @@ var Session = /** @class */ (function () {
948
954
  this.prevMediaSeqOffset.audio = playheadState.mediaSeqAudio;
949
955
  }
950
956
  return [4 /*yield*/, this._sessionState.getCurrentVod()];
951
- case 9:
957
+ case 10:
952
958
  currentVod = _a.sent();
953
- if (!currentVod) return [3 /*break*/, 17];
954
- if (!(playheadState.vodMediaSeqAudio < 2 || playheadState.mediaSeqAudio !== this.prevMediaSeqOffset.audio)) return [3 /*break*/, 13];
959
+ if (!currentVod) return [3 /*break*/, 18];
960
+ if (!(playheadState.vodMediaSeqAudio < 2 || playheadState.mediaSeqAudio !== this.prevMediaSeqOffset.audio)) return [3 /*break*/, 14];
955
961
  AGE_THRESH = 20 * 1000;
956
962
  cacheAge = null;
957
963
  if (this._sessionState.cache && this._sessionState.cache.currentVod.ts) {
958
964
  cacheAge = Date.now() - this._sessionState.cache.currentVod.ts;
959
965
  }
960
- if (!(cacheAge !== null && cacheAge > AGE_THRESH)) return [3 /*break*/, 13];
966
+ if (!(cacheAge !== null && cacheAge > AGE_THRESH)) return [3 /*break*/, 14];
961
967
  return [4 /*yield*/, timer(500)];
962
- case 10:
968
+ case 11:
963
969
  _a.sent();
964
970
  debug("[".concat(this._sessionId, "]: While requesting audio manifest for ").concat(audioGroupId, "-").concat(audioLanguage, ", (mseq=").concat(playheadState.vodMediaSeqAudio, ")(vod cache age=").concat(cacheAge, ")"));
965
971
  return [4 /*yield*/, this._sessionState.clearCurrentVodCache()];
966
- case 11:
972
+ case 12:
967
973
  _a.sent(); // force reading up from shared store
968
974
  return [4 /*yield*/, this._sessionState.getCurrentVod()];
969
- case 12:
970
- currentVod = _a.sent();
971
- _a.label = 13;
972
975
  case 13:
973
- _a.trys.push([13, 14, , 16]);
976
+ currentVod = _a.sent();
977
+ _a.label = 14;
978
+ case 14:
979
+ _a.trys.push([14, 15, , 17]);
974
980
  manifestMseq = playheadState.mediaSeqAudio + playheadState.vodMediaSeqAudio;
975
981
  manifestDseq = sessionState.discSeqAudio + currentVod.discontinuitiesAudio[playheadState.vodMediaSeqAudio];
976
982
  if (currentVod.sequenceAlwaysContainNewSegments) {
@@ -988,16 +994,16 @@ var Session = /** @class */ (function () {
988
994
  this.prevVodMediaSeq.audio = playheadState.vodMediaSeqAudio;
989
995
  this.prevMediaSeqOffset.audio = playheadState.mediaSeqAudio;
990
996
  return [2 /*return*/, m3u8_2];
991
- case 14:
997
+ case 15:
992
998
  err_5 = _a.sent();
993
999
  logerror(this._sessionId, err_5);
994
1000
  return [4 /*yield*/, this._sessionState.clearCurrentVodCache()];
995
- case 15:
1001
+ case 16:
996
1002
  _a.sent(); // force reading up from shared store
997
1003
  throw new Error("Failed to generate audio manifest: " + JSON.stringify(playheadState));
998
- case 16: return [3 /*break*/, 18];
999
- case 17: throw new Error("Engine not ready");
1000
- case 18: return [2 /*return*/];
1004
+ case 17: return [3 /*break*/, 19];
1005
+ case 18: throw new Error("Engine not ready");
1006
+ case 19: return [2 /*return*/];
1001
1007
  }
1002
1008
  });
1003
1009
  });
@@ -1364,8 +1370,10 @@ var Session = /** @class */ (function () {
1364
1370
  m3u8 = "#EXTM3U\n";
1365
1371
  m3u8 += "#EXT-X-VERSION:4\n";
1366
1372
  m3u8 += m3u8Header(this._instanceId);
1367
- m3u8 += "#EXT-X-SESSION-DATA:DATA-ID=\"eyevinn.tv.session.id\",VALUE=\"".concat(this._sessionId, "\"\n");
1368
- m3u8 += "#EXT-X-SESSION-DATA:DATA-ID=\"eyevinn.tv.eventstream\",VALUE=\"/eventstream/".concat(this._sessionId, "\"\n");
1373
+ if (!this._noSessionDataTags) {
1374
+ m3u8 += "#EXT-X-SESSION-DATA:DATA-ID=\"eyevinn.tv.session.id\",VALUE=\"".concat(this._sessionId, "\"\n");
1375
+ m3u8 += "#EXT-X-SESSION-DATA:DATA-ID=\"eyevinn.tv.eventstream\",VALUE=\"/eventstream/".concat(this._sessionId, "\"\n");
1376
+ }
1369
1377
  return [4 /*yield*/, this._sessionState.getCurrentVod()];
1370
1378
  case 1:
1371
1379
  currentVod = _a.sent();
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyevinn-channel-engine",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
4
4
  "description": "OTT TV Channel Engine",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/engine/server.ts CHANGED
@@ -46,6 +46,7 @@ export interface ChannelEngineOpts {
46
46
  forceTargetDuration?: boolean;
47
47
  adCopyMgrUri?: string; // deprecated
48
48
  adXchangeUri?: string; // deprecated
49
+ noSessionDataTags?: boolean;
49
50
  }
50
51
 
51
52
  interface StreamerOpts {
@@ -396,6 +397,7 @@ export class ChannelEngine {
396
397
  averageSegmentDuration: channel.options && channel.options.averageSegmentDuration ? channel.options.averageSegmentDuration : this.streamerOpts.defaultAverageSegmentDuration,
397
398
  useDemuxedAudio: options.useDemuxedAudio,
398
399
  alwaysNewSegments: options.alwaysNewSegments,
400
+ noSessionDataTags: options.noSessionDataTags,
399
401
  playheadDiffThreshold: channel.options && channel.options.playheadDiffThreshold ? channel.options.playheadDiffThreshold : this.streamerOpts.defaultPlayheadDiffThreshold,
400
402
  maxTickInterval: channel.options && channel.options.maxTickInterval ? channel.options.maxTickInterval : this.streamerOpts.defaultMaxTickInterval,
401
403
  targetDurationPadding: channel.options && channel.options.targetDurationPadding ? channel.options.targetDurationPadding : this.streamerOpts.targetDurationPadding,
package/engine/session.js CHANGED
@@ -97,6 +97,9 @@ class Session {
97
97
  if (config.closedCaptions) {
98
98
  this._closedCaptions = config.closedCaptions;
99
99
  }
100
+ if (config.noSessionDataTags) {
101
+ this._noSessionDataTags = config.noSessionDataTags;
102
+ }
100
103
  if (config.slateUri) {
101
104
  this.slateUri = config.slateUri;
102
105
  this.slateRepetitions = config.slateRepetitions || 10;
@@ -650,7 +653,7 @@ class Session {
650
653
  }
651
654
  let currentVod = null;
652
655
  const sessionState = await this._sessionState.getValues(["discSeqAudio", "vodMediaSeqAudio"]);
653
- const playheadState = await this._playheadState.getValues(["mediaSeqAudio", "vodMediaSeqAudio"]);
656
+ let playheadState = await this._playheadState.getValues(["mediaSeqAudio", "vodMediaSeqAudio"]);
654
657
 
655
658
  if (
656
659
  playheadState.vodMediaSeqAudio > sessionState.vodMediaSeqAudio ||
@@ -666,6 +669,7 @@ class Session {
666
669
  } else {
667
670
  debug(`[${this._sessionId}]: Recently Loaded Next Vod. PlayheadState not up-to-date. Delay audio-m3u8 Response by 1000ms`);
668
671
  await timer(1000);
672
+ playheadState = await this._playheadState.getValues(["mediaSeqAudio", "vodMediaSeqAudio"]);
669
673
  }
670
674
  }
671
675
 
@@ -951,8 +955,10 @@ class Session {
951
955
  let m3u8 = "#EXTM3U\n";
952
956
  m3u8 += "#EXT-X-VERSION:4\n";
953
957
  m3u8 += m3u8Header(this._instanceId);
954
- m3u8 += `#EXT-X-SESSION-DATA:DATA-ID="eyevinn.tv.session.id",VALUE="${this._sessionId}"\n`;
955
- m3u8 += `#EXT-X-SESSION-DATA:DATA-ID="eyevinn.tv.eventstream",VALUE="/eventstream/${this._sessionId}"\n`;
958
+ if (!this._noSessionDataTags) {
959
+ m3u8 += `#EXT-X-SESSION-DATA:DATA-ID="eyevinn.tv.session.id",VALUE="${this._sessionId}"\n`;
960
+ m3u8 += `#EXT-X-SESSION-DATA:DATA-ID="eyevinn.tv.eventstream",VALUE="/eventstream/${this._sessionId}"\n`;
961
+ }
956
962
  const currentVod = await this._sessionState.getCurrentVod();
957
963
  if (!currentVod) {
958
964
  throw new Error('Session not ready');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyevinn-channel-engine",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
4
4
  "description": "OTT TV Channel Engine",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",