Skip to content

Commit 374ad28

Browse files
committed
Fix live playback on WebOS (#3750)
Reverts some of the changes made in: a66913f (Timeline and multiperiod optimizations (#3413), 2021-04-23)
1 parent 5e31f9f commit 374ad28

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/streaming/controllers/BufferController.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,17 @@ function BufferController(config) {
343343
range = getRangeAt(seekTarget, segmentDuration);
344344
if (!range) return;
345345

346-
if (currentTime < range.start) {
346+
if (Math.abs(currentTime - seekTarget) > segmentDuration) {
347+
// If current video model time is decorrelated from seek target (and appended buffer) then seek video element
348+
// (in case of live streams on some browsers/devices for which we can't set video element time at unavalaible range)
349+
350+
// Check if appended segment is not anterior from seek target (segments timeline/template tolerance)
351+
if (seekTarget <= range.end) {
352+
// Seek video element to seek target or range start if appended buffer starts after seek target (segments timeline/template tolerance)
353+
playbackController.seek(Math.max(seekTarget, range.start), false, true);
354+
seekTarget = NaN;
355+
}
356+
} else if (currentTime < range.start) {
347357
// If appended buffer starts after seek target (segments timeline/template tolerance) then seek to range start
348358
playbackController.seek(range.start, false, true);
349359
seekTarget = NaN;

0 commit comments

Comments
 (0)