Skip to content

Commit

Permalink
fix: add subtitle media sequence data to insertSlate (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nfrederiksen authored Dec 8, 2023
1 parent 2f6baed commit fcffe9e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion engine/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -1071,32 +1071,40 @@ class Session {
console.error(`[${this._sessionId}]: Will insert slate`);
const slateVod = await this._loadSlate(currentVod);
debug(`[${this._sessionId}]: slate loaded`);
let sessionState = await this._sessionState.getValues(["slateCount", "mediaSeq", "discSeq", "mediaSeqAudio", "discSeqAudio"]);
let sessionState = await this._sessionState.getValues(["slateCount", "mediaSeq", "discSeq", "mediaSeqAudio", "discSeqAudio", "mediaSeqSubtitle", "discSeqSubtitle"]);
let endValue = 0;
let endValueAudio = 0;
let endValueSubtitle = 0;
let lastDiscontinuity = 0;
let lastDiscontinuityAudio = 0;
let lastDiscontinuitySubtitle = 0;
if (currentVod) {
if (currentVod.sequenceAlwaysContainNewSegments) {
endValue = currentVod.getLastSequenceMediaSequenceValue();
endValueAudio = currentVod.getLastSequenceMediaSequenceValueAudio();
endValueSubtitle = currentVod.getLastSequenceMediaSequenceValueSubtitle();
} else {
endValue = currentVod.getLiveMediaSequencesCount();
endValueAudio = currentVod.getLiveMediaSequencesCount("audio");
endValueSubtitle = currentVod.getLiveMediaSequencesCount("subtitle");
}
lastDiscontinuity = currentVod.getLastDiscontinuity();
lastDiscontinuityAudio = currentVod.getLastDiscontinuityAudio();
lastDiscontinuitySubtitle = currentVod.getLastDiscontinuitySubtitle();
}
const isLeader = await this._sessionStateStore.isLeader(this._instanceId);

const updatedSessionState = await this._sessionState.setValues({
"vodMediaSeqVideo": 0,
"vodMediaSeqAudio": 0,
"vodMediaSeqSubtitle": 0,
"state": SessionState.VOD_NEXT_INITIATING,
"mediaSeq": sessionState.mediaSeq + endValue,
"mediaSeqAudio": sessionState.mediaSeqAudio + endValueAudio,
"mediaSeqSubtitle": sessionState.mediaSeqSubtitle + endValueAudio,
"discSeq": sessionState.discSeq + lastDiscontinuity,
"discSeqAudio": sessionState.discSeqAudio + lastDiscontinuityAudio,
"discSeqSubtitle": sessionState.discSeqSubtitle + lastDiscontinuitySubtitle,
"slateCount": sessionState.slateCount + 1
});
sessionState = { ...sessionState, ...updatedSessionState };
Expand Down

0 comments on commit fcffe9e

Please sign in to comment.