Skip to content

Commit

Permalink
Merge pull request #3159 from fraunhoferfokus/bugfix-livestreamjump
Browse files Browse the repository at this point in the history
[Fix] Avoid jumps in the livestream when an incorrect currentTime is reported by video element
  • Loading branch information
dsilhavy committed Jan 14, 2020
2 parents 69c3991 + e305e34 commit 3364cbf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/streaming/controllers/PlaybackController.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,14 @@ function PlaybackController() {
const DVRWindow = DVRMetrics ? DVRMetrics.range : null;
let actualTime;

if (!DVRWindow) return NaN;
if (!DVRWindow) {
return NaN;
}
if (currentTime > DVRWindow.end) {
actualTime = Math.max(DVRWindow.end - streamInfo.manifestInfo.minBufferTime * 2, DVRWindow.start);
} else if (currentTime > 0 && currentTime + 0.250 < DVRWindow.start && DVRWindow.start - currentTime > DVRWindow.start - 315360000) {

} else if (currentTime > 0 && currentTime + 0.250 < DVRWindow.start && Math.abs(currentTime - DVRWindow.start) < 315360000) {

// Checking currentTime plus 250ms as the 'timeupdate' is fired with a frequency between 4Hz and 66Hz
// https://developer.mozilla.org/en-US/docs/Web/Events/timeupdate
// http://w3c.github.io/html/single-page.html#offsets-into-the-media-resource
Expand Down

0 comments on commit 3364cbf

Please sign in to comment.