hls.js 1.5.14-0.canary.10656 → 1.5.14-0.canary.10659

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.
@@ -11,6 +11,7 @@ import type {
11
11
  Loader,
12
12
  LoaderConfiguration,
13
13
  FragmentLoaderContext,
14
+ LoaderCallbacks,
14
15
  } from '../types/loader';
15
16
 
16
17
  const MIN_CHUNK_SIZE = Math.pow(2, 17); // 128kb
@@ -94,7 +95,7 @@ export default class FragmentLoader {
94
95
  };
95
96
  // Assign frag stats to the loader's stats reference
96
97
  frag.stats = loader.stats;
97
- loader.load(loaderContext, loaderConfig, {
98
+ const callbacks: LoaderCallbacks<FragmentLoaderContext> = {
98
99
  onSuccess: (response, stats, context, networkDetails) => {
99
100
  this.resetLoader(frag, loader);
100
101
  let payload = response.data as ArrayBuffer;
@@ -152,17 +153,17 @@ export default class FragmentLoader {
152
153
  }),
153
154
  );
154
155
  },
155
- onProgress: (stats, context, data, networkDetails) => {
156
- if (onProgress) {
157
- onProgress({
158
- frag,
159
- part: null,
160
- payload: data as ArrayBuffer,
161
- networkDetails,
162
- });
163
- }
164
- },
165
- });
156
+ };
157
+ if (onProgress) {
158
+ callbacks.onProgress = (stats, context, data, networkDetails) =>
159
+ onProgress({
160
+ frag,
161
+ part: null,
162
+ payload: data as ArrayBuffer,
163
+ networkDetails,
164
+ });
165
+ }
166
+ loader.load(loaderContext, loaderConfig, callbacks);
166
167
  });
167
168
  }
168
169