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.
- package/dist/engine/server.js +1 -1
- package/dist/engine/session.d.ts +1 -1
- package/dist/engine/session.js +18 -5
- package/dist/package.json +1 -1
- package/engine/server.ts +1 -1
- package/engine/session.js +18 -5
- package/package.json +1 -1
package/dist/engine/server.js
CHANGED
package/dist/engine/session.d.ts
CHANGED
|
@@ -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>;
|
package/dist/engine/session.js
CHANGED
|
@@ -714,7 +714,11 @@ class Session {
|
|
|
714
714
|
let playheadPosVideoMs;
|
|
715
715
|
let playheadAudio;
|
|
716
716
|
let playheadSubtitle;
|
|
717
|
-
|
|
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
|
-
|
|
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 (${
|
|
1985
|
-
return playheadPositions[
|
|
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
package/engine/server.ts
CHANGED
package/engine/session.js
CHANGED
|
@@ -756,7 +756,11 @@ class Session {
|
|
|
756
756
|
let playheadAudio;
|
|
757
757
|
let playheadSubtitle;
|
|
758
758
|
|
|
759
|
-
|
|
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
|
-
|
|
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 (${
|
|
2076
|
-
return playheadPositions[
|
|
2088
|
+
debug(`[${this._sessionId}]: Current playhead position (${vodMediaSeqVideo}): ${roundToThreeDecimals(playheadPositions[vodMediaSeqVideo])}`);
|
|
2089
|
+
return playheadPositions[vodMediaSeqVideo];
|
|
2077
2090
|
}
|
|
2078
2091
|
|
|
2079
2092
|
async _getAudioPlayheadPosition(seqIdx) {
|