Skip to content

Commit

Permalink
Fix regression introduced in PR#3285 (live delay was not computed in …
Browse files Browse the repository at this point in the history
…case start time was provided in uri parameters) (#3314)
  • Loading branch information
Bertrand Berthelot committed Jun 26, 2020
1 parent dea628c commit 69942ef
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/streaming/controllers/StreamController.js
Expand Up @@ -650,6 +650,13 @@ function StreamController() {
}

if (!activeStream) {
if (adapter.getIsDynamic() && streams.length) {
// Compute and set live delay
const manifestInfo = streamsInfo[0].manifestInfo;
const fragmentDuration = getFragmentDurationForLiveDelayCalculation(streamsInfo, manifestInfo);
playbackController.computeAndSetLiveDelay(fragmentDuration, manifestInfo.DVRWindowSize, manifestInfo.minBufferTime);
}

// we need to figure out what the correct starting period is
const startTimeFormUriParameters = playbackController.getStartTimeFromUriParameters();
let initialStream = null;
Expand All @@ -676,11 +683,8 @@ function StreamController() {

function getInitialStream() {
try {
const streamInfos = adapter.getStreamsInfo(undefined);
const manifestInfo = streamInfos[0].manifestInfo;
const liveEdge = timelineConverter.calcPresentationTimeFromWallTime(new Date(), adapter.getRegularPeriods()[0]);
const fragmentDuration = getFragmentDurationForLiveDelayCalculation(streamInfos, manifestInfo);
const targetDelay = playbackController.computeAndSetLiveDelay(fragmentDuration, manifestInfo.DVRWindowSize, manifestInfo.minBufferTime);
const targetDelay = playbackController.getLiveDelay();
const targetTime = liveEdge - targetDelay;

return getStreamForTime(targetTime);
Expand Down

0 comments on commit 69942ef

Please sign in to comment.