Skip to content

Commit 9c495de

Browse files
committed
Warn when observing "seeked" event with empty buffer
Related to #5274
1 parent b7bb26b commit 9c495de

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/controller/gap-controller.ts

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export default class GapController {
7777
// Clear stalled state when beginning or finishing seeking so that we don't report stalls coming out of a seek
7878
if (beginSeek || seeked) {
7979
this.stalled = null;
80+
return;
8081
}
8182

8283
// The playhead should not be moving

src/controller/stream-controller.ts

+11
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,17 @@ export default class StreamController
557557
this.log(`Media seeked to ${(currentTime as number).toFixed(3)}`);
558558
}
559559

560+
// If seeked was issued before buffer was appended do not tick immediately
561+
const bufferInfo = this.getMainFwdBufferInfo();
562+
if (bufferInfo === null || bufferInfo.len === 0) {
563+
this.warn(
564+
`Main forward buffer length on "seeked" event ${
565+
bufferInfo ? bufferInfo.len : 'empty'
566+
})`
567+
);
568+
return;
569+
}
570+
560571
// tick to speed up FRAG_CHANGED triggering
561572
this.tick();
562573
}

0 commit comments

Comments
 (0)