eyevinn-channel-engine 5.1.1 → 5.1.3

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.
@@ -405,7 +405,7 @@ class ChannelEngine {
405
405
  })();
406
406
  }
407
407
  listen(port) {
408
- this.server.listen({ port: port }, (err) => {
408
+ this.server.listen({ port: port, host: '0.0.0.0' }, (err) => {
409
409
  if (err) {
410
410
  console.error(err);
411
411
  process.exit(1);
@@ -130,7 +130,7 @@ declare class Session {
130
130
  _getNextVodById(id: any): Promise<any>;
131
131
  _getFirstDuration(manifest: any): Promise<any>;
132
132
  _getCurrentDeltaTime(): Promise<any>;
133
- _getCurrentPlayheadPosition(): Promise<any>;
133
+ _getCurrentPlayheadPosition(overrideVodMediaSeqVideo: any): Promise<any>;
134
134
  _getAudioPlayheadPosition(seqIdx: any): Promise<any>;
135
135
  _getSubtitlePlayheadPosition(seqIdx: any): Promise<any>;
136
136
  _getLastDuration(manifest: any): Promise<any>;
@@ -714,7 +714,11 @@ class Session {
714
714
  let playheadPosVideoMs;
715
715
  let playheadAudio;
716
716
  let playheadSubtitle;
717
- playheadPosVideoMs = (await this._getCurrentPlayheadPosition()) * 1000;
717
+ // Pass the locally-updated vodMediaSeqVideo (leader incremented above) so
718
+ // playhead position reflects this tick's video segment, not the stale
719
+ // value still in Redis. Without this, audio/subtitle stay 1 segment
720
+ // behind video for the entire VOD lifetime.
721
+ playheadPosVideoMs = (await this._getCurrentPlayheadPosition(sessionState.vodMediaSeqVideo)) * 1000;
718
722
  if (this.use_demuxed_audio) {
719
723
  const audioSeqLastIdx = currentVod.getLiveMediaSequencesCount("audio") - 1;
720
724
  playheadAudio = await this._determineExtraMediaIncrement("audio", playheadPosVideoMs, audioSeqLastIdx, sessionState.vodMediaSeqAudio, this._getAudioPlayheadPosition.bind(this));
@@ -1977,12 +1981,21 @@ class Session {
1977
1981
  }
1978
1982
  return 0;
1979
1983
  }
1980
- async _getCurrentPlayheadPosition() {
1981
- const sessionState = await this._sessionState.getValues(["vodMediaSeqVideo"]);
1984
+ async _getCurrentPlayheadPosition(overrideVodMediaSeqVideo) {
1985
+ // Caller can pass the in-progress local vodMediaSeqVideo to avoid the Redis
1986
+ // round-trip and the race where the leader has incremented its local value
1987
+ // but hasn't written it to Redis yet (incrementAsync writes happen later via
1988
+ // a parallel Promise.all). Falling back to Redis preserves the old behavior
1989
+ // for callers like startPlayheadAsync that run after incrementAsync.
1990
+ let vodMediaSeqVideo = overrideVodMediaSeqVideo;
1991
+ if (vodMediaSeqVideo === undefined) {
1992
+ const sessionState = await this._sessionState.getValues(["vodMediaSeqVideo"]);
1993
+ vodMediaSeqVideo = sessionState.vodMediaSeqVideo;
1994
+ }
1982
1995
  const currentVod = await this._sessionState.getCurrentVod();
1983
1996
  const playheadPositions = currentVod.getPlayheadPositions();
1984
- debug(`[${this._sessionId}]: Current playhead position (${sessionState.vodMediaSeqVideo}): ${roundToThreeDecimals(playheadPositions[sessionState.vodMediaSeqVideo])}`);
1985
- return playheadPositions[sessionState.vodMediaSeqVideo];
1997
+ debug(`[${this._sessionId}]: Current playhead position (${vodMediaSeqVideo}): ${roundToThreeDecimals(playheadPositions[vodMediaSeqVideo])}`);
1998
+ return playheadPositions[vodMediaSeqVideo];
1986
1999
  }
1987
2000
  async _getAudioPlayheadPosition(seqIdx) {
1988
2001
  const currentVod = await this._sessionState.getCurrentVod();
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyevinn-channel-engine",
3
- "version": "5.1.1",
3
+ "version": "5.1.3",
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
@@ -579,7 +579,7 @@ export class ChannelEngine {
579
579
  }
580
580
 
581
581
  listen(port) {
582
- this.server.listen({ port: port }, (err) => {
582
+ this.server.listen({ port: port, host: '0.0.0.0' }, (err) => {
583
583
  if (err) {
584
584
  console.error(err);
585
585
  process.exit(1);
package/engine/session.js CHANGED
@@ -756,7 +756,11 @@ class Session {
756
756
  let playheadAudio;
757
757
  let playheadSubtitle;
758
758
 
759
- playheadPosVideoMs = (await this._getCurrentPlayheadPosition()) * 1000;
759
+ // Pass the locally-updated vodMediaSeqVideo (leader incremented above) so
760
+ // playhead position reflects this tick's video segment, not the stale
761
+ // value still in Redis. Without this, audio/subtitle stay 1 segment
762
+ // behind video for the entire VOD lifetime.
763
+ playheadPosVideoMs = (await this._getCurrentPlayheadPosition(sessionState.vodMediaSeqVideo)) * 1000;
760
764
 
761
765
  if (this.use_demuxed_audio) {
762
766
  const audioSeqLastIdx = currentVod.getLiveMediaSequencesCount("audio") - 1;
@@ -2068,12 +2072,21 @@ class Session {
2068
2072
  return 0;
2069
2073
  }
2070
2074
 
2071
- async _getCurrentPlayheadPosition() {
2072
- const sessionState = await this._sessionState.getValues(["vodMediaSeqVideo"]);
2075
+ async _getCurrentPlayheadPosition(overrideVodMediaSeqVideo) {
2076
+ // Caller can pass the in-progress local vodMediaSeqVideo to avoid the Redis
2077
+ // round-trip and the race where the leader has incremented its local value
2078
+ // but hasn't written it to Redis yet (incrementAsync writes happen later via
2079
+ // a parallel Promise.all). Falling back to Redis preserves the old behavior
2080
+ // for callers like startPlayheadAsync that run after incrementAsync.
2081
+ let vodMediaSeqVideo = overrideVodMediaSeqVideo;
2082
+ if (vodMediaSeqVideo === undefined) {
2083
+ const sessionState = await this._sessionState.getValues(["vodMediaSeqVideo"]);
2084
+ vodMediaSeqVideo = sessionState.vodMediaSeqVideo;
2085
+ }
2073
2086
  const currentVod = await this._sessionState.getCurrentVod();
2074
2087
  const playheadPositions = currentVod.getPlayheadPositions();
2075
- debug(`[${this._sessionId}]: Current playhead position (${sessionState.vodMediaSeqVideo}): ${roundToThreeDecimals(playheadPositions[sessionState.vodMediaSeqVideo])}`);
2076
- return playheadPositions[sessionState.vodMediaSeqVideo];
2088
+ debug(`[${this._sessionId}]: Current playhead position (${vodMediaSeqVideo}): ${roundToThreeDecimals(playheadPositions[vodMediaSeqVideo])}`);
2089
+ return playheadPositions[vodMediaSeqVideo];
2077
2090
  }
2078
2091
 
2079
2092
  async _getAudioPlayheadPosition(seqIdx) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyevinn-channel-engine",
3
- "version": "5.1.1",
3
+ "version": "5.1.3",
4
4
  "description": "OTT TV Channel Engine",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",