hls.js 1.5.5-0.canary.9983 → 1.5.5-0.canary.9985
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 +90 -79
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +88 -77
- 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 +90 -79
- 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 +92 -81
- 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/controller/base-playlist-controller.ts +13 -1
- package/src/controller/cmcd-controller.ts +2 -3
- package/src/controller/level-controller.ts +7 -1
- package/src/loader/playlist-loader.ts +4 -5
- package/src/utils/logger.ts +3 -2
package/dist/hls.mjs
CHANGED
@@ -370,78 +370,6 @@ let ErrorDetails = /*#__PURE__*/function (ErrorDetails) {
|
|
370
370
|
return ErrorDetails;
|
371
371
|
}({});
|
372
372
|
|
373
|
-
class Logger {
|
374
|
-
constructor(label, logger) {
|
375
|
-
this.trace = void 0;
|
376
|
-
this.debug = void 0;
|
377
|
-
this.log = void 0;
|
378
|
-
this.warn = void 0;
|
379
|
-
this.info = void 0;
|
380
|
-
this.error = void 0;
|
381
|
-
const lb = `[${label}]:`;
|
382
|
-
this.trace = noop;
|
383
|
-
this.debug = logger.debug.bind(null, lb);
|
384
|
-
this.log = logger.log.bind(null, lb);
|
385
|
-
this.warn = logger.warn.bind(null, lb);
|
386
|
-
this.info = logger.info.bind(null, lb);
|
387
|
-
this.error = logger.error.bind(null, lb);
|
388
|
-
}
|
389
|
-
}
|
390
|
-
const noop = function noop() {};
|
391
|
-
const fakeLogger = {
|
392
|
-
trace: noop,
|
393
|
-
debug: noop,
|
394
|
-
log: noop,
|
395
|
-
warn: noop,
|
396
|
-
info: noop,
|
397
|
-
error: noop
|
398
|
-
};
|
399
|
-
function createLogger() {
|
400
|
-
return _extends({}, fakeLogger);
|
401
|
-
}
|
402
|
-
|
403
|
-
// let lastCallTime;
|
404
|
-
// function formatMsgWithTimeInfo(type, msg) {
|
405
|
-
// const now = Date.now();
|
406
|
-
// const diff = lastCallTime ? '+' + (now - lastCallTime) : '0';
|
407
|
-
// lastCallTime = now;
|
408
|
-
// msg = (new Date(now)).toISOString() + ' | [' + type + '] > ' + msg + ' ( ' + diff + ' ms )';
|
409
|
-
// return msg;
|
410
|
-
// }
|
411
|
-
|
412
|
-
function consolePrintFn(type, id) {
|
413
|
-
const func = self.console[type];
|
414
|
-
return func ? func.bind(self.console, `${id ? '[' + id + '] ' : ''}[${type}] >`) : noop;
|
415
|
-
}
|
416
|
-
function getLoggerFn(key, debugConfig, id) {
|
417
|
-
return debugConfig[key] ? debugConfig[key].bind(debugConfig) : consolePrintFn(key, id);
|
418
|
-
}
|
419
|
-
let exportedLogger = createLogger();
|
420
|
-
function enableLogs(debugConfig, context, id) {
|
421
|
-
// check that console is available
|
422
|
-
const newLogger = createLogger();
|
423
|
-
if (typeof console === 'object' && debugConfig === true || typeof debugConfig === 'object') {
|
424
|
-
const keys = [
|
425
|
-
// Remove out from list here to hard-disable a log-level
|
426
|
-
// 'trace',
|
427
|
-
'debug', 'log', 'info', 'warn', 'error'];
|
428
|
-
keys.forEach(key => {
|
429
|
-
newLogger[key] = getLoggerFn(key, debugConfig, id);
|
430
|
-
});
|
431
|
-
// Some browsers don't allow to use bind on console object anyway
|
432
|
-
// fallback to default if needed
|
433
|
-
try {
|
434
|
-
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.5-0.canary.9983"}`);
|
435
|
-
} catch (e) {
|
436
|
-
/* log fn threw an exception. All logger methods are no-ops. */
|
437
|
-
return createLogger();
|
438
|
-
}
|
439
|
-
}
|
440
|
-
exportedLogger = newLogger;
|
441
|
-
return newLogger;
|
442
|
-
}
|
443
|
-
const logger = exportedLogger;
|
444
|
-
|
445
373
|
const DECIMAL_RESOLUTION_REGEX = /^(\d+)x(\d+)$/;
|
446
374
|
const ATTR_LIST_REGEX = /(.+?)=(".*?"|.*?)(?:,|$)/g;
|
447
375
|
|
@@ -523,6 +451,79 @@ class AttrList {
|
|
523
451
|
}
|
524
452
|
}
|
525
453
|
|
454
|
+
class Logger {
|
455
|
+
constructor(label, logger) {
|
456
|
+
this.trace = void 0;
|
457
|
+
this.debug = void 0;
|
458
|
+
this.log = void 0;
|
459
|
+
this.warn = void 0;
|
460
|
+
this.info = void 0;
|
461
|
+
this.error = void 0;
|
462
|
+
const lb = `[${label}]:`;
|
463
|
+
this.trace = noop;
|
464
|
+
this.debug = logger.debug.bind(null, lb);
|
465
|
+
this.log = logger.log.bind(null, lb);
|
466
|
+
this.warn = logger.warn.bind(null, lb);
|
467
|
+
this.info = logger.info.bind(null, lb);
|
468
|
+
this.error = logger.error.bind(null, lb);
|
469
|
+
}
|
470
|
+
}
|
471
|
+
const noop = function noop() {};
|
472
|
+
const fakeLogger = {
|
473
|
+
trace: noop,
|
474
|
+
debug: noop,
|
475
|
+
log: noop,
|
476
|
+
warn: noop,
|
477
|
+
info: noop,
|
478
|
+
error: noop
|
479
|
+
};
|
480
|
+
function createLogger() {
|
481
|
+
return _extends({}, fakeLogger);
|
482
|
+
}
|
483
|
+
|
484
|
+
// let lastCallTime;
|
485
|
+
// function formatMsgWithTimeInfo(type, msg) {
|
486
|
+
// const now = Date.now();
|
487
|
+
// const diff = lastCallTime ? '+' + (now - lastCallTime) : '0';
|
488
|
+
// lastCallTime = now;
|
489
|
+
// msg = (new Date(now)).toISOString() + ' | [' + type + '] > ' + msg + ' ( ' + diff + ' ms )';
|
490
|
+
// return msg;
|
491
|
+
// }
|
492
|
+
|
493
|
+
function consolePrintFn(type, id) {
|
494
|
+
const func = self.console[type];
|
495
|
+
return func ? func.bind(self.console, `${id ? '[' + id + '] ' : ''}[${type}] >`) : noop;
|
496
|
+
}
|
497
|
+
function getLoggerFn(key, debugConfig, id) {
|
498
|
+
return debugConfig[key] ? debugConfig[key].bind(debugConfig) : consolePrintFn(key, id);
|
499
|
+
}
|
500
|
+
const exportedLogger = createLogger();
|
501
|
+
function enableLogs(debugConfig, context, id) {
|
502
|
+
// check that console is available
|
503
|
+
const newLogger = createLogger();
|
504
|
+
if (typeof console === 'object' && debugConfig === true || typeof debugConfig === 'object') {
|
505
|
+
const keys = [
|
506
|
+
// Remove out from list here to hard-disable a log-level
|
507
|
+
// 'trace',
|
508
|
+
'debug', 'log', 'info', 'warn', 'error'];
|
509
|
+
keys.forEach(key => {
|
510
|
+
newLogger[key] = getLoggerFn(key, debugConfig, id);
|
511
|
+
});
|
512
|
+
// Some browsers don't allow to use bind on console object anyway
|
513
|
+
// fallback to default if needed
|
514
|
+
try {
|
515
|
+
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.5-0.canary.9985"}`);
|
516
|
+
} catch (e) {
|
517
|
+
/* log fn threw an exception. All logger methods are no-ops. */
|
518
|
+
return createLogger();
|
519
|
+
}
|
520
|
+
}
|
521
|
+
// global exported logger uses the log methods from last call to `enableLogs`
|
522
|
+
_extends(exportedLogger, newLogger);
|
523
|
+
return newLogger;
|
524
|
+
}
|
525
|
+
const logger = exportedLogger;
|
526
|
+
|
526
527
|
// Avoid exporting const enum so that these values can be inlined
|
527
528
|
|
528
529
|
function isDateRangeCueAttribute(attrName) {
|
@@ -3942,10 +3943,10 @@ class PlaylistLoader {
|
|
3942
3943
|
const loaderContext = loader.context;
|
3943
3944
|
if (loaderContext && loaderContext.url === context.url && loaderContext.level === context.level) {
|
3944
3945
|
// same URL can't overlap
|
3945
|
-
logger.trace('[playlist-loader]: playlist request ongoing');
|
3946
|
+
this.hls.logger.trace('[playlist-loader]: playlist request ongoing');
|
3946
3947
|
return;
|
3947
3948
|
}
|
3948
|
-
logger.log(`[playlist-loader]: aborting previous loader for type: ${context.type}`);
|
3949
|
+
this.hls.logger.log(`[playlist-loader]: aborting previous loader for type: ${context.type}`);
|
3949
3950
|
loader.abort();
|
3950
3951
|
}
|
3951
3952
|
|
@@ -4055,7 +4056,7 @@ class PlaylistLoader {
|
|
4055
4056
|
// alt audio rendition in which quality levels (main)
|
4056
4057
|
// contains both audio+video. but with mixed audio track not signaled
|
4057
4058
|
if (!embeddedAudioFound && levels[0].audioCodec && !levels[0].attrs.AUDIO) {
|
4058
|
-
logger.log('[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one');
|
4059
|
+
this.hls.logger.log('[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one');
|
4059
4060
|
audioTracks.unshift({
|
4060
4061
|
type: 'main',
|
4061
4062
|
name: 'main',
|
@@ -4154,7 +4155,7 @@ class PlaylistLoader {
|
|
4154
4155
|
message += ` id: ${context.id} group-id: "${context.groupId}"`;
|
4155
4156
|
}
|
4156
4157
|
const error = new Error(message);
|
4157
|
-
logger.warn(`[playlist-loader]: ${message}`);
|
4158
|
+
this.hls.logger.warn(`[playlist-loader]: ${message}`);
|
4158
4159
|
let details = ErrorDetails.UNKNOWN;
|
4159
4160
|
let fatal = false;
|
4160
4161
|
const loader = this.getInternalLoader(context);
|
@@ -6196,7 +6197,12 @@ class BasePlaylistController extends Logger {
|
|
6196
6197
|
const cdnAge = lastAdvanced + details.ageHeader;
|
6197
6198
|
let currentGoal = Math.min(cdnAge - details.partTarget, details.targetduration * 1.5);
|
6198
6199
|
if (currentGoal > 0) {
|
6199
|
-
if (
|
6200
|
+
if (cdnAge > details.targetduration * 3) {
|
6201
|
+
// Omit segment and part directives when the last response was more than 3 target durations ago,
|
6202
|
+
this.log(`Playlist last advanced ${lastAdvanced.toFixed(2)}s ago. Omitting segment and part directives.`);
|
6203
|
+
msn = undefined;
|
6204
|
+
part = undefined;
|
6205
|
+
} else if (previousDetails != null && previousDetails.tuneInGoal && cdnAge - details.partTarget > previousDetails.tuneInGoal) {
|
6200
6206
|
// If we attempted to get the next or latest playlist update, but currentGoal increased,
|
6201
6207
|
// then we either can't catchup, or the "age" header cannot be trusted.
|
6202
6208
|
this.warn(`CDN Tune-in goal increased from: ${previousDetails.tuneInGoal} to: ${currentGoal} with playlist age: ${details.age}`);
|
@@ -24586,7 +24592,7 @@ class CMCDController {
|
|
24586
24592
|
su: !this.initialized
|
24587
24593
|
});
|
24588
24594
|
} catch (error) {
|
24589
|
-
logger.warn('Could not generate manifest CMCD data.', error);
|
24595
|
+
this.hls.logger.warn('Could not generate manifest CMCD data.', error);
|
24590
24596
|
}
|
24591
24597
|
};
|
24592
24598
|
/**
|
@@ -24614,7 +24620,7 @@ class CMCDController {
|
|
24614
24620
|
}
|
24615
24621
|
this.apply(context, data);
|
24616
24622
|
} catch (error) {
|
24617
|
-
logger.warn('Could not generate segment CMCD data.', error);
|
24623
|
+
this.hls.logger.warn('Could not generate segment CMCD data.', error);
|
24618
24624
|
}
|
24619
24625
|
};
|
24620
24626
|
this.hls = hls;
|
@@ -26657,7 +26663,12 @@ class LevelController extends BasePlaylistController {
|
|
26657
26663
|
if (curLevel.fragmentError === 0) {
|
26658
26664
|
curLevel.loadError = 0;
|
26659
26665
|
}
|
26660
|
-
|
26666
|
+
// Ignore matching details populated by loading a Media Playlist directly
|
26667
|
+
let previousDetails = curLevel.details;
|
26668
|
+
if (previousDetails === data.details && previousDetails.advanced) {
|
26669
|
+
previousDetails = undefined;
|
26670
|
+
}
|
26671
|
+
this.playlistLoaded(level, data, previousDetails);
|
26661
26672
|
} else if ((_data$deliveryDirecti2 = data.deliveryDirectives) != null && _data$deliveryDirecti2.skip) {
|
26662
26673
|
// received a delta playlist update that cannot be merged
|
26663
26674
|
details.deltaUpdateFailed = true;
|
@@ -28526,7 +28537,7 @@ class Hls {
|
|
28526
28537
|
* Get the video-dev/hls.js package version.
|
28527
28538
|
*/
|
28528
28539
|
static get version() {
|
28529
|
-
return "1.5.5-0.canary.
|
28540
|
+
return "1.5.5-0.canary.9985";
|
28530
28541
|
}
|
28531
28542
|
|
28532
28543
|
/**
|