eyevinn-channel-engine 4.0.3 → 4.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.
@@ -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;
@@ -1080,66 +1083,69 @@ var Session = /** @class */ (function () {
1080
1083
  _d.vodMediaSeqAudio = _o.sent();
1081
1084
  _o.label = 17;
1082
1085
  case 17:
1083
- if (!(sessionState.vodMediaSeqVideo >= currentVod.getLiveMediaSequencesCount() - 1)) return [3 /*break*/, 21];
1086
+ if (!(sessionState.vodMediaSeqVideo >= currentVod.getLiveMediaSequencesCount() - 1)) return [3 /*break*/, 20];
1084
1087
  _e = sessionState;
1085
1088
  return [4 /*yield*/, this._sessionState.set("vodMediaSeqVideo", currentVod.getLiveMediaSequencesCount() - 1)];
1086
1089
  case 18:
1087
1090
  _e.vodMediaSeqVideo = _o.sent();
1088
1091
  _f = sessionState;
1089
- return [4 /*yield*/, this._sessionState.set("vodMediaSeqAudio", currentVod.getLiveMediaSequencesCount("audio") - 1)];
1090
- case 19:
1091
- _f.vodMediaSeqAudio = _o.sent();
1092
- _g = sessionState;
1093
1092
  return [4 /*yield*/, this._sessionState.set("state", SessionState.VOD_NEXT_INIT)];
1093
+ case 19:
1094
+ _f.state = _o.sent();
1095
+ _o.label = 20;
1094
1096
  case 20:
1095
- _g.state = _o.sent();
1096
- _o.label = 21;
1097
+ if (!(sessionState.vodMediaSeqAudio >= currentVod.getLiveMediaSequencesCount("audio") - 1)) return [3 /*break*/, 22];
1098
+ _g = sessionState;
1099
+ return [4 /*yield*/, this._sessionState.set("vodMediaSeqAudio", currentVod.getLiveMediaSequencesCount("audio") - 1)];
1097
1100
  case 21:
1098
- if (!this.isSwitchingBackToV2L) return [3 /*break*/, 23];
1101
+ _g.vodMediaSeqAudio = _o.sent();
1102
+ _o.label = 22;
1103
+ case 22:
1104
+ if (!this.isSwitchingBackToV2L) return [3 /*break*/, 24];
1099
1105
  _h = sessionState;
1100
1106
  return [4 /*yield*/, this._sessionState.set("state", SessionState.VOD_RELOAD_INIT)];
1101
- case 22:
1107
+ case 23:
1102
1108
  _h.state = _o.sent();
1103
1109
  this.isSwitchingBackToV2L = false;
1104
- _o.label = 23;
1105
- case 23:
1110
+ _o.label = 24;
1111
+ case 24:
1106
1112
  _j = playheadState;
1107
1113
  return [4 /*yield*/, this._playheadState.set("mediaSeq", sessionState.mediaSeq)];
1108
- case 24:
1114
+ case 25:
1109
1115
  _j.mediaSeq = _o.sent();
1110
1116
  _k = playheadState;
1111
1117
  return [4 /*yield*/, this._playheadState.set("mediaSeqAudio", sessionState.mediaSeqAudio)];
1112
- case 25:
1118
+ case 26:
1113
1119
  _k.mediaSeqAudio = _o.sent();
1114
1120
  _l = playheadState;
1115
1121
  return [4 /*yield*/, this._playheadState.set("vodMediaSeqVideo", sessionState.vodMediaSeqVideo)];
1116
- case 26:
1122
+ case 27:
1117
1123
  _l.vodMediaSeqVideo = _o.sent();
1118
1124
  _m = playheadState;
1119
1125
  return [4 /*yield*/, this._playheadState.set("vodMediaSeqAudio", sessionState.vodMediaSeqAudio)];
1120
- case 27:
1126
+ case 28:
1121
1127
  _m.vodMediaSeqAudio = _o.sent();
1122
1128
  if (currentVod.sequenceAlwaysContainNewSegments) {
1123
1129
  mediaSequenceValue = currentVod.mediaSequenceValues[playheadState.vodMediaSeqVideo];
1124
1130
  debug("[".concat(this._sessionId, "]: Session can now serve mseq={").concat(playheadState.mediaSeq + mediaSequenceValue, "}"));
1125
1131
  }
1126
1132
  debug("[".concat(this._sessionId, "]: INCREMENT (mseq=").concat(playheadState.mediaSeq + playheadState.vodMediaSeqVideo, ") vodMediaSeq=(").concat(playheadState.vodMediaSeqVideo, "_").concat(playheadState.vodMediaSeqAudio, " of ").concat(currentVod.getLiveMediaSequencesCount(), "_").concat(currentVod.getLiveMediaSequencesCount("audio"), ")"));
1127
- if (!(playheadState.vodMediaSeqVideo < 2 || playheadState.mediaSeq !== this.prevMediaSeqOffset.video)) return [3 /*break*/, 32];
1133
+ if (!(playheadState.vodMediaSeqVideo < 2 || playheadState.mediaSeq !== this.prevMediaSeqOffset.video)) return [3 /*break*/, 33];
1128
1134
  debug("[".concat(this._sessionId, "]: current[").concat(playheadState.vodMediaSeqVideo, "]_prev[").concat(this.prevVodMediaSeq.video, "]"));
1129
1135
  debug("[".concat(this._sessionId, "]: current-offset[").concat(playheadState.mediaSeq, "]_prev-offset[").concat(this.prevMediaSeqOffset.video, "]"));
1130
1136
  if (playheadState.vodMediaSeqVideo < this.prevVodMediaSeq.video || playheadState.mediaSeq !== this.prevMediaSeqOffset.video) {
1131
1137
  this.isAllowedToClearVodCache = true;
1132
1138
  }
1133
- if (!(!isLeader && this.isAllowedToClearVodCache)) return [3 /*break*/, 31];
1139
+ if (!(!isLeader && this.isAllowedToClearVodCache)) return [3 /*break*/, 32];
1134
1140
  debug("[".concat(this._sessionId, "]: Not a leader and have just set 'playheadState.vodMediaSeqVideo' to 0|1. Invalidate cache to ensure having the correct VOD."));
1135
1141
  return [4 /*yield*/, this._sessionState.clearCurrentVodCache()];
1136
- case 28:
1142
+ case 29:
1137
1143
  _o.sent();
1138
1144
  return [4 /*yield*/, this._sessionState.getCurrentVod()];
1139
- case 29:
1145
+ case 30:
1140
1146
  currentVod = _o.sent();
1141
1147
  return [4 /*yield*/, this._playheadState.get("diffCompensation")];
1142
- case 30:
1148
+ case 31:
1143
1149
  diffMs = _o.sent();
1144
1150
  if (diffMs) {
1145
1151
  this.diffCompensation = diffMs;
@@ -1153,12 +1159,12 @@ var Session = /** @class */ (function () {
1153
1159
  }
1154
1160
  }
1155
1161
  this.isAllowedToClearVodCache = false;
1156
- _o.label = 31;
1157
- case 31: return [3 /*break*/, 33];
1158
- case 32:
1159
- this.isAllowedToClearVodCache = true;
1160
- _o.label = 33;
1162
+ _o.label = 32;
1163
+ case 32: return [3 /*break*/, 34];
1161
1164
  case 33:
1165
+ this.isAllowedToClearVodCache = true;
1166
+ _o.label = 34;
1167
+ case 34:
1162
1168
  // Update Value for Previous Sequence
1163
1169
  this.prevVodMediaSeq.video = playheadState.vodMediaSeqVideo;
1164
1170
  this.prevMediaSeqOffset.video = playheadState.mediaSeq;
@@ -1168,7 +1174,7 @@ var Session = /** @class */ (function () {
1168
1174
  }
1169
1175
  m3u8 = currentVod.getLiveMediaSequences(playheadState.mediaSeq, 180000, playheadState.vodMediaSeqVideo, sessionState.discSeq);
1170
1176
  return [4 /*yield*/, this._playheadState.setLastM3u8(m3u8)];
1171
- case 34:
1177
+ case 35:
1172
1178
  _o.sent();
1173
1179
  return [2 /*return*/, m3u8];
1174
1180
  }
@@ -1367,8 +1373,10 @@ var Session = /** @class */ (function () {
1367
1373
  m3u8 = "#EXTM3U\n";
1368
1374
  m3u8 += "#EXT-X-VERSION:4\n";
1369
1375
  m3u8 += m3u8Header(this._instanceId);
1370
- m3u8 += "#EXT-X-SESSION-DATA:DATA-ID=\"eyevinn.tv.session.id\",VALUE=\"".concat(this._sessionId, "\"\n");
1371
- m3u8 += "#EXT-X-SESSION-DATA:DATA-ID=\"eyevinn.tv.eventstream\",VALUE=\"/eventstream/".concat(this._sessionId, "\"\n");
1376
+ if (!this._noSessionDataTags) {
1377
+ m3u8 += "#EXT-X-SESSION-DATA:DATA-ID=\"eyevinn.tv.session.id\",VALUE=\"".concat(this._sessionId, "\"\n");
1378
+ m3u8 += "#EXT-X-SESSION-DATA:DATA-ID=\"eyevinn.tv.eventstream\",VALUE=\"/eventstream/".concat(this._sessionId, "\"\n");
1379
+ }
1372
1380
  return [4 /*yield*/, this._sessionState.getCurrentVod()];
1373
1381
  case 1:
1374
1382
  currentVod = _a.sent();
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyevinn-channel-engine",
3
- "version": "4.0.3",
3
+ "version": "4.0.5",
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;
@@ -776,10 +779,13 @@ class Session {
776
779
 
777
780
  if (sessionState.vodMediaSeqVideo >= currentVod.getLiveMediaSequencesCount() - 1) {
778
781
  sessionState.vodMediaSeqVideo = await this._sessionState.set("vodMediaSeqVideo", currentVod.getLiveMediaSequencesCount() - 1);
779
- sessionState.vodMediaSeqAudio = await this._sessionState.set("vodMediaSeqAudio", currentVod.getLiveMediaSequencesCount("audio") - 1);
780
782
  sessionState.state = await this._sessionState.set("state", SessionState.VOD_NEXT_INIT);
781
783
  }
782
784
 
785
+ if (sessionState.vodMediaSeqAudio >= currentVod.getLiveMediaSequencesCount("audio") - 1) {
786
+ sessionState.vodMediaSeqAudio = await this._sessionState.set("vodMediaSeqAudio", currentVod.getLiveMediaSequencesCount("audio") - 1);
787
+ }
788
+
783
789
  if (this.isSwitchingBackToV2L) {
784
790
  sessionState.state = await this._sessionState.set("state", SessionState.VOD_RELOAD_INIT);
785
791
  this.isSwitchingBackToV2L = false;
@@ -952,8 +958,10 @@ class Session {
952
958
  let m3u8 = "#EXTM3U\n";
953
959
  m3u8 += "#EXT-X-VERSION:4\n";
954
960
  m3u8 += m3u8Header(this._instanceId);
955
- m3u8 += `#EXT-X-SESSION-DATA:DATA-ID="eyevinn.tv.session.id",VALUE="${this._sessionId}"\n`;
956
- m3u8 += `#EXT-X-SESSION-DATA:DATA-ID="eyevinn.tv.eventstream",VALUE="/eventstream/${this._sessionId}"\n`;
961
+ if (!this._noSessionDataTags) {
962
+ m3u8 += `#EXT-X-SESSION-DATA:DATA-ID="eyevinn.tv.session.id",VALUE="${this._sessionId}"\n`;
963
+ m3u8 += `#EXT-X-SESSION-DATA:DATA-ID="eyevinn.tv.eventstream",VALUE="/eventstream/${this._sessionId}"\n`;
964
+ }
957
965
  const currentVod = await this._sessionState.getCurrentVod();
958
966
  if (!currentVod) {
959
967
  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.3",
3
+ "version": "4.0.5",
4
4
  "description": "OTT TV Channel Engine",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",