Prevent loading first segment of live manifest - seek to and load segment at current time (#839)
* load after seeking to current time * fix tests to load/remove segment at current time vs first segment
Showing
2 changed files
with
9 additions
and
12 deletions
... | @@ -675,8 +675,6 @@ export class MasterPlaylistController extends videojs.EventTarget { | ... | @@ -675,8 +675,6 @@ export class MasterPlaylistController extends videojs.EventTarget { |
675 | // 4) the player has not started playing | 675 | // 4) the player has not started playing |
676 | !this.hasPlayed_) { | 676 | !this.hasPlayed_) { |
677 | 677 | ||
678 | this.load(); | ||
679 | |||
680 | // trigger the playlist loader to start "expired time"-tracking | 678 | // trigger the playlist loader to start "expired time"-tracking |
681 | this.masterPlaylistLoader_.trigger('firstplay'); | 679 | this.masterPlaylistLoader_.trigger('firstplay'); |
682 | this.hasPlayed_ = true; | 680 | this.hasPlayed_ = true; |
... | @@ -687,6 +685,9 @@ export class MasterPlaylistController extends videojs.EventTarget { | ... | @@ -687,6 +685,9 @@ export class MasterPlaylistController extends videojs.EventTarget { |
687 | this.tech_.setCurrentTime(seekable.end(0)); | 685 | this.tech_.setCurrentTime(seekable.end(0)); |
688 | } | 686 | } |
689 | 687 | ||
688 | // now that we seeked to the current time, load the segment | ||
689 | this.load(); | ||
690 | |||
690 | return true; | 691 | return true; |
691 | } | 692 | } |
692 | return false; | 693 | return false; | ... | ... |
... | @@ -1948,11 +1948,8 @@ QUnit.test('cleans up the buffer when loading live segments', function() { | ... | @@ -1948,11 +1948,8 @@ QUnit.test('cleans up the buffer when loading live segments', function() { |
1948 | }; | 1948 | }; |
1949 | this.player.tech_.trigger('play'); | 1949 | this.player.tech_.trigger('play'); |
1950 | 1950 | ||
1951 | this.clock.tick(1); | 1951 | // request first playable segment |
1952 | // this.requests[1] is an aborted XHR | 1952 | standardXHRResponse(this.requests[1]); |
1953 | // since we are in a live stream that request is aborted by | ||
1954 | // the seek-to-live behavior | ||
1955 | standardXHRResponse(this.requests[2]); | ||
1956 | 1953 | ||
1957 | QUnit.strictEqual(this.requests[0].url, 'liveStart30sBefore.m3u8', | 1954 | QUnit.strictEqual(this.requests[0].url, 'liveStart30sBefore.m3u8', |
1958 | 'master playlist requested'); | 1955 | 'master playlist requested'); |
... | @@ -2003,14 +2000,13 @@ QUnit.test('cleans up the buffer based on currentTime when loading a live segmen | ... | @@ -2003,14 +2000,13 @@ QUnit.test('cleans up the buffer based on currentTime when loading a live segmen |
2003 | }; | 2000 | }; |
2004 | 2001 | ||
2005 | this.player.tech_.trigger('play'); | 2002 | this.player.tech_.trigger('play'); |
2006 | this.clock.tick(1); | 2003 | |
2007 | // Change seekable so that it starts *after* the currentTime which was set | 2004 | // Change seekable so that it starts *after* the currentTime which was set |
2008 | // based on the previous seekable range (the end of 80) | 2005 | // based on the previous seekable range (the end of 80) |
2009 | seekable = videojs.createTimeRanges([[100, 120]]); | 2006 | seekable = videojs.createTimeRanges([[100, 120]]); |
2010 | // this.requests[1] is an aborted XHR | 2007 | |
2011 | // since we are in a live stream that request is aborted by | 2008 | // request first playable segment |
2012 | // the seek-to-live behavior | 2009 | standardXHRResponse(this.requests[1]); |
2013 | standardXHRResponse(this.requests[2]); | ||
2014 | 2010 | ||
2015 | QUnit.strictEqual(this.requests[0].url, 'liveStart30sBefore.m3u8', 'master playlist requested'); | 2011 | QUnit.strictEqual(this.requests[0].url, 'liveStart30sBefore.m3u8', 'master playlist requested'); |
2016 | QUnit.equal(removes.length, 1, 'remove called'); | 2012 | QUnit.equal(removes.length, 1, 'remove called'); | ... | ... |
-
Please register or sign in to post a comment