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.light.js
CHANGED
@@ -466,76 +466,6 @@
|
|
466
466
|
return ErrorDetails;
|
467
467
|
}({});
|
468
468
|
|
469
|
-
var Logger = function Logger(label, logger) {
|
470
|
-
this.trace = void 0;
|
471
|
-
this.debug = void 0;
|
472
|
-
this.log = void 0;
|
473
|
-
this.warn = void 0;
|
474
|
-
this.info = void 0;
|
475
|
-
this.error = void 0;
|
476
|
-
var lb = "[" + label + "]:";
|
477
|
-
this.trace = noop;
|
478
|
-
this.debug = logger.debug.bind(null, lb);
|
479
|
-
this.log = logger.log.bind(null, lb);
|
480
|
-
this.warn = logger.warn.bind(null, lb);
|
481
|
-
this.info = logger.info.bind(null, lb);
|
482
|
-
this.error = logger.error.bind(null, lb);
|
483
|
-
};
|
484
|
-
var noop = function noop() {};
|
485
|
-
var fakeLogger = {
|
486
|
-
trace: noop,
|
487
|
-
debug: noop,
|
488
|
-
log: noop,
|
489
|
-
warn: noop,
|
490
|
-
info: noop,
|
491
|
-
error: noop
|
492
|
-
};
|
493
|
-
function createLogger() {
|
494
|
-
return _extends({}, fakeLogger);
|
495
|
-
}
|
496
|
-
|
497
|
-
// let lastCallTime;
|
498
|
-
// function formatMsgWithTimeInfo(type, msg) {
|
499
|
-
// const now = Date.now();
|
500
|
-
// const diff = lastCallTime ? '+' + (now - lastCallTime) : '0';
|
501
|
-
// lastCallTime = now;
|
502
|
-
// msg = (new Date(now)).toISOString() + ' | [' + type + '] > ' + msg + ' ( ' + diff + ' ms )';
|
503
|
-
// return msg;
|
504
|
-
// }
|
505
|
-
|
506
|
-
function consolePrintFn(type, id) {
|
507
|
-
var func = self.console[type];
|
508
|
-
return func ? func.bind(self.console, (id ? '[' + id + '] ' : '') + "[" + type + "] >") : noop;
|
509
|
-
}
|
510
|
-
function getLoggerFn(key, debugConfig, id) {
|
511
|
-
return debugConfig[key] ? debugConfig[key].bind(debugConfig) : consolePrintFn(key, id);
|
512
|
-
}
|
513
|
-
var exportedLogger = createLogger();
|
514
|
-
function enableLogs(debugConfig, context, id) {
|
515
|
-
// check that console is available
|
516
|
-
var newLogger = createLogger();
|
517
|
-
if (typeof console === 'object' && debugConfig === true || typeof debugConfig === 'object') {
|
518
|
-
var keys = [
|
519
|
-
// Remove out from list here to hard-disable a log-level
|
520
|
-
// 'trace',
|
521
|
-
'debug', 'log', 'info', 'warn', 'error'];
|
522
|
-
keys.forEach(function (key) {
|
523
|
-
newLogger[key] = getLoggerFn(key, debugConfig, id);
|
524
|
-
});
|
525
|
-
// Some browsers don't allow to use bind on console object anyway
|
526
|
-
// fallback to default if needed
|
527
|
-
try {
|
528
|
-
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.5-0.canary.9983");
|
529
|
-
} catch (e) {
|
530
|
-
/* log fn threw an exception. All logger methods are no-ops. */
|
531
|
-
return createLogger();
|
532
|
-
}
|
533
|
-
}
|
534
|
-
exportedLogger = newLogger;
|
535
|
-
return newLogger;
|
536
|
-
}
|
537
|
-
var logger = exportedLogger;
|
538
|
-
|
539
469
|
var DECIMAL_RESOLUTION_REGEX = /^(\d+)x(\d+)$/;
|
540
470
|
var ATTR_LIST_REGEX = /(.+?)=(".*?"|.*?)(?:,|$)/g;
|
541
471
|
|
@@ -624,6 +554,77 @@
|
|
624
554
|
return AttrList;
|
625
555
|
}();
|
626
556
|
|
557
|
+
var Logger = function Logger(label, logger) {
|
558
|
+
this.trace = void 0;
|
559
|
+
this.debug = void 0;
|
560
|
+
this.log = void 0;
|
561
|
+
this.warn = void 0;
|
562
|
+
this.info = void 0;
|
563
|
+
this.error = void 0;
|
564
|
+
var lb = "[" + label + "]:";
|
565
|
+
this.trace = noop;
|
566
|
+
this.debug = logger.debug.bind(null, lb);
|
567
|
+
this.log = logger.log.bind(null, lb);
|
568
|
+
this.warn = logger.warn.bind(null, lb);
|
569
|
+
this.info = logger.info.bind(null, lb);
|
570
|
+
this.error = logger.error.bind(null, lb);
|
571
|
+
};
|
572
|
+
var noop = function noop() {};
|
573
|
+
var fakeLogger = {
|
574
|
+
trace: noop,
|
575
|
+
debug: noop,
|
576
|
+
log: noop,
|
577
|
+
warn: noop,
|
578
|
+
info: noop,
|
579
|
+
error: noop
|
580
|
+
};
|
581
|
+
function createLogger() {
|
582
|
+
return _extends({}, fakeLogger);
|
583
|
+
}
|
584
|
+
|
585
|
+
// let lastCallTime;
|
586
|
+
// function formatMsgWithTimeInfo(type, msg) {
|
587
|
+
// const now = Date.now();
|
588
|
+
// const diff = lastCallTime ? '+' + (now - lastCallTime) : '0';
|
589
|
+
// lastCallTime = now;
|
590
|
+
// msg = (new Date(now)).toISOString() + ' | [' + type + '] > ' + msg + ' ( ' + diff + ' ms )';
|
591
|
+
// return msg;
|
592
|
+
// }
|
593
|
+
|
594
|
+
function consolePrintFn(type, id) {
|
595
|
+
var func = self.console[type];
|
596
|
+
return func ? func.bind(self.console, (id ? '[' + id + '] ' : '') + "[" + type + "] >") : noop;
|
597
|
+
}
|
598
|
+
function getLoggerFn(key, debugConfig, id) {
|
599
|
+
return debugConfig[key] ? debugConfig[key].bind(debugConfig) : consolePrintFn(key, id);
|
600
|
+
}
|
601
|
+
var exportedLogger = createLogger();
|
602
|
+
function enableLogs(debugConfig, context, id) {
|
603
|
+
// check that console is available
|
604
|
+
var newLogger = createLogger();
|
605
|
+
if (typeof console === 'object' && debugConfig === true || typeof debugConfig === 'object') {
|
606
|
+
var keys = [
|
607
|
+
// Remove out from list here to hard-disable a log-level
|
608
|
+
// 'trace',
|
609
|
+
'debug', 'log', 'info', 'warn', 'error'];
|
610
|
+
keys.forEach(function (key) {
|
611
|
+
newLogger[key] = getLoggerFn(key, debugConfig, id);
|
612
|
+
});
|
613
|
+
// Some browsers don't allow to use bind on console object anyway
|
614
|
+
// fallback to default if needed
|
615
|
+
try {
|
616
|
+
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.5-0.canary.9985");
|
617
|
+
} catch (e) {
|
618
|
+
/* log fn threw an exception. All logger methods are no-ops. */
|
619
|
+
return createLogger();
|
620
|
+
}
|
621
|
+
}
|
622
|
+
// global exported logger uses the log methods from last call to `enableLogs`
|
623
|
+
_extends(exportedLogger, newLogger);
|
624
|
+
return newLogger;
|
625
|
+
}
|
626
|
+
var logger = exportedLogger;
|
627
|
+
|
627
628
|
// Avoid exporting const enum so that these values can be inlined
|
628
629
|
|
629
630
|
function isDateRangeCueAttribute(attrName) {
|
@@ -3700,10 +3701,10 @@
|
|
3700
3701
|
var loaderContext = loader.context;
|
3701
3702
|
if (loaderContext && loaderContext.url === context.url && loaderContext.level === context.level) {
|
3702
3703
|
// same URL can't overlap
|
3703
|
-
logger.trace('[playlist-loader]: playlist request ongoing');
|
3704
|
+
this.hls.logger.trace('[playlist-loader]: playlist request ongoing');
|
3704
3705
|
return;
|
3705
3706
|
}
|
3706
|
-
logger.log("[playlist-loader]: aborting previous loader for type: " + context.type);
|
3707
|
+
this.hls.logger.log("[playlist-loader]: aborting previous loader for type: " + context.type);
|
3707
3708
|
loader.abort();
|
3708
3709
|
}
|
3709
3710
|
|
@@ -3813,7 +3814,7 @@
|
|
3813
3814
|
// alt audio rendition in which quality levels (main)
|
3814
3815
|
// contains both audio+video. but with mixed audio track not signaled
|
3815
3816
|
if (!embeddedAudioFound && levels[0].audioCodec && !levels[0].attrs.AUDIO) {
|
3816
|
-
logger.log('[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one');
|
3817
|
+
this.hls.logger.log('[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one');
|
3817
3818
|
audioTracks.unshift({
|
3818
3819
|
type: 'main',
|
3819
3820
|
name: 'main',
|
@@ -3913,7 +3914,7 @@
|
|
3913
3914
|
message += " id: " + context.id + " group-id: \"" + context.groupId + "\"";
|
3914
3915
|
}
|
3915
3916
|
var error = new Error(message);
|
3916
|
-
logger.warn("[playlist-loader]: " + message);
|
3917
|
+
this.hls.logger.warn("[playlist-loader]: " + message);
|
3917
3918
|
var details = ErrorDetails.UNKNOWN;
|
3918
3919
|
var fatal = false;
|
3919
3920
|
var loader = this.getInternalLoader(context);
|
@@ -5975,7 +5976,12 @@
|
|
5975
5976
|
var cdnAge = lastAdvanced + details.ageHeader;
|
5976
5977
|
var currentGoal = Math.min(cdnAge - details.partTarget, details.targetduration * 1.5);
|
5977
5978
|
if (currentGoal > 0) {
|
5978
|
-
if (
|
5979
|
+
if (cdnAge > details.targetduration * 3) {
|
5980
|
+
// Omit segment and part directives when the last response was more than 3 target durations ago,
|
5981
|
+
this.log("Playlist last advanced " + lastAdvanced.toFixed(2) + "s ago. Omitting segment and part directives.");
|
5982
|
+
msn = undefined;
|
5983
|
+
part = undefined;
|
5984
|
+
} else if (previousDetails != null && previousDetails.tuneInGoal && cdnAge - details.partTarget > previousDetails.tuneInGoal) {
|
5979
5985
|
// If we attempted to get the next or latest playlist update, but currentGoal increased,
|
5980
5986
|
// then we either can't catchup, or the "age" header cannot be trusted.
|
5981
5987
|
this.warn("CDN Tune-in goal increased from: " + previousDetails.tuneInGoal + " to: " + currentGoal + " with playlist age: " + details.age);
|
@@ -10239,7 +10245,12 @@
|
|
10239
10245
|
if (curLevel.fragmentError === 0) {
|
10240
10246
|
curLevel.loadError = 0;
|
10241
10247
|
}
|
10242
|
-
|
10248
|
+
// Ignore matching details populated by loading a Media Playlist directly
|
10249
|
+
var previousDetails = curLevel.details;
|
10250
|
+
if (previousDetails === data.details && previousDetails.advanced) {
|
10251
|
+
previousDetails = undefined;
|
10252
|
+
}
|
10253
|
+
this.playlistLoaded(level, data, previousDetails);
|
10243
10254
|
} else if ((_data$deliveryDirecti2 = data.deliveryDirectives) != null && _data$deliveryDirecti2.skip) {
|
10244
10255
|
// received a delta playlist update that cannot be merged
|
10245
10256
|
details.deltaUpdateFailed = true;
|
@@ -21257,7 +21268,7 @@
|
|
21257
21268
|
* Get the video-dev/hls.js package version.
|
21258
21269
|
*/
|
21259
21270
|
function get() {
|
21260
|
-
return "1.5.5-0.canary.
|
21271
|
+
return "1.5.5-0.canary.9985";
|
21261
21272
|
}
|
21262
21273
|
}, {
|
21263
21274
|
key: "Events",
|