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.
package/dist/hls.mjs CHANGED
@@ -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();
@@ -9774,7 +9774,7 @@ var eventemitter3 = {exports: {}};
9774
9774
  var eventemitter3Exports = eventemitter3.exports;
9775
9775
  var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
9776
9776
 
9777
- const version = "1.6.0-beta.1.0.canary.10752";
9777
+ const version = "1.6.0-beta.1.0.canary.10754";
9778
9778
 
9779
9779
  // ensure the worker ends up in the bundle
9780
9780
  // If the worker should not be included this gets aliased to empty.js
@@ -17360,12 +17360,16 @@ class AudioTrackController extends BasePlaylistController {
17360
17360
  return -1;
17361
17361
  }
17362
17362
  loadPlaylist(hlsUrlParameters) {
17363
+ var _this$hls$levels$this;
17363
17364
  const audioTrack = this.currentTrack;
17364
- if (this.shouldLoadPlaylist(audioTrack) && audioTrack) {
17365
+ if (!audioTrack) {
17366
+ return;
17367
+ }
17368
+ let url = audioTrack.url;
17369
+ if (this.shouldLoadPlaylist(audioTrack) && url !== ((_this$hls$levels$this = this.hls.levels[this.hls.loadLevel]) == null ? void 0 : _this$hls$levels$this.uri)) {
17365
17370
  super.loadPlaylist();
17366
17371
  const id = audioTrack.id;
17367
17372
  const groupId = audioTrack.groupId;
17368
- let url = audioTrack.url;
17369
17373
  if (hlsUrlParameters) {
17370
17374
  try {
17371
17375
  url = hlsUrlParameters.addDirectives(url);
@@ -28993,47 +28997,51 @@ class XhrLoader {
28993
28997
  xhr.onprogress = null;
28994
28998
  const status = xhr.status;
28995
28999
  // http status between 200 to 299 are all successful
28996
- const useResponse = xhr.responseType !== 'text';
28997
- if (status >= 200 && status < 300 && (useResponse && xhr.response || xhr.responseText !== null)) {
28998
- stats.loading.end = Math.max(self.performance.now(), stats.loading.first);
28999
- const data = useResponse ? xhr.response : xhr.responseText;
29000
- const len = xhr.responseType === 'arraybuffer' ? data.byteLength : data.length;
29001
- stats.loaded = stats.total = len;
29002
- stats.bwEstimate = stats.total * 8000 / (stats.loading.end - stats.loading.first);
29003
- if (!this.callbacks) {
29004
- return;
29005
- }
29006
- const onProgress = this.callbacks.onProgress;
29007
- if (onProgress) {
29008
- onProgress(stats, context, data, xhr);
29009
- }
29010
- if (!this.callbacks) {
29000
+ const useResponseText = xhr.responseType === 'text' ? xhr.responseText : null;
29001
+ if (status >= 200 && status < 300) {
29002
+ const data = useResponseText != null ? useResponseText : xhr.response;
29003
+ if (data != null) {
29004
+ stats.loading.end = Math.max(self.performance.now(), stats.loading.first);
29005
+ const len = xhr.responseType === 'arraybuffer' ? data.byteLength : data.length;
29006
+ stats.loaded = stats.total = len;
29007
+ stats.bwEstimate = stats.total * 8000 / (stats.loading.end - stats.loading.first);
29008
+ if (!this.callbacks) {
29009
+ return;
29010
+ }
29011
+ const onProgress = this.callbacks.onProgress;
29012
+ if (onProgress) {
29013
+ onProgress(stats, context, data, xhr);
29014
+ }
29015
+ if (!this.callbacks) {
29016
+ return;
29017
+ }
29018
+ const _response = {
29019
+ url: xhr.responseURL,
29020
+ data: data,
29021
+ code: status
29022
+ };
29023
+ this.callbacks.onSuccess(_response, stats, context, xhr);
29011
29024
  return;
29012
29025
  }
29013
- const response = {
29014
- url: xhr.responseURL,
29015
- data: data,
29016
- code: status
29017
- };
29018
- this.callbacks.onSuccess(response, stats, context, xhr);
29026
+ }
29027
+
29028
+ // Handle bad status or nullish response
29029
+ const retryConfig = config.loadPolicy.errorRetry;
29030
+ const retryCount = stats.retry;
29031
+ // if max nb of retries reached or if http status between 400 and 499 (such error cannot be recovered, retrying is useless), return error
29032
+ const response = {
29033
+ url: context.url,
29034
+ data: undefined,
29035
+ code: status
29036
+ };
29037
+ if (shouldRetry(retryConfig, retryCount, false, response)) {
29038
+ this.retry(retryConfig);
29019
29039
  } else {
29020
- const retryConfig = config.loadPolicy.errorRetry;
29021
- const retryCount = stats.retry;
29022
- // if max nb of retries reached or if http status between 400 and 499 (such error cannot be recovered, retrying is useless), return error
29023
- const response = {
29024
- url: context.url,
29025
- data: undefined,
29026
- code: status
29027
- };
29028
- if (shouldRetry(retryConfig, retryCount, false, response)) {
29029
- this.retry(retryConfig);
29030
- } else {
29031
- logger.error(`${status} while loading ${context.url}`);
29032
- this.callbacks.onError({
29033
- code: status,
29034
- text: xhr.statusText
29035
- }, context, xhr, stats);
29036
- }
29040
+ logger.error(`${status} while loading ${context.url}`);
29041
+ this.callbacks.onError({
29042
+ code: status,
29043
+ text: xhr.statusText
29044
+ }, context, xhr, stats);
29037
29045
  }
29038
29046
  }
29039
29047
  }