Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

404 Not found message in hls (HTTP Live Streaming)

I am using the following snippets of code in my code base in my hls.js file.

  loadInternal () {
    let xhr, context = this.context;
    xhr = this.loader = new XMLHttpRequest();

    let stats = this.stats;
    stats.tfirst = 0;
    stats.loaded = 0;
    const xhrSetup = this.xhrSetup;

    try {
      if (xhrSetup) {
        try {
          xhrSetup(xhr, context.url);
        } catch (e) {
          // fix xhrSetup: (xhr, url) => {xhr.setRequestHeader("Content-Language", "test");}
          // not working, as xhr.setRequestHeader expects xhr.readyState === OPEN
          xhr.open('GET', context.url, true);
          xhrSetup(xhr, context.url);
        }
      }
      if (!xhr.readyState) {
        xhr.open('GET', context.url, true);    // context.url returns ../_definst_/u7sdeqg19d32m6jv2uoj20bgn3/77361a840b3487468ad276adc99b47d974e47a7a/chunklist_w121969216.m3u8

      }
    } catch (e) {
      // IE11 throws an exception on xhr.open if attempting to access an HTTP resource over HTTPS
      this.callbacks.onError({ code: xhr.status, text: e.message }, context, xhr);
      return;
    }

    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();  // This line is throwing GET 404 Not found 
  }

The above snippets of code is also present in the following link as well. In that link, I have used majority of code in my hls.js file.


Problem Statement:

I am wondering what are the reasons behind the error 404 Not found at line xhr.send().

Error Message:

At line xhr.send() as mentioned in problem statement, I am getting the error message GET 404 not found on console with context.url link (as shown below) left to it.

context.url returns, ../_definst_/u7sdeqg19d32m6jv2uoj20bgn3/77361a840b3487468ad276adc99b47d974e47a7a/chunklist_w121969216.m3u8

Comments