Skip to content

Commit

Permalink
Don't go into a buffering state while paused.
Browse files Browse the repository at this point in the history
Closes #61

Change-Id: I46ce7b97b6058797ba643b77ccf72399dadc9765
  • Loading branch information
Timothy Drews committed Apr 20, 2015
1 parent 1e70b2d commit ecc1f80
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/player/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -848,8 +848,10 @@ shaka.player.Player.prototype.onWatchdogTimer_ = function() {
var fudgedBufferEnd = bufferEnd + shaka.player.Player.BUFFERED_FUDGE_FACTOR_;

if (!this.buffering_) {
// Don't go into a buffering state at the end of the video.
if (fudgedBufferEnd < this.video_.duration && buffered < threshold) {
// Don't go into a buffering state while paused or when at the end of the
// video.
if ((fudgedBufferEnd < this.video_.duration && buffered < threshold) &&
!this.video_.paused) {
this.enterBufferingState_();
}
} else {
Expand Down
30 changes: 30 additions & 0 deletions spec/player_integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,36 @@ describe('Player', function() {
});
});

it('respects autoplay=true', function(done) {
video.autoplay = true;

player.load(newSource(plainManifest)).then(function() {
return waitForMovement();
}).then(function() {
expect(video.currentTime).toBeGreaterThan(0.0);
expect(video.paused).toBe(false);
done();
}).catch(function(error) {
fail(error);
done();
});
});

it('respects autoplay=false', function(done) {
video.autoplay = false;

player.load(newSource(plainManifest)).then(function() {
return delay(4);
}).then(function() {
expect(video.currentTime).toBe(0);
expect(video.paused).toBe(true);
done();
}).catch(function(error) {
fail(error);
done();
});
});

// TODO(story 1970528): add tests which exercise PSSH parsing,
// SegmentTemplate resolution, and SegmentList generation.

Expand Down

0 comments on commit ecc1f80

Please sign in to comment.