Skip to content

Commit

Permalink
fix: Avoid notify buffered changes when segment appended is text (#7353)
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad committed Sep 24, 2024
1 parent f0903a6 commit 2936dea
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -7057,27 +7057,28 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
* @private
*/
onSegmentAppended_(start, end, contentType, isMuxed) {
// When we append a segment to media source (via streaming engine) we are
// changing what data we have buffered, so notify the playhead of the
// change.
if (this.playhead_) {
this.playhead_.notifyOfBufferingChange();
// Skip the initial buffer gap
const startTime = this.mediaSourceEngine_.bufferStart(contentType);
const ContentType = shaka.util.ManifestParserUtils.ContentType;
if (
!this.isLive() &&
// If not paused then GapJumpingController will handle this gap.
this.video_.paused &&
startTime != null &&
contentType != ContentType.TEXT &&
startTime > 0 &&
this.playhead_.getTime() < startTime
) {
this.playhead_.setStartTime(startTime);
}
}
this.pollBufferState_();
const ContentType = shaka.util.ManifestParserUtils.ContentType;
if (contentType != ContentType.TEXT) {
// When we append a segment to media source (via streaming engine) we are
// changing what data we have buffered, so notify the playhead of the
// change.
if (this.playhead_) {
this.playhead_.notifyOfBufferingChange();
// Skip the initial buffer gap
const startTime = this.mediaSourceEngine_.bufferStart(contentType);
if (
!this.isLive() &&
// If not paused then GapJumpingController will handle this gap.
this.video_.paused &&
startTime != null &&
startTime > 0 &&
this.playhead_.getTime() < startTime
) {
this.playhead_.setStartTime(startTime);
}
}
this.pollBufferState_();
}

// Dispatch an event for users to consume, too.
const data = new Map()
Expand Down

0 comments on commit 2936dea

Please sign in to comment.