Skip to content

Commit

Permalink
fix(FEC-11409): many shaka warnings printed in the log (#163)
Browse files Browse the repository at this point in the history
use `seekRange().end` insteaf of `getSegmentAvailabilityEnd()`
  • Loading branch information
yairans committed Jul 25, 2021
1 parent c9ea3f8 commit 081cb8d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
10 changes: 2 additions & 8 deletions src/dash-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ export default class DashAdapter extends BaseMediaSourceAdapter {
*/
seekToLiveEdge(): void {
if (this._shaka && this._videoElement.readyState > 0) {
this._videoElement.currentTime = this._shaka.seekRange().end;
this._videoElement.currentTime = this._getLiveEdge();
}
}

Expand Down Expand Up @@ -1298,14 +1298,8 @@ export default class DashAdapter extends BaseMediaSourceAdapter {
get targetBuffer(): number {
let targetBufferVal = NaN;
if (!this._shaka) return NaN;
const manifest = this._shaka.getManifest();
if (this.isLive()) {
if (manifest && manifest.presentationTimeline) {
targetBufferVal =
manifest.presentationTimeline.getSegmentAvailabilityEnd() -
this._shaka.seekRange().end -
(this._videoElement.currentTime - this._getLiveEdge());
}
targetBufferVal = this._getLiveEdge() - this._videoElement.currentTime;
} else {
// consideration of the end of the playback in the target buffer calc
targetBufferVal = this._videoElement.duration - this._videoElement.currentTime;
Expand Down
11 changes: 2 additions & 9 deletions test/src/dash-adapter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,7 @@ describe('DashAdapter: targetBuffer', () => {
Utils.Object.mergeDeep(config, {playback: {options: {html5: {dash: {streaming: {bufferingGoal: 120}}}}}})
);
video.addEventListener(EventType.PLAYING, () => {
let targetBufferVal =
dashInstance._shaka.getManifest().presentationTimeline.getSegmentAvailabilityEnd() -
dashInstance._shaka.getManifest().presentationTimeline.getSeekRangeEnd() -
(video.currentTime - dashInstance._getLiveEdge());

let targetBufferVal = dashInstance._getLiveEdge() - video.currentTime;
Math.round(dashInstance.targetBuffer - targetBufferVal).should.equal(0);
done();
});
Expand All @@ -359,10 +355,7 @@ describe('DashAdapter: targetBuffer', () => {
Utils.Object.mergeDeep(config, {playback: {options: {html5: {dash: {streaming: {bufferingGoal: 10}}}}}})
);
video.addEventListener(EventType.PLAYING, () => {
let targetBufferVal =
dashInstance._shaka.getConfiguration().streaming.bufferingGoal +
dashInstance._shaka.getManifest().presentationTimeline.getMaxSegmentDuration();

let targetBufferVal = dashInstance._getLiveEdge() - video.currentTime;
Math.round(dashInstance.targetBuffer - targetBufferVal).should.equal(0);
done();
});
Expand Down

0 comments on commit 081cb8d

Please sign in to comment.