hls.js icon indicating copy to clipboard operation
hls.js copied to clipboard

v0.7.4 release build does not contain the right code

Open thedomi opened this issue 9 years ago • 1 comments

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();
}

thedomi avatar Mar 30 '17 14:03 thedomi

indeed, not clear about what happened, we will double check that for next release

mangui avatar Apr 02 '17 06:04 mangui