hls.js 1.6.0-beta.2.0.canary.10871 → 1.6.0-beta.2.0.canary.10873

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.
@@ -113,7 +113,7 @@ class XhrLoader implements Loader<LoaderContext> {
113
113
  })
114
114
  .catch((error: Error) => {
115
115
  // IE11 throws an exception on xhr.open if attempting to access an HTTP resource over HTTPS
116
- this.callbacks!.onError(
116
+ this.callbacks?.onError(
117
117
  { code: xhr.status, text: error.message },
118
118
  context,
119
119
  xhr,
@@ -220,23 +220,16 @@ class XhrLoader implements Loader<LoaderContext> {
220
220
  stats.loaded = stats.total = len;
221
221
  stats.bwEstimate =
222
222
  (stats.total * 8000) / (stats.loading.end - stats.loading.first);
223
- if (!this.callbacks) {
224
- return;
225
- }
226
- const onProgress = this.callbacks.onProgress;
223
+ const onProgress = this.callbacks?.onProgress;
227
224
  if (onProgress) {
228
225
  onProgress(stats, context, data, xhr);
229
226
  }
230
- if (!this.callbacks) {
231
- return;
232
- }
233
227
  const response: LoaderResponse = {
234
228
  url: xhr.responseURL,
235
229
  data: data,
236
230
  code: status,
237
231
  };
238
-
239
- this.callbacks.onSuccess(response, stats, context, xhr);
232
+ this.callbacks?.onSuccess(response, stats, context, xhr);
240
233
  return;
241
234
  }
242
235
  }
@@ -254,7 +247,7 @@ class XhrLoader implements Loader<LoaderContext> {
254
247
  this.retry(retryConfig);
255
248
  } else {
256
249
  logger.error(`${status} while loading ${context.url}`);
257
- this.callbacks!.onError(
250
+ this.callbacks?.onError(
258
251
  { code: status, text: xhr.statusText },
259
252
  context,
260
253
  xhr,