Skip to content

Commit

Permalink
Fix buffering state for live streams
Browse files Browse the repository at this point in the history
We can't buffer past the live edge, so we must account for the live
edge in buffering state calculations.

Closes #636

Change-Id: I099e68291786a462dfb63471a2eb9974643e75bd
  • Loading branch information
joeyparrish committed Jan 6, 2017
1 parent efd23d4 commit 582d34b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/media/playhead.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,12 @@ shaka.media.Playhead.prototype.onWatchdogTimer_ = function() {
var fudgeFactor = shaka.media.Playhead.FUDGE_FACTOR_;
var threshold = shaka.media.Playhead.UNDERFLOW_THRESHOLD_;

var duration = this.video_.duration - fudgeFactor;
var duration;
if (this.timeline_.isLive()) {
duration = this.timeline_.getSegmentAvailabilityEnd() - fudgeFactor;
} else {
duration = this.video_.duration - fudgeFactor;
}

var atEnd = (bufferEnd >= duration) || (this.video_.ended);
if (!this.buffering_) {
Expand Down

0 comments on commit 582d34b

Please sign in to comment.