Skip to content

Commit

Permalink
fix(FEC-8711): live in IE has a small jump in the stream after a seco…
Browse files Browse the repository at this point in the history
…nd (#67)

* realying on loaded metadata instead of shaka loaded

* change to readyState > 0

readystate=1 means metadata loaded.

on the first play, it already goes to the live edge.

* fix test
  • Loading branch information
odedhutzler authored Nov 21, 2018
1 parent 3cfeb6b commit ceb4063
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/dash-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -623,10 +623,8 @@ export default class DashAdapter extends BaseMediaSourceAdapter {
* @public
*/
seekToLiveEdge(): void {
if (this._shaka && this._loadPromise) {
this._loadPromise.then(() => {
this._videoElement.currentTime = this._shaka.seekRange().end;
});
if (this._shaka && this._videoElement.readyState > 0) {
this._videoElement.currentTime = this._shaka.seekRange().end;
}
}

Expand Down
8 changes: 4 additions & 4 deletions test/src/dash-adapter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -950,10 +950,10 @@ describe('DashAdapter: seekToLiveEdge', () => {
.load()
.then(() => {
try {
video.currentTime = dashInstance._shaka.seekRange().start;
const initialTimeShift = dashInstance._shaka.seekRange().end - video.currentTime;
dashInstance.seekToLiveEdge();
dashInstance._loadPromise.then(() => {
video.play().then(() => {
video.currentTime = dashInstance._shaka.seekRange().start;
const initialTimeShift = dashInstance._shaka.seekRange().end - video.currentTime;
dashInstance.seekToLiveEdge();
const timeShift = dashInstance._shaka.seekRange().end - video.currentTime;
timeShift.should.be.lessThan(3);
timeShift.should.be.lessThan(initialTimeShift);
Expand Down

0 comments on commit ceb4063

Please sign in to comment.