Skip to content

Commit

Permalink
buffer-helper: correctly report bufferInfo when current time is locat…
Browse files Browse the repository at this point in the history
…ed before buffered ranges, but within maxHoleDuration range

if media buffered : [10,40] , maxHoleDuration = 2s, and pos = 9s,
bufferInfo was
{ len : 31, start : 10, end : 40, nextStart : undefined }
whereas it should be
{ len : 0, start : 9, end : 9, nextStart : 10 }
we need to report the area as not buffered so that stream-controller will start loading fragment as needed
  • Loading branch information
mangui committed May 3, 2016
1 parent 60a7ec8 commit ffb6ec6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/helper/buffer-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ class BufferHelper {
buffered2.push(buffered[i]);
}
}

// in case current position is located before buffered time ranges, report area as not buffered
if (buffered2.length && pos < buffered2[0].start) {
return {len: 0, start: pos, end: pos, nextStart : buffered2[0].start};
}

for (i = 0, bufferLen = 0, bufferStart = bufferEnd = pos; i < buffered2.length; i++) {
var start = buffered2[i].start,
end = buffered2[i].end;
Expand Down

0 comments on commit ffb6ec6

Please sign in to comment.