hls.js 1.6.0-beta.1.0.canary.10752 → 1.6.0-beta.1.0.canary.10754

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -400,7 +400,7 @@ function enableLogs(debugConfig, context, id) {
400
400
  // Some browsers don't allow to use bind on console object anyway
401
401
  // fallback to default if needed
402
402
  try {
403
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.1.0.canary.10752"}`);
403
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.1.0.canary.10754"}`);
404
404
  } catch (e) {
405
405
  /* log fn threw an exception. All logger methods are no-ops. */
406
406
  return createLogger();
@@ -17005,47 +17005,51 @@ class XhrLoader {
17005
17005
  xhr.onprogress = null;
17006
17006
  const status = xhr.status;
17007
17007
  // http status between 200 to 299 are all successful
17008
- const useResponse = xhr.responseType !== 'text';
17009
- if (status >= 200 && status < 300 && (useResponse && xhr.response || xhr.responseText !== null)) {
17010
- stats.loading.end = Math.max(self.performance.now(), stats.loading.first);
17011
- const data = useResponse ? xhr.response : xhr.responseText;
17012
- const len = xhr.responseType === 'arraybuffer' ? data.byteLength : data.length;
17013
- stats.loaded = stats.total = len;
17014
- stats.bwEstimate = stats.total * 8000 / (stats.loading.end - stats.loading.first);
17015
- if (!this.callbacks) {
17016
- return;
17017
- }
17018
- const onProgress = this.callbacks.onProgress;
17019
- if (onProgress) {
17020
- onProgress(stats, context, data, xhr);
17021
- }
17022
- if (!this.callbacks) {
17008
+ const useResponseText = xhr.responseType === 'text' ? xhr.responseText : null;
17009
+ if (status >= 200 && status < 300) {
17010
+ const data = useResponseText != null ? useResponseText : xhr.response;
17011
+ if (data != null) {
17012
+ stats.loading.end = Math.max(self.performance.now(), stats.loading.first);
17013
+ const len = xhr.responseType === 'arraybuffer' ? data.byteLength : data.length;
17014
+ stats.loaded = stats.total = len;
17015
+ stats.bwEstimate = stats.total * 8000 / (stats.loading.end - stats.loading.first);
17016
+ if (!this.callbacks) {
17017
+ return;
17018
+ }
17019
+ const onProgress = this.callbacks.onProgress;
17020
+ if (onProgress) {
17021
+ onProgress(stats, context, data, xhr);
17022
+ }
17023
+ if (!this.callbacks) {
17024
+ return;
17025
+ }
17026
+ const _response = {
17027
+ url: xhr.responseURL,
17028
+ data: data,
17029
+ code: status
17030
+ };
17031
+ this.callbacks.onSuccess(_response, stats, context, xhr);
17023
17032
  return;
17024
17033
  }
17025
- const response = {
17026
- url: xhr.responseURL,
17027
- data: data,
17028
- code: status
17029
- };
17030
- this.callbacks.onSuccess(response, stats, context, xhr);
17034
+ }
17035
+
17036
+ // Handle bad status or nullish response
17037
+ const retryConfig = config.loadPolicy.errorRetry;
17038
+ const retryCount = stats.retry;
17039
+ // if max nb of retries reached or if http status between 400 and 499 (such error cannot be recovered, retrying is useless), return error
17040
+ const response = {
17041
+ url: context.url,
17042
+ data: undefined,
17043
+ code: status
17044
+ };
17045
+ if (shouldRetry(retryConfig, retryCount, false, response)) {
17046
+ this.retry(retryConfig);
17031
17047
  } else {
17032
- const retryConfig = config.loadPolicy.errorRetry;
17033
- const retryCount = stats.retry;
17034
- // if max nb of retries reached or if http status between 400 and 499 (such error cannot be recovered, retrying is useless), return error
17035
- const response = {
17036
- url: context.url,
17037
- data: undefined,
17038
- code: status
17039
- };
17040
- if (shouldRetry(retryConfig, retryCount, false, response)) {
17041
- this.retry(retryConfig);
17042
- } else {
17043
- logger.error(`${status} while loading ${context.url}`);
17044
- this.callbacks.onError({
17045
- code: status,
17046
- text: xhr.statusText
17047
- }, context, xhr, stats);
17048
- }
17048
+ logger.error(`${status} while loading ${context.url}`);
17049
+ this.callbacks.onError({
17050
+ code: status,
17051
+ text: xhr.statusText
17052
+ }, context, xhr, stats);
17049
17053
  }
17050
17054
  }
17051
17055
  }
@@ -19083,7 +19087,7 @@ class GapController extends Logger {
19083
19087
  }
19084
19088
  }
19085
19089
 
19086
- const version = "1.6.0-beta.1.0.canary.10752";
19090
+ const version = "1.6.0-beta.1.0.canary.10754";
19087
19091
 
19088
19092
  // ensure the worker ends up in the bundle
19089
19093
  // If the worker should not be included this gets aliased to empty.js