eyevinn-channel-engine 4.2.6 → 4.2.8

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.
@@ -1062,7 +1062,7 @@ var Session = /** @class */ (function () {
1062
1062
  };
1063
1063
  Session.prototype.incrementAsync = function () {
1064
1064
  return __awaiter(this, void 0, void 0, function () {
1065
- var isLeader, sessionState, playheadState, currentVod, _a, isOldVod, nextState, leaderAction, leaderState, _b, m3u8_4, _c, audioIncrement, positionV, positionA, position, currentVod_1, sessionState_1, posDiff, incrementValue, index, audioSeqLastIdx, thresh, audioPosition, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, mediaSequenceValue, audioInfo, mediaSequenceValueAudio, diffMs, m3u8;
1065
+ var isLeader, sessionState, playheadState, currentVod, _a, isOldVod, nextState, leaderAction, leaderState, _b, m3u8_4, _c, audioIncrement, positionV, positionA, position, currentVod_1, sessionState_1, posDiff, incrementValue, index, audioSeqLastIdx, thresh, maxAcceptableDiff, audioPosition, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, mediaSequenceValue, audioInfo, mediaSequenceValueAudio, diffMs, m3u8;
1066
1066
  return __generator(this, function (_s) {
1067
1067
  switch (_s.label) {
1068
1068
  case 0: return [4 /*yield*/, this._tickAsync()];
@@ -1154,22 +1154,26 @@ var Session = /** @class */ (function () {
1154
1154
  index = 0;
1155
1155
  audioSeqLastIdx = currentVod_1.getLiveMediaSequencesCount("audio") - 1;
1156
1156
  thresh = 0.5;
1157
+ maxAcceptableDiff = 0.001;
1157
1158
  debug("[".concat(this._sessionId, "]: About to determine audio increment"));
1158
1159
  _s.label = 19;
1159
1160
  case 19: return [4 /*yield*/, this._getAudioPlayheadPosition(sessionState_1.vodMediaSeqAudio + index)];
1160
1161
  case 20:
1161
1162
  audioPosition = (_s.sent()) * 1000;
1162
1163
  positionA = audioPosition / 1000;
1163
- posDiff = position - audioPosition;
1164
- if (posDiff <= 0) {
1164
+ posDiff = (positionV - positionA).toFixed(3);
1165
+ debug("[".concat(this._sessionId, "]: positionV=").concat(positionV, ";positionA=").concat(positionA, ";posDiff=").concat(posDiff, ";(posDiff <= 0.001)=").concat(posDiff <= 0.001));
1166
+ if (posDiff <= maxAcceptableDiff) {
1167
+ debug("[".concat(this._sessionId, "]: posDiff value (").concat(posDiff, ") is acceptable"));
1165
1168
  return [3 /*break*/, 22];
1166
1169
  }
1167
1170
  if (posDiff > thresh) {
1168
1171
  index++;
1169
1172
  incrementValue++;
1170
1173
  }
1171
- else {
1174
+ else if (posDiff > maxAcceptableDiff) {
1172
1175
  index = incrementValue;
1176
+ debug("[".concat(this._sessionId, "]: Audio Stepping index set to = ").concat(index));
1173
1177
  return [3 /*break*/, 22];
1174
1178
  }
1175
1179
  if (sessionState_1.vodMediaSeqAudio + index > audioSeqLastIdx) {
@@ -1181,7 +1185,7 @@ var Session = /** @class */ (function () {
1181
1185
  _s.label = 22;
1182
1186
  case 22:
1183
1187
  audioIncrement = index;
1184
- debug("[".concat(this._sessionId, "]: Current VOD Playhead Positions are to be: [").concat(positionV.toFixed(3), "][").concat(positionA.toFixed(3), "] (").concat((positionA - positionV).toFixed(3), ")"));
1188
+ debug("[".concat(this._sessionId, "]: Current VOD Playhead Positions are to be: [").concat(positionV.toFixed(3), "][").concat(positionA.toFixed(3), "] (").concat(posDiff, ")"));
1185
1189
  _s.label = 23;
1186
1190
  case 23:
1187
1191
  debug("[".concat(this._sessionId, "]: Will increment audio with ").concat(audioIncrement));
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyevinn-channel-engine",
3
- "version": "4.2.6",
3
+ "version": "4.2.8",
4
4
  "description": "OTT TV Channel Engine",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/engine/session.js CHANGED
@@ -836,19 +836,23 @@ class Session {
836
836
  let index = 0;
837
837
  const audioSeqLastIdx = currentVod.getLiveMediaSequencesCount("audio") - 1;
838
838
  const thresh = 0.5;
839
+ const maxAcceptableDiff = 0.001;
839
840
  debug(`[${this._sessionId}]: About to determine audio increment`);
840
841
  do {
841
842
  const audioPosition = (await this._getAudioPlayheadPosition(sessionState.vodMediaSeqAudio + index)) * 1000;
842
843
  positionA = audioPosition / 1000;
843
- posDiff = position - audioPosition;
844
- if (posDiff <= 0) {
844
+ posDiff = (positionV-positionA).toFixed(3);
845
+ debug(`[${this._sessionId}]: positionV=${positionV};positionA=${positionA};posDiff=${posDiff};(posDiff <= 0.001)=${posDiff <= 0.001}`);
846
+ if (posDiff <= maxAcceptableDiff) {
847
+ debug(`[${this._sessionId}]: posDiff value (${posDiff}) is acceptable`);
845
848
  break;
846
849
  }
847
850
  if (posDiff > thresh) {
848
851
  index++;
849
852
  incrementValue++;
850
- } else {
853
+ } else if (posDiff > maxAcceptableDiff) {
851
854
  index = incrementValue;
855
+ debug(`[${this._sessionId}]: Audio Stepping index set to = ${index}`);
852
856
  break;
853
857
  }
854
858
  if (sessionState.vodMediaSeqAudio + index > audioSeqLastIdx) {
@@ -856,7 +860,7 @@ class Session {
856
860
  }
857
861
  } while (!(-thresh < posDiff && posDiff < thresh));
858
862
  audioIncrement = index;
859
- debug(`[${this._sessionId}]: Current VOD Playhead Positions are to be: [${positionV.toFixed(3)}][${positionA.toFixed(3)}] (${(positionA-positionV).toFixed(3)})`);
863
+ debug(`[${this._sessionId}]: Current VOD Playhead Positions are to be: [${positionV.toFixed(3)}][${positionA.toFixed(3)}] (${posDiff})`);
860
864
  }
861
865
  debug(`[${this._sessionId}]: Will increment audio with ${audioIncrement}`);
862
866
  sessionState.vodMediaSeqAudio = await this._sessionState.increment("vodMediaSeqAudio", audioIncrement);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyevinn-channel-engine",
3
- "version": "4.2.6",
3
+ "version": "4.2.8",
4
4
  "description": "OTT TV Channel Engine",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",