mirror of
https://github.com/videojs/video.js.git
synced 2024-12-12 11:15:04 +02:00
feat: resets pastSeekEnd_ variable. (#6249)
* feat: resets pastSeekEnd_ when its value is much higher than seeking increment. * fixes unit tests
This commit is contained in:
parent
4f8c4988d2
commit
ccca846da8
@ -88,7 +88,13 @@ class LiveTracker extends Component {
|
||||
this.trigger('seekableendchange');
|
||||
}
|
||||
|
||||
this.pastSeekEnd_ = this.pastSeekEnd() + 0.03;
|
||||
// we should reset pastSeekEnd when the value
|
||||
// is much higher than seeking increment.
|
||||
if (this.pastSeekEnd() > this.seekableIncrement_ * 1.5) {
|
||||
this.pastSeekEnd_ = 0;
|
||||
} else {
|
||||
this.pastSeekEnd_ = this.pastSeekEnd() + 0.03;
|
||||
}
|
||||
|
||||
if (this.isBehind_() !== this.behindLiveEdge()) {
|
||||
this.behindLiveEdge_ = this.isBehind_();
|
||||
|
@ -68,9 +68,12 @@ QUnit.module('LiveTracker', () => {
|
||||
QUnit.test('Triggers liveedgechange when we fall behind and catch up', function(assert) {
|
||||
|
||||
this.liveTracker.seekableIncrement_ = 6;
|
||||
this.player.seekable = () => createTimeRanges(0, 20);
|
||||
this.player.trigger('timeupdate');
|
||||
this.player.currentTime = () => 0;
|
||||
this.clock.tick(20000);
|
||||
this.player.currentTime = () => 14;
|
||||
this.clock.tick(6000);
|
||||
this.player.seekable = () => createTimeRanges(0, 26);
|
||||
this.clock.tick(1000);
|
||||
|
||||
assert.equal(this.liveEdgeChanges, 1, 'should have one live edge change');
|
||||
assert.ok(this.liveTracker.behindLiveEdge(), 'behind live edge');
|
||||
@ -99,6 +102,7 @@ QUnit.module('LiveTracker', () => {
|
||||
QUnit.test('seeks to live edge on seekableendchange', function(assert) {
|
||||
this.player.trigger('timeupdate');
|
||||
|
||||
this.player.seekable = () => createTimeRanges(0, 6);
|
||||
this.liveTracker.seekableIncrement_ = 2;
|
||||
let currentTime = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user