hls.js 1.6.0-beta.2.0.canary.10869 → 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.
- package/dist/hls.js +50 -42
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +24 -19
- package/dist/hls.light.js.map +1 -1
- package/dist/hls.light.min.js +1 -1
- package/dist/hls.light.min.js.map +1 -1
- package/dist/hls.light.mjs +24 -19
- package/dist/hls.light.mjs.map +1 -1
- package/dist/hls.min.js +1 -1
- package/dist/hls.min.js.map +1 -1
- package/dist/hls.mjs +47 -39
- package/dist/hls.mjs.map +1 -1
- package/dist/hls.worker.js +1 -1
- package/dist/hls.worker.js.map +1 -1
- package/package.json +1 -1
- package/src/demux/video/hevc-video-parser.ts +34 -25
- package/src/utils/fetch-loader.ts +12 -8
- package/src/utils/xhr-loader.ts +4 -11
package/dist/hls.mjs
CHANGED
@@ -401,7 +401,7 @@ function enableLogs(debugConfig, context, id) {
|
|
401
401
|
// Some browsers don't allow to use bind on console object anyway
|
402
402
|
// fallback to default if needed
|
403
403
|
try {
|
404
|
-
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.2.0.canary.
|
404
|
+
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.2.0.canary.10873"}`);
|
405
405
|
} catch (e) {
|
406
406
|
/* log fn threw an exception. All logger methods are no-ops. */
|
407
407
|
return createLogger();
|
@@ -9847,7 +9847,7 @@ var eventemitter3 = {exports: {}};
|
|
9847
9847
|
var eventemitter3Exports = eventemitter3.exports;
|
9848
9848
|
var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
|
9849
9849
|
|
9850
|
-
const version = "1.6.0-beta.2.0.canary.
|
9850
|
+
const version = "1.6.0-beta.2.0.canary.10873";
|
9851
9851
|
|
9852
9852
|
// ensure the worker ends up in the bundle
|
9853
9853
|
// If the worker should not be included this gets aliased to empty.js
|
@@ -12226,8 +12226,10 @@ class HevcVideoParser extends BaseVideoParser {
|
|
12226
12226
|
case 32:
|
12227
12227
|
push = true;
|
12228
12228
|
if (!track.vps) {
|
12229
|
-
|
12230
|
-
|
12229
|
+
if (typeof track.params !== 'object') {
|
12230
|
+
track.params = {};
|
12231
|
+
}
|
12232
|
+
track.params = _extends(track.params, this.readVPS(unit.data));
|
12231
12233
|
this.initVPS = unit.data;
|
12232
12234
|
}
|
12233
12235
|
track.vps = [unit.data];
|
@@ -12237,26 +12239,27 @@ class HevcVideoParser extends BaseVideoParser {
|
|
12237
12239
|
case 33:
|
12238
12240
|
push = true;
|
12239
12241
|
spsfound = true;
|
12240
|
-
if (
|
12241
|
-
|
12242
|
-
|
12243
|
-
|
12244
|
-
|
12245
|
-
|
12246
|
-
|
12247
|
-
|
12248
|
-
|
12249
|
-
|
12250
|
-
|
12251
|
-
|
12252
|
-
|
12253
|
-
track.params[prop] = config.params[prop];
|
12254
|
-
}
|
12242
|
+
if (track.vps !== undefined && track.vps[0] !== this.initVPS && track.sps !== undefined && !this.matchSPS(track.sps[0], unit.data)) {
|
12243
|
+
this.initVPS = track.vps[0];
|
12244
|
+
track.sps = track.pps = undefined;
|
12245
|
+
}
|
12246
|
+
if (!track.sps) {
|
12247
|
+
const config = this.readSPS(unit.data);
|
12248
|
+
track.width = config.width;
|
12249
|
+
track.height = config.height;
|
12250
|
+
track.pixelRatio = config.pixelRatio;
|
12251
|
+
track.codec = config.codecString;
|
12252
|
+
track.sps = [];
|
12253
|
+
if (typeof track.params !== 'object') {
|
12254
|
+
track.params = {};
|
12255
12255
|
}
|
12256
|
-
|
12257
|
-
track.
|
12256
|
+
for (const prop in config.params) {
|
12257
|
+
track.params[prop] = config.params[prop];
|
12258
12258
|
}
|
12259
12259
|
}
|
12260
|
+
if (!track.vps && !track.sps.length || track.vps && track.vps[0] === this.initVPS) {
|
12261
|
+
track.sps.push(unit.data);
|
12262
|
+
}
|
12260
12263
|
if (!VideoSample) {
|
12261
12264
|
VideoSample = this.VideoSample = this.createVideoSample(true, pes.pts, pes.dts);
|
12262
12265
|
}
|
@@ -12274,7 +12277,7 @@ class HevcVideoParser extends BaseVideoParser {
|
|
12274
12277
|
track.params[prop] = config[prop];
|
12275
12278
|
}
|
12276
12279
|
}
|
12277
|
-
if (track.vps
|
12280
|
+
if (!track.vps && !track.pps.length || track.vps && track.vps[0] === this.initVPS) {
|
12278
12281
|
track.pps.push(unit.data);
|
12279
12282
|
}
|
12280
12283
|
}
|
@@ -28825,7 +28828,6 @@ class FetchLoader {
|
|
28825
28828
|
}
|
28826
28829
|
stats.loading.start = self.performance.now();
|
28827
28830
|
const initParams = getRequestParameters(context, this.controller.signal);
|
28828
|
-
const onProgress = callbacks.onProgress;
|
28829
28831
|
const isArrayBuffer = context.responseType === 'arraybuffer';
|
28830
28832
|
const LENGTH = isArrayBuffer ? 'byteLength' : 'length';
|
28831
28833
|
const {
|
@@ -28839,18 +28841,23 @@ class FetchLoader {
|
|
28839
28841
|
self.clearTimeout(this.requestTimeout);
|
28840
28842
|
config.timeout = maxTimeToFirstByteMs && isFiniteNumber(maxTimeToFirstByteMs) ? maxTimeToFirstByteMs : maxLoadTimeMs;
|
28841
28843
|
this.requestTimeout = self.setTimeout(() => {
|
28842
|
-
this.
|
28843
|
-
|
28844
|
+
if (this.callbacks) {
|
28845
|
+
this.abortInternal();
|
28846
|
+
this.callbacks.onTimeout(stats, context, this.response);
|
28847
|
+
}
|
28844
28848
|
}, config.timeout);
|
28845
28849
|
const fetchPromise = isPromise(this.request) ? this.request.then(self.fetch) : self.fetch(this.request);
|
28846
28850
|
fetchPromise.then(response => {
|
28851
|
+
var _this$callbacks2;
|
28847
28852
|
this.response = this.loader = response;
|
28848
28853
|
const first = Math.max(self.performance.now(), stats.loading.start);
|
28849
28854
|
self.clearTimeout(this.requestTimeout);
|
28850
28855
|
config.timeout = maxLoadTimeMs;
|
28851
28856
|
this.requestTimeout = self.setTimeout(() => {
|
28852
|
-
this.
|
28853
|
-
|
28857
|
+
if (this.callbacks) {
|
28858
|
+
this.abortInternal();
|
28859
|
+
this.callbacks.onTimeout(stats, context, this.response);
|
28860
|
+
}
|
28854
28861
|
}, maxLoadTimeMs - (first - stats.loading.start));
|
28855
28862
|
if (!response.ok) {
|
28856
28863
|
const {
|
@@ -28861,6 +28868,7 @@ class FetchLoader {
|
|
28861
28868
|
}
|
28862
28869
|
stats.loading.first = first;
|
28863
28870
|
stats.total = getContentLength(response.headers) || stats.total;
|
28871
|
+
const onProgress = (_this$callbacks2 = this.callbacks) == null ? void 0 : _this$callbacks2.onProgress;
|
28864
28872
|
if (onProgress && isFiniteNumber(config.highWaterMark)) {
|
28865
28873
|
return this.loadProgressively(response, stats, context, config.highWaterMark, onProgress);
|
28866
28874
|
}
|
@@ -28872,6 +28880,7 @@ class FetchLoader {
|
|
28872
28880
|
}
|
28873
28881
|
return response.text();
|
28874
28882
|
}).then(responseData => {
|
28883
|
+
var _this$callbacks3, _this$callbacks4;
|
28875
28884
|
const response = this.response;
|
28876
28885
|
if (!response) {
|
28877
28886
|
throw new Error('loader destroyed');
|
@@ -28887,11 +28896,13 @@ class FetchLoader {
|
|
28887
28896
|
data: responseData,
|
28888
28897
|
code: response.status
|
28889
28898
|
};
|
28899
|
+
const onProgress = (_this$callbacks3 = this.callbacks) == null ? void 0 : _this$callbacks3.onProgress;
|
28890
28900
|
if (onProgress && !isFiniteNumber(config.highWaterMark)) {
|
28891
28901
|
onProgress(stats, context, responseData, response);
|
28892
28902
|
}
|
28893
|
-
callbacks.onSuccess(loaderResponse, stats, context, response);
|
28903
|
+
(_this$callbacks4 = this.callbacks) == null ? void 0 : _this$callbacks4.onSuccess(loaderResponse, stats, context, response);
|
28894
28904
|
}).catch(error => {
|
28905
|
+
var _this$callbacks5;
|
28895
28906
|
self.clearTimeout(this.requestTimeout);
|
28896
28907
|
if (stats.aborted) {
|
28897
28908
|
return;
|
@@ -28900,7 +28911,7 @@ class FetchLoader {
|
|
28900
28911
|
// when destroying, 'error' itself can be undefined
|
28901
28912
|
const code = !error ? 0 : error.code || 0;
|
28902
28913
|
const text = !error ? null : error.message;
|
28903
|
-
callbacks.onError({
|
28914
|
+
(_this$callbacks5 = this.callbacks) == null ? void 0 : _this$callbacks5.onError({
|
28904
28915
|
code,
|
28905
28916
|
text
|
28906
28917
|
}, context, error ? error.details : null, stats);
|
@@ -29078,8 +29089,9 @@ class XhrLoader {
|
|
29078
29089
|
if (this.loader !== xhr || this.stats.aborted) return;
|
29079
29090
|
this.openAndSendXhr(xhr, context, config);
|
29080
29091
|
}).catch(error => {
|
29092
|
+
var _this$callbacks2;
|
29081
29093
|
// IE11 throws an exception on xhr.open if attempting to access an HTTP resource over HTTPS
|
29082
|
-
this.callbacks.onError({
|
29094
|
+
(_this$callbacks2 = this.callbacks) == null ? void 0 : _this$callbacks2.onError({
|
29083
29095
|
code: xhr.status,
|
29084
29096
|
text: error.message
|
29085
29097
|
}, context, xhr, stats);
|
@@ -29153,26 +29165,21 @@ class XhrLoader {
|
|
29153
29165
|
if (status >= 200 && status < 300) {
|
29154
29166
|
const data = useResponseText != null ? useResponseText : xhr.response;
|
29155
29167
|
if (data != null) {
|
29168
|
+
var _this$callbacks3, _this$callbacks4;
|
29156
29169
|
stats.loading.end = Math.max(self.performance.now(), stats.loading.first);
|
29157
29170
|
const len = xhr.responseType === 'arraybuffer' ? data.byteLength : data.length;
|
29158
29171
|
stats.loaded = stats.total = len;
|
29159
29172
|
stats.bwEstimate = stats.total * 8000 / (stats.loading.end - stats.loading.first);
|
29160
|
-
|
29161
|
-
return;
|
29162
|
-
}
|
29163
|
-
const onProgress = this.callbacks.onProgress;
|
29173
|
+
const onProgress = (_this$callbacks3 = this.callbacks) == null ? void 0 : _this$callbacks3.onProgress;
|
29164
29174
|
if (onProgress) {
|
29165
29175
|
onProgress(stats, context, data, xhr);
|
29166
29176
|
}
|
29167
|
-
if (!this.callbacks) {
|
29168
|
-
return;
|
29169
|
-
}
|
29170
29177
|
const _response = {
|
29171
29178
|
url: xhr.responseURL,
|
29172
29179
|
data: data,
|
29173
29180
|
code: status
|
29174
29181
|
};
|
29175
|
-
this.callbacks.onSuccess(_response, stats, context, xhr);
|
29182
|
+
(_this$callbacks4 = this.callbacks) == null ? void 0 : _this$callbacks4.onSuccess(_response, stats, context, xhr);
|
29176
29183
|
return;
|
29177
29184
|
}
|
29178
29185
|
}
|
@@ -29189,8 +29196,9 @@ class XhrLoader {
|
|
29189
29196
|
if (shouldRetry(retryConfig, retryCount, false, response)) {
|
29190
29197
|
this.retry(retryConfig);
|
29191
29198
|
} else {
|
29199
|
+
var _this$callbacks5;
|
29192
29200
|
logger.error(`${status} while loading ${context.url}`);
|
29193
|
-
this.callbacks.onError({
|
29201
|
+
(_this$callbacks5 = this.callbacks) == null ? void 0 : _this$callbacks5.onError({
|
29194
29202
|
code: status,
|
29195
29203
|
text: xhr.statusText
|
29196
29204
|
}, context, xhr, stats);
|