eyevinn-channel-engine 3.1.6 → 3.1.9

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.
@@ -48,6 +48,7 @@ class SessionLive {
48
48
  this.firstTime = true;
49
49
  this.allowedToSet = false;
50
50
  this.pushAmount = 0;
51
+ this.restAmount = 0;
51
52
  this.waitForPlayhead = true;
52
53
  this.blockGenerateManifest = false;
53
54
 
@@ -158,16 +159,16 @@ class SessionLive {
158
159
  this.waitForPlayhead = false;
159
160
 
160
161
  // Let the playhead move at an interval set according to live segment duration
161
- let liveSegmentDurationMs = DEFAULT_PLAYHEAD_INTERVAL_MS;
162
- let liveBws = Object.keys(this.liveSegQueue);
163
- if (liveBws.length !== 0 && this.liveSegQueue[liveBws[0]].length !== 0 && this.liveSegQueue[liveBws[0]][0].duration) {
164
- liveSegmentDurationMs = this.liveSegQueue[liveBws[0]][0].duration * 1000;
165
- }
162
+ const liveSegmentDurationMs = this._getAnyFirstSegmentDurationMs() || DEFAULT_PLAYHEAD_INTERVAL_MS;
166
163
 
167
164
  // Set the timer
168
165
  let timerValueMs = 0;
169
166
  if (this.timerCompensation) {
170
- if (liveSegmentDurationMs - (tsIncrementEnd - tsIncrementBegin) > 0) {
167
+ const isLeader = await this.sessionLiveStateStore.isLeader(this.instanceId);
168
+ const incrementDuration = tsIncrementEnd - tsIncrementBegin;
169
+ if (incrementDuration >= liveSegmentDurationMs * 0.5 && isLeader) {
170
+ timerValueMs = liveSegmentDurationMs;
171
+ } else {
171
172
  timerValueMs = liveSegmentDurationMs - (tsIncrementEnd - tsIncrementBegin);
172
173
  }
173
174
  } else {
@@ -499,8 +500,14 @@ class SessionLive {
499
500
  if (!this.liveSegQueue[liveBw]) {
500
501
  this.liveSegQueue[liveBw] = [];
501
502
  }
502
- this.liveSegQueue[liveBw].push(liveSegFromLeader);
503
- debug(`[${this.sessionId}]: FOLLOWER: Pushed segment (${liveSegFromLeader.uri ? liveSegFromLeader.uri : "Disc-tag"}) to 'liveSegQueue' (${liveBw})`);
503
+ // Do not push duplicates
504
+ const liveSegURIs = this.liveSegQueue[liveBw].filter(seg => seg.uri).map(seg => seg.uri);
505
+ if (liveSegFromLeader.uri && liveSegURIs.includes(liveSegFromLeader.uri)) {
506
+ debug(`[${this.sessionId}]: FOLLOWER: Found duplicate live segment. Skip push! (${liveBw})`);
507
+ } else {
508
+ this.liveSegQueue[liveBw].push(liveSegFromLeader);
509
+ debug(`[${this.sessionId}]: FOLLOWER: Pushed segment (${liveSegFromLeader.uri ? liveSegFromLeader.uri : "Disc-tag"}) to 'liveSegQueue' (${liveBw})`);
510
+ }
504
511
  }
505
512
  }
506
513
  // Remove older segments and update counts
@@ -520,13 +527,13 @@ class SessionLive {
520
527
  */
521
528
  async _loadAllMediaManifests() {
522
529
  debug(`[${this.sessionId}]: Attempting to load all media manifest URIs in=${Object.keys(this.mediaManifestURIs)}`);
523
-
530
+ let currentMseqRaw = null;
524
531
  // -------------------------------------
525
532
  // If I am a Follower-node then my job
526
533
  // ends here, where I only read from store.
527
534
  // -------------------------------------
528
535
  let isLeader = await this.sessionLiveStateStore.isLeader(this.instanceId);
529
- if (!isLeader && this.lastRequestedMediaSeqRaw) {
536
+ if (!isLeader && this.lastRequestedMediaSeqRaw !== null) {
530
537
  debug(`[${this.sessionId}]: FOLLOWER: Reading data from store!`);
531
538
 
532
539
  let leadersMediaSeqRaw = await this.sessionLiveState.get("lastRequestedMediaSeqRaw");
@@ -534,12 +541,14 @@ class SessionLive {
534
541
  if (!leadersMediaSeqRaw < this.lastRequestedMediaSeqRaw && this.blockGenerateManifest) {
535
542
  this.blockGenerateManifest = false;
536
543
  }
537
- let attempts = 5;
538
544
 
545
+ let attempts = 5;
539
546
  // CHECK AGAIN CASE 1: Store Empty
540
547
  while (!leadersMediaSeqRaw && attempts > 0) {
541
- debug(`[${this.sessionId}]: FOLLOWER: Leader has not put anything in store... Will check again in 2000ms (Tries left=[${attempts}])`);
542
- await timer(2000);
548
+ const segDur = this._getAnyFirstSegmentDurationMs() || DEFAULT_PLAYHEAD_INTERVAL_MS;
549
+ const waitTimeMs = parseInt(segDur / 3, 10);
550
+ debug(`[${this.sessionId}]: FOLLOWER: Leader has not put anything in store... Will check again in ${waitTimeMs}ms (Tries left=[${attempts}])`);
551
+ await timer(waitTimeMs);
543
552
  this.timerCompensation = false;
544
553
  leadersMediaSeqRaw = await this.sessionLiveState.get("lastRequestedMediaSeqRaw");
545
554
  attempts--;
@@ -559,8 +568,10 @@ class SessionLive {
559
568
  attempts = 5;
560
569
  // CHECK AGAIN CASE 2: Store Old
561
570
  while (leadersMediaSeqRaw <= this.lastRequestedMediaSeqRaw && attempts > 0) {
562
- debug(`[${this.sessionId}]: FOLLOWER: Cannot find anything NEW in store... Will check again in 2000ms (Tries left=[${attempts}])`);
563
- await timer(2000);
571
+ const segDur = this._getAnyFirstSegmentDurationMs() || DEFAULT_PLAYHEAD_INTERVAL_MS;
572
+ const waitTimeMs = parseInt(segDur / 3, 10);
573
+ debug(`[${this.sessionId}]: FOLLOWER: Cannot find anything NEW in store... Will check again in ${waitTimeMs}ms (Tries left=[${attempts}])`);
574
+ await timer(waitTimeMs);
564
575
  this.timerCompensation = false;
565
576
  leadersMediaSeqRaw = await this.sessionLiveState.get("lastRequestedMediaSeqRaw");
566
577
  attempts--;
@@ -659,37 +670,55 @@ class SessionLive {
659
670
  continue;
660
671
  }
661
672
 
673
+ currentMseqRaw = allMediaSeqCounts[0];
674
+
662
675
  if (!isLeader) {
663
676
  let leadersFirstSeqCounts = await this.sessionLiveState.get("firstCounts");
664
677
  let tries = 20;
665
678
 
666
- while ((!leadersFirstSeqCounts.liveSourceMseqCount && tries > 0) || leadersFirstSeqCounts.liveSourceMseqCount === 0) {
679
+ while (!isLeader && (!leadersFirstSeqCounts.liveSourceMseqCount && tries > 0) || leadersFirstSeqCounts.liveSourceMseqCount === 0) {
667
680
  debug(`[${this.sessionId}]: NEW FOLLOWER: Waiting for LEADER to add 'firstCounts' in store! Will look again after 1000ms (tries left=${tries})`);
668
681
  await timer(1000);
669
682
  leadersFirstSeqCounts = await this.sessionLiveState.get("firstCounts");
670
683
  tries--;
684
+ // Might take over as Leader if Leader is not setting data due to being down.
685
+ isLeader = await this.sessionLiveStateStore.isLeader(this.instanceId);
686
+ if (isLeader) {
687
+ debug(`[${this.sessionId}][${this.instanceId}]: I'm the new leader, and now I am going to add 'firstCounts' in store`);
688
+ }
671
689
  }
672
690
 
673
691
  if (tries === 0) {
674
692
  isLeader = await this.sessionLiveStateStore.isLeader(this.instanceId);
675
693
  if (isLeader) {
676
- debug(`[${this.instanceId}]: I'm the new leader, and now I am going to add 'firstCounts' in store`);
694
+ debug(`[${this.sessionId}][${this.instanceId}]: I'm the new leader, and now I am going to add 'firstCounts' in store`);
677
695
  break;
678
696
  } else {
679
- debug(`[${this.instanceId}]: The leader is still alive`);
697
+ debug(`[${this.sessionId}][${this.instanceId}]: The leader is still alive`);
680
698
  leadersFirstSeqCounts = await this.sessionLiveState.get("firstCounts");
681
699
  if (!leadersFirstSeqCounts.liveSourceMseqCount) {
682
- debug(`[${this.instanceId}]: Could not find 'firstCounts' in store. Abort Executing Promises II & Returning to Playhead.`);
700
+ debug(`[${this.sessionId}][${this.instanceId}]: Could not find 'firstCounts' in store. Abort Executing Promises II & Returning to Playhead.`);
683
701
  return;
684
702
  }
685
703
  }
686
704
  }
687
705
 
706
+ if (isLeader) {
707
+ debug(`[${this.sessionId}]: NEW LEADER: Original Leader went missing, I am retrying live source fetch...`);
708
+ await this.sessionLiveState.set("transitSegs", this.vodSegments);
709
+ debug(`[${this.sessionId}]: NEW LEADER: I am adding 'transitSegs' to Store for future followers`);
710
+ continue;
711
+ }
712
+
688
713
  // Respawners never do this, only starter followers.
689
714
  // Edge Case: FOLLOWER transitioned from session with different segments from LEADER
690
- const leaderStartedOnCount = leadersFirstSeqCounts.mediaSeqCount;
691
- if (leaderStartedOnCount !== this.mediaSeqCount) {
692
- this.mediaSeqCount = leaderStartedOnCount;
715
+ if (leadersFirstSeqCounts.discSeqCount !== this.discSeqCount) {
716
+ this.discSeqCount = leadersFirstSeqCounts.discSeqCount;
717
+ }
718
+ if (leadersFirstSeqCounts.mediaSeqCount !== this.mediaSeqCount) {
719
+ this.mediaSeqCount = leadersFirstSeqCounts.mediaSeqCount;
720
+ debug(`[${this.sessionId}]: FOLLOWER transistioned with wrong V2L segments, updating counts to [${
721
+ this.mediaSeqCount}][${this.discSeqCount}], and reading 'transitSegs' from store`);
693
722
  const transitSegs = await this.sessionLiveState.get("transitSegs");
694
723
  if (!this._isEmpty(transitSegs)) {
695
724
  this.vodSegments = transitSegs;
@@ -697,12 +726,16 @@ class SessionLive {
697
726
  }
698
727
 
699
728
  // Prepare to load segments...
700
- debug(`[${this.instanceId}][${this.sessionId}]: Newest mseq from LIVE=${allMediaSeqCounts[0]} First mseq in store=${leadersFirstSeqCounts.liveSourceMseqCount}`);
701
- if (allMediaSeqCounts[0] === leadersFirstSeqCounts.liveSourceMseqCount) {
729
+ debug(`[${this.instanceId}][${this.sessionId}]: Newest mseq from LIVE=${currentMseqRaw} First mseq in store=${leadersFirstSeqCounts.liveSourceMseqCount}`);
730
+ if (currentMseqRaw === leadersFirstSeqCounts.liveSourceMseqCount) {
702
731
  this.pushAmount = 1; // Follower from start
703
732
  } else {
733
+
734
+ // TODO: To support and account for past discontinuity tags in the Live Source stream,
735
+ // we will need to get the real 'current' discontinuity-sequence count from Leader somehow.
736
+
704
737
  // RESPAWNED NODES
705
- this.pushAmount = allMediaSeqCounts[0] - leadersFirstSeqCounts.liveSourceMseqCount + 1;
738
+ this.pushAmount = currentMseqRaw - leadersFirstSeqCounts.liveSourceMseqCount + 1;
706
739
 
707
740
  const transitSegs = await this.sessionLiveState.get("transitSegs");
708
741
  //debug(`[${this.sessionId}]: NEW FOLLOWER: I tried to get 'transitSegs'. This is what I found ${JSON.stringify(transitSegs)}`);
@@ -716,8 +749,8 @@ class SessionLive {
716
749
  if (this.firstTime) {
717
750
  this.pushAmount = 1; // Leader from start
718
751
  } else {
719
- this.pushAmount = allMediaSeqCounts[0] - this.lastRequestedMediaSeqRaw;
720
- debug(`[${this.sessionId}]: ...calculating pushAmount=${allMediaSeqCounts[0]}-${this.lastRequestedMediaSeqRaw}=${this.pushAmount}`);
752
+ this.pushAmount = currentMseqRaw - this.lastRequestedMediaSeqRaw;
753
+ debug(`[${this.sessionId}]: ...calculating pushAmount=${currentMseqRaw}-${this.lastRequestedMediaSeqRaw}=${this.pushAmount}`);
721
754
  }
722
755
  debug(`[${this.sessionId}]: ...pushAmount=${this.pushAmount}`);
723
756
  break;
@@ -737,9 +770,9 @@ class SessionLive {
737
770
  const leadersCurrentMseqRaw = await this.sessionLiveState.get("lastRequestedMediaSeqRaw");
738
771
  const counts = await this.sessionLiveState.get("firstCounts");
739
772
  const leadersFirstMseqRaw = counts.liveSourceMseqCount;
740
- if (leadersCurrentMseqRaw && leadersCurrentMseqRaw !== this.lastRequestedMediaSeqRaw) {
773
+ if (leadersCurrentMseqRaw !== null && leadersCurrentMseqRaw !== currentMseqRaw) {
741
774
  // if leader never had any segs from prev mseq
742
- if (leadersFirstMseqRaw && leadersFirstMseqRaw === leadersCurrentMseqRaw) {
775
+ if (leadersFirstMseqRaw !== null && leadersFirstMseqRaw === leadersCurrentMseqRaw) {
743
776
  // Follower updates it's manifest ingedients (segment holders & counts)
744
777
  this.lastRequestedMediaSeqRaw = leadersCurrentMseqRaw;
745
778
  this.liveSegsForFollowers = await this.sessionLiveState.get("liveSegsForFollowers");
@@ -760,7 +793,7 @@ class SessionLive {
760
793
  for (let i = 0; i < Object.keys(this.mediaManifestURIs).length; i++) {
761
794
  let bw = Object.keys(this.mediaManifestURIs)[i];
762
795
  // will add new segments to live seg queue
763
- pushPromises.push(this._parseMediaManifest(this.liveSourceM3Us[bw].M3U, this.mediaManifestURIs[bw], bw));
796
+ pushPromises.push(this._parseMediaManifest(this.liveSourceM3Us[bw].M3U, this.mediaManifestURIs[bw], bw, isLeader));
764
797
  debug(`[${this.sessionId}]: Pushed pushPromise for bw=${bw}`);
765
798
  }
766
799
  // Segment Pushing
@@ -949,6 +982,12 @@ class SessionLive {
949
982
  // Update Session Live Media Sequence Count...
950
983
  this.prevMediaSeqCount = this.mediaSeqCount;
951
984
  this.mediaSeqCount += removedSegments;
985
+ if (this.restAmount) {
986
+ this.mediaSeqCount += this.restAmount;
987
+ debug(`[${this.sessionId}]: ${instanceName}: Added restAmount=[${this.restAmount}] to 'mediaSeqCount'`);
988
+ this.restAmount = 0;
989
+ }
990
+
952
991
  if (this.discSeqCount !== this.prevDiscSeqCount) {
953
992
  debug(`[${this.sessionId}]: ${instanceName}: Incrementing Dseq Count from {${this.prevDiscSeqCount}} -> {${this.discSeqCount}}`);
954
993
  }
@@ -1003,7 +1042,7 @@ class SessionLive {
1003
1042
  });
1004
1043
  }
1005
1044
 
1006
- _parseMediaManifest(m3u, mediaManifestUri, liveTargetBandwidth) {
1045
+ _parseMediaManifest(m3u, mediaManifestUri, liveTargetBandwidth, isLeader) {
1007
1046
  return new Promise(async (resolve, reject) => {
1008
1047
  try {
1009
1048
  if (!this.liveSegQueue[liveTargetBandwidth]) {
@@ -1026,10 +1065,13 @@ class SessionLive {
1026
1065
  }
1027
1066
  this.targetDuration = m3u.get("targetDuration");
1028
1067
  let startIdx = m3u.items.PlaylistItem.length - this.pushAmount;
1029
- startIdx = startIdx < 0 ? 0 : startIdx;
1068
+ if (startIdx < 0) {
1069
+ this.restAmount = startIdx * -1;
1070
+ startIdx = 0;
1071
+ }
1030
1072
  if (mediaManifestUri) {
1031
1073
  // push segments
1032
- this._addLiveSegmentsToQueue(startIdx, m3u.items.PlaylistItem, baseUrl, liveTargetBandwidth);
1074
+ this._addLiveSegmentsToQueue(startIdx, m3u.items.PlaylistItem, baseUrl, liveTargetBandwidth, isLeader);
1033
1075
  }
1034
1076
  resolve();
1035
1077
  } catch (exc) {
@@ -1047,7 +1089,9 @@ class SessionLive {
1047
1089
  * @param {string} baseUrl
1048
1090
  * @param {string} liveTargetBandwidth
1049
1091
  */
1050
- _addLiveSegmentsToQueue(startIdx, playlistItems, baseUrl, liveTargetBandwidth) {
1092
+ _addLiveSegmentsToQueue(startIdx, playlistItems, baseUrl, liveTargetBandwidth, isLeader) {
1093
+ const leaderOrFollower = isLeader ? "LEADER": "NEW FOLLOWER";
1094
+
1051
1095
  for (let i = startIdx; i < playlistItems.length; i++) {
1052
1096
  let seg = {};
1053
1097
  let playlistItem = playlistItems[i];
@@ -1115,10 +1159,15 @@ class SessionLive {
1115
1159
  if (daterangeData) {
1116
1160
  seg["daterange"] = daterangeData;
1117
1161
  }
1118
- // Push new Live Segments!
1119
- debug(`[${this.sessionId}]: Adding Live Segment to Queue (for bw=${liveTargetBandwidth})\n${seg.uri ? seg.uri : ''}`);
1120
- this.liveSegQueue[liveTargetBandwidth].push(seg);
1121
- this.liveSegsForFollowers[liveTargetBandwidth].push(seg);
1162
+ // Push new Live Segments! But do not push duplicates
1163
+ const liveSegURIs = this.liveSegQueue[liveTargetBandwidth].filter(seg => seg.uri).map(seg => seg.uri);
1164
+ if (seg.uri && liveSegURIs.includes(seg.uri)) {
1165
+ debug(`[${this.sessionId}]: ${leaderOrFollower}: Found duplicate live segment. Skip push! (${liveTargetBandwidth})`);
1166
+ } else {
1167
+ this.liveSegQueue[liveTargetBandwidth].push(seg);
1168
+ this.liveSegsForFollowers[liveTargetBandwidth].push(seg);
1169
+ debug(`[${this.sessionId}]: ${leaderOrFollower}: Pushed segment (${seg.uri ? seg.uri : "Disc-tag"}) to 'liveSegQueue' (${liveTargetBandwidth})`);
1170
+ }
1122
1171
  }
1123
1172
  }
1124
1173
  }
@@ -1317,6 +1366,27 @@ class SessionLive {
1317
1366
  this.mediaManifestURIs = newItem;
1318
1367
  }
1319
1368
 
1369
+ _getAnyFirstSegmentDurationMs() {
1370
+ if (this._isEmpty(this.liveSegQueue)) {
1371
+ return null;
1372
+ }
1373
+
1374
+ const bw0 = Object.keys(this.liveSegQueue)[0];
1375
+ if (this.liveSegQueue[bw0].length === 0) {
1376
+ return null;
1377
+ }
1378
+
1379
+ for (let i = 0; i < this.liveSegQueue[bw0].length; i++) {
1380
+ const segment = this.liveSegQueue[bw0][i];
1381
+ if (!segment.duration) {
1382
+ continue;
1383
+ }
1384
+ return segment.duration * 1000;
1385
+ }
1386
+
1387
+ return null;
1388
+ }
1389
+
1320
1390
  _isEmpty(obj) {
1321
1391
  if (!obj) {
1322
1392
  return true;
@@ -7,6 +7,8 @@ const SessionState = Object.freeze({
7
7
  VOD_PLAYING: 2,
8
8
  VOD_NEXT_INIT: 3,
9
9
  VOD_NEXT_INITIATING: 4,
10
+ VOD_RELOAD_INIT: 5,
11
+ VOD_RELOAD_INITIATING: 6
10
12
  });
11
13
 
12
14
  const CURRENTVOD_CACHE_TTL = 5 * 60 * 1000; // 5 minutes
@@ -157,6 +159,11 @@ class SessionStateStore extends SharedStateStore {
157
159
  await this.setVolatile("", instanceId, t);
158
160
  }
159
161
 
162
+ async clearLeaderCache() {
163
+ debug(`[${this.instanceId}]: clearing 'leader' cache`);
164
+ this.cache.leader.value = null;
165
+ }
166
+
160
167
  async isLeader(instanceId) {
161
168
  if (!instanceId) {
162
169
  throw new Error("Cannot determine leader without instance id");
@@ -164,7 +171,7 @@ class SessionStateStore extends SharedStateStore {
164
171
  let leader;
165
172
  if (this.cache.leader.value && Date.now() < this.cache.leader.ts + this.cacheTTL) {
166
173
  leader = this.cache.leader.value;
167
- debug(`[${instanceId}]: reading 'leader' from cache: I am ${leader === instanceId ? "" : "NOT"} the leader!`);
174
+ debug(`[${instanceId}]: reading 'leader' from cache: I am${leader === instanceId ? "" : " NOT"} the leader!`);
168
175
  return leader === instanceId;
169
176
  }
170
177
  leader = await this.get("", "leader");
@@ -189,7 +196,7 @@ class SessionStateStore extends SharedStateStore {
189
196
  }
190
197
  }
191
198
  }
192
- debug(`[${instanceId}]: I am ${leader === instanceId ? "" : "NOT"} the leader!`);
199
+ debug(`[${instanceId}]: I am${leader === instanceId ? "" : " NOT"} the leader!`);
193
200
  this.cache.leader.ts = Date.now();
194
201
  this.cache.leader.value = leader;
195
202
  return leader === instanceId;
@@ -2,6 +2,8 @@ const debug = require("debug")("engine-stream-switcher");
2
2
  const crypto = require("crypto");
3
3
  const fetch = require("node-fetch");
4
4
  const { AbortController } = require("abort-controller");
5
+ const { SessionState } = require('./session_state');
6
+ const { timer } = require("./util")
5
7
 
6
8
  const SwitcherState = Object.freeze({
7
9
  V2L_TO_LIVE: 1,
@@ -88,8 +90,8 @@ class StreamSwitcher {
88
90
  return null;
89
91
  }
90
92
  // Handle Complete Storage Reset
91
- let sessionState = await session._sessionState.get("state");
92
- if (sessionState === 1 || !sessionState) {
93
+ let sessionState = await session.getSessionState();
94
+ if (sessionState === SessionState.VOD_INIT || !sessionState) {
93
95
  this.working = true;
94
96
  sessionLive.waitForPlayhead = false;
95
97
  sessionLive.allowedToSet = false; // only have effect on leader
@@ -150,6 +152,11 @@ class StreamSwitcher {
150
152
  );
151
153
  validURI = await this._validURI(scheduleObj.uri);
152
154
  tries++;
155
+ if (!validURI) {
156
+ const delayMs = tries * 500;
157
+ debug(`[${this.sessionId}]: Going to try validating Master URI again in ${delayMs}ms`);
158
+ await timer(delayMs);
159
+ }
153
160
  }
154
161
  if (!validURI) {
155
162
  debug(`[${this.sessionId}]: Unreachable URI: [${scheduleObj.uri}]`);
@@ -341,14 +348,14 @@ class StreamSwitcher {
341
348
  return false;
342
349
  }
343
350
 
344
- await session.setCurrentMediaSequenceSegments(
345
- liveSegments.currMseqSegs,
346
- liveSegments.segCount
347
- );
348
351
  await session.setCurrentMediaAndDiscSequenceCount(
349
352
  liveCounts.mediaSeq,
350
353
  liveCounts.discSeq
351
354
  );
355
+ await session.setCurrentMediaSequenceSegments(
356
+ liveSegments.currMseqSegs,
357
+ liveSegments.segCount
358
+ );
352
359
 
353
360
  this.working = false;
354
361
  this.streamTypeLive = false;
package/engine/util.js CHANGED
@@ -122,6 +122,8 @@ const logerror = (sessionId, err) => {
122
122
  console.error(err);
123
123
  };
124
124
 
125
+ const timer = ms => new Promise(res => setTimeout(res, ms));
126
+
125
127
  module.exports = {
126
128
  filterQueryParser,
127
129
  applyFilter,
@@ -129,4 +131,5 @@ module.exports = {
129
131
  m3u8Header,
130
132
  toHHMMSS,
131
133
  logerror,
134
+ timer
132
135
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyevinn-channel-engine",
3
- "version": "3.1.6",
3
+ "version": "3.1.9",
4
4
  "description": "OTT TV Channel Engine",
5
5
  "main": "index.js",
6
6
  "scripts": {