eyevinn-channel-engine 3.2.4 → 3.2.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.
Files changed (2) hide show
  1. package/engine/session.js +18 -12
  2. package/package.json +1 -1
package/engine/session.js CHANGED
@@ -57,7 +57,7 @@ class Session {
57
57
  transitionSegments: null,
58
58
  reloadBehind: null,
59
59
  }
60
- this.alreadyClearedVodCache = null;
60
+ this.isAllowedToClearVodCache = null;
61
61
 
62
62
  if (config) {
63
63
  if (config.sessionId) {
@@ -476,14 +476,13 @@ class Session {
476
476
  if (playheadState.vodMediaSeqVideo < 2 || playheadState.vodMediaSeqVideo < this.prevVodMediaSeq.video) {
477
477
  debug(`[${this._sessionId}]: current[${playheadState.vodMediaSeqVideo}]_prev[${this.prevVodMediaSeq.video}]`);
478
478
  const isLeader = await this._sessionStateStore.isLeader(this._instanceId);
479
- if (!isLeader && !this.alreadyClearedVodCache) {
479
+ if (!isLeader && this.isAllowedToClearVodCache) {
480
480
  debug(`[${this._sessionId}]: Not a leader and first|second media sequence in a VOD is requested. Invalidate cache to ensure having the correct VOD.`);
481
481
  await this._sessionState.clearCurrentVodCache();
482
- this.alreadyClearedVodCache = true;
482
+ this.isAllowedToClearVodCache = false;
483
483
  }
484
484
  } else {
485
- // Reset the value
486
- this.alreadyClearedVodCache = false;
485
+ this.isAllowedToClearVodCache = true;
487
486
  }
488
487
 
489
488
  const currentVod = await this._sessionState.getCurrentVod();
@@ -597,14 +596,13 @@ class Session {
597
596
  if (playheadState.vodMediaSeqVideo < this.prevVodMediaSeq.video) {
598
597
  this.alreadyCleredVodCache = false;
599
598
  }
600
- if (!isLeader && !this.alreadyClearedVodCache) {
599
+ if (!isLeader && this.isAllowedToClearVodCache) {
601
600
  debug(`[${this._sessionId}]: Not a leader and have just set 'playheadState.vodMediaSeqVideo' to 0|1. Invalidate cache to ensure having the correct VOD.`);
602
601
  await this._sessionState.clearCurrentVodCache();
603
- this.alreadyClearedVodCache = true;
602
+ this.isAllowedToClearVodCache = false;
604
603
  }
605
604
  } else {
606
- // Reset the value
607
- this.alreadyClearedVodCache = false;
605
+ this.isAllowedToClearVodCache = true;
608
606
  }
609
607
  // Update Value for Previous Sequence
610
608
  this.prevVodMediaSeq.video = playheadState.vodMediaSeqVideo;
@@ -959,12 +957,19 @@ class Session {
959
957
  this.prevVodMediaSeq.video = sessionState.vodMediaSeqVideo;
960
958
  }
961
959
  // Clear Cache if prev count is HIGHER than current...
962
- if (sessionState.vodMediaSeqVideo < this.prevVodMediaSeq.video ) {
963
- debug(`[${this._sessionId}]: current[${sessionState.vodMediaSeqVideo}], prev[${this.prevVodMediaSeq.video}], total[${currentVod.getLiveMediaSequencesCount()}]`);
960
+ if (sessionState.vodMediaSeqVideo < this.prevVodMediaSeq.video) {
961
+ debug(`[${this._sessionId}]: state=VOD_PLAYING, current[${sessionState.vodMediaSeqVideo}], prev[${this.prevVodMediaSeq.video}], total[${currentVod.getLiveMediaSequencesCount()}]`);
964
962
  await this._sessionState.clearCurrentVodCache();
965
963
  currentVod = await this._sessionState.getCurrentVod();
966
964
  this.prevVodMediaSeq.video = sessionState.vodMediaSeqVideo;
967
965
  }
966
+ } else {
967
+ // Handle edge case where Leader loaded next vod but Follower remained in state=VOD_PLAYING
968
+ if (this.prevVodMediaSeq.video !== null & sessionState.vodMediaSeqVideo < this.prevVodMediaSeq.video) {
969
+ debug(`[${this._sessionId}]: state=VOD_PLAYING, current[${sessionState.vodMediaSeqVideo}], prev[${this.prevVodMediaSeq.video}], total[${currentVod.getLiveMediaSequencesCount()}]`);
970
+ // Allow Follower to clear VodCache...
971
+ this.isAllowedToClearVodCache = true;
972
+ }
968
973
  }
969
974
  debug(`[${this._sessionId}]: state=VOD_PLAYING (${sessionState.vodMediaSeqVideo}_${sessionState.vodMediaSeqAudio}, ${currentVod.getLiveMediaSequencesCount()})`);
970
975
  return;
@@ -973,7 +978,8 @@ class Session {
973
978
  if (!isLeader) {
974
979
  debug(`[${this._sessionId}]: not the leader so just waiting for the VOD to be initiated`);
975
980
  }
976
- this.alreadyClearedVodCache = false;
981
+ // Allow Leader|Follower to clear vodCache...
982
+ this.isAllowedToClearVodCache = true;
977
983
  return;
978
984
  case SessionState.VOD_NEXT_INIT:
979
985
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyevinn-channel-engine",
3
- "version": "3.2.4",
3
+ "version": "3.2.5",
4
4
  "description": "OTT TV Channel Engine",
5
5
  "main": "index.js",
6
6
  "scripts": {