I have the following function:
var progress = function(n, v0, derivativeSum) {
var v1 = stimulus.prop("buffered").end(0);
if(v0 == null) {
setTimeout(function() {progress(++n, v1, 0)}, 50);
return;
}
console.log("buffered: " + v1);
console.log("buff.length " + stimulus.prop("buffered").length);
derivativeSum += v1 - v0;
// In seconds
averageRate = derivativeSum / (n * .05);
// In seconds
timeleftToDownload = (duration - v1) / averageRate;
console.log(timeleftToDownload + " < " + v1);
console.log("average rate: " + averageRate);
if (timeleftToDownload < v1 / 20) {
showPlayButton();
return;
}
// Callback 50 millisecond delay
setTimeout(function() {progress(++n, v1, derivativeSum)}, 50);
};
This is just test code, so the logic doesn't need to make sense. However I'm trying to just get how many seconds of the video has loaded, since I can compare that to the duration of the video which I'm getting in loadmetadata.
// Should be the length of the video buffered, example: 2304 seconds
var v1 = stimulus.prop("buffered").end(0);
However v1 seems to cap out at 128. Since I have a very long video, it should obviously be much longer. What is .end(0) even returning?