hls.js
hls.js copied to clipboard
v0.7.4 release build does not contain the right code
The XhrLoader#loadInternal() function in v0.7.4 hls.js build does not match the v0.7.4 source code.
In v0.7.4 xhr-loader.js, the XhrLoader#loadInternal function:
loadInternal() {
var xhr, context = this.context;
if (typeof XDomainRequest !== 'undefined') {
xhr = this.loader = new XDomainRequest();
} else {
xhr = this.loader = new XMLHttpRequest();
}
let stats = this.stats;
stats.tfirst = 0;
stats.loaded = 0;
if (this.xhrSetup) {
this.xhrSetup(xhr, context.url);
}
if (!xhr.readyState) {
xhr.open('GET', context.url, true);
}
if (context.rangeEnd) {
xhr.setRequestHeader('Range','bytes=' + context.rangeStart + '-' + (context.rangeEnd-1));
}
xhr.onreadystatechange = this.readystatechange.bind(this);
xhr.onprogress = this.loadprogress.bind(this);
xhr.responseType = context.responseType;
// setup timeout before we perform request
this.requestTimeout = window.setTimeout(this.loadtimeout.bind(this), this.config.timeout);
xhr.send();
}
The same function, in v0.7.4 hls.js, (lines 15311 - 15339):
value: function loadInternal() {
var xhr,
context = this.context;
if (typeof XDomainRequest !== 'undefined') {
xhr = this.loader = new XDomainRequest();
} else {
xhr = this.loader = new XMLHttpRequest();
}
xhr.onreadystatechange = this.readystatechange.bind(this);
xhr.onprogress = this.loadprogress.bind(this);
xhr.open('GET', context.url, true);
if (context.rangeEnd) {
xhr.setRequestHeader('Range', 'bytes=' + context.rangeStart + '-' + (context.rangeEnd - 1));
}
xhr.responseType = context.responseType;
var stats = this.stats;
stats.tfirst = 0;
stats.loaded = 0;
if (this.xhrSetup) {
this.xhrSetup(xhr, context.url);
}
// setup timeout before we perform request
this.requestTimeout = window.setTimeout(this.loadtimeout.bind(this), this.config.timeout);
xhr.send();
}
indeed, not clear about what happened, we will double check that for next release