hls.js 1.5.12-0.canary.10351 → 1.5.12-0.canary.10352
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 +32 -20
- package/dist/hls.js.d.ts +1 -0
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +32 -20
- 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 +30 -18
- 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 +30 -18
- package/dist/hls.mjs.map +1 -1
- package/dist/hls.worker.js +1 -1
- package/package.json +1 -1
- package/src/controller/abr-controller.ts +15 -5
- package/src/hls.ts +4 -3
- package/src/types/media-playlist.ts +9 -1
- package/src/utils/hdr.ts +4 -7
- package/src/utils/rendition-helper.ts +26 -5
package/dist/hls.light.js
CHANGED
@@ -493,7 +493,7 @@
|
|
493
493
|
// Some browsers don't allow to use bind on console object anyway
|
494
494
|
// fallback to default if needed
|
495
495
|
try {
|
496
|
-
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.12-0.canary.
|
496
|
+
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.12-0.canary.10352");
|
497
497
|
} catch (e) {
|
498
498
|
/* log fn threw an exception. All logger methods are no-ops. */
|
499
499
|
return createLogger();
|
@@ -6581,12 +6581,9 @@
|
|
6581
6581
|
}
|
6582
6582
|
if (videoPreference) {
|
6583
6583
|
allowedVideoRanges = videoPreference.allowedVideoRanges || VideoRangeValues.slice(0);
|
6584
|
-
|
6585
|
-
|
6586
|
-
|
6587
|
-
return range !== 'SDR';
|
6588
|
-
});
|
6589
|
-
} else {
|
6584
|
+
var allowAutoPreferHDR = allowedVideoRanges.join('') !== 'SDR' && !videoPreference.videoCodec;
|
6585
|
+
preferHDR = videoPreference.preferHDR !== undefined ? videoPreference.preferHDR : allowAutoPreferHDR && isHdrSupported();
|
6586
|
+
if (!preferHDR) {
|
6590
6587
|
allowedVideoRanges = ['SDR'];
|
6591
6588
|
}
|
6592
6589
|
}
|
@@ -6600,13 +6597,15 @@
|
|
6600
6597
|
var codecSets = Object.keys(codecTiers);
|
6601
6598
|
var channelsPreference = audioPreference == null ? void 0 : audioPreference.channels;
|
6602
6599
|
var audioCodecPreference = audioPreference == null ? void 0 : audioPreference.audioCodec;
|
6600
|
+
var videoCodecPreference = videoPreference == null ? void 0 : videoPreference.videoCodec;
|
6603
6601
|
var preferStereo = channelsPreference && parseInt(channelsPreference) === 2;
|
6604
6602
|
// Use first level set to determine stereo, and minimum resolution and framerate
|
6605
|
-
var hasStereo =
|
6603
|
+
var hasStereo = false;
|
6606
6604
|
var hasCurrentVideoRange = false;
|
6607
6605
|
var minHeight = Infinity;
|
6608
6606
|
var minFramerate = Infinity;
|
6609
6607
|
var minBitrate = Infinity;
|
6608
|
+
var minIndex = Infinity;
|
6610
6609
|
var selectedScore = 0;
|
6611
6610
|
var videoRanges = [];
|
6612
6611
|
var _getVideoSelectionOpt = getVideoSelectionOptions(currentVideoRange, videoPreference),
|
@@ -6614,7 +6613,7 @@
|
|
6614
6613
|
allowedVideoRanges = _getVideoSelectionOpt.allowedVideoRanges;
|
6615
6614
|
var _loop = function _loop() {
|
6616
6615
|
var tier = codecTiers[codecSets[i]];
|
6617
|
-
hasStereo = tier.channels[2] > 0;
|
6616
|
+
hasStereo || (hasStereo = tier.channels[2] > 0);
|
6618
6617
|
minHeight = Math.min(minHeight, tier.minHeight);
|
6619
6618
|
minFramerate = Math.min(minFramerate, tier.minFramerate);
|
6620
6619
|
minBitrate = Math.min(minBitrate, tier.minBitrate);
|
@@ -6623,7 +6622,6 @@
|
|
6623
6622
|
});
|
6624
6623
|
if (matchingVideoRanges.length > 0) {
|
6625
6624
|
hasCurrentVideoRange = true;
|
6626
|
-
videoRanges = matchingVideoRanges;
|
6627
6625
|
}
|
6628
6626
|
};
|
6629
6627
|
for (var i = codecSets.length; i--;) {
|
@@ -6638,7 +6636,6 @@
|
|
6638
6636
|
// If there are no variants with matching preference, set currentVideoRange to undefined
|
6639
6637
|
if (!hasCurrentVideoRange) {
|
6640
6638
|
currentVideoRange = undefined;
|
6641
|
-
videoRanges = [];
|
6642
6639
|
}
|
6643
6640
|
var codecSet = codecSets.reduce(function (selected, candidate) {
|
6644
6641
|
// Remove candiates which do not meet bitrate, default audio, stereo or channels preference, 1080p or lower, 30fps or lower, or SDR/HDR selection if present
|
@@ -6646,6 +6643,9 @@
|
|
6646
6643
|
if (candidate === selected) {
|
6647
6644
|
return selected;
|
6648
6645
|
}
|
6646
|
+
videoRanges = hasCurrentVideoRange ? allowedVideoRanges.filter(function (range) {
|
6647
|
+
return candidateTier.videoRanges[range] > 0;
|
6648
|
+
}) : [];
|
6649
6649
|
if (candidateTier.minBitrate > currentBw) {
|
6650
6650
|
logStartCodecCandidateIgnored(candidate, "min bitrate of " + candidateTier.minBitrate + " > current estimate of " + currentBw);
|
6651
6651
|
return selected;
|
@@ -6681,6 +6681,10 @@
|
|
6681
6681
|
logStartCodecCandidateIgnored(candidate, "no variants with VIDEO-RANGE of " + JSON.stringify(videoRanges) + " found");
|
6682
6682
|
return selected;
|
6683
6683
|
}
|
6684
|
+
if (videoCodecPreference && candidate.indexOf(videoCodecPreference.substring(0, 4)) % 5 !== 0) {
|
6685
|
+
logStartCodecCandidateIgnored(candidate, "video codec preference \"" + videoCodecPreference + "\" not found");
|
6686
|
+
return selected;
|
6687
|
+
}
|
6684
6688
|
if (candidateTier.maxScore < selectedScore) {
|
6685
6689
|
logStartCodecCandidateIgnored(candidate, "max score of " + candidateTier.maxScore + " < selected max of " + selectedScore);
|
6686
6690
|
return selected;
|
@@ -6689,6 +6693,7 @@
|
|
6689
6693
|
if (selected && (codecsSetSelectionPreferenceValue(candidate) >= codecsSetSelectionPreferenceValue(selected) || candidateTier.fragmentError > codecTiers[selected].fragmentError)) {
|
6690
6694
|
return selected;
|
6691
6695
|
}
|
6696
|
+
minIndex = candidateTier.minIndex;
|
6692
6697
|
selectedScore = candidateTier.maxScore;
|
6693
6698
|
return candidate;
|
6694
6699
|
}, undefined);
|
@@ -6697,7 +6702,8 @@
|
|
6697
6702
|
videoRanges: videoRanges,
|
6698
6703
|
preferHDR: preferHDR,
|
6699
6704
|
minFramerate: minFramerate,
|
6700
|
-
minBitrate: minBitrate
|
6705
|
+
minBitrate: minBitrate,
|
6706
|
+
minIndex: minIndex
|
6701
6707
|
};
|
6702
6708
|
}
|
6703
6709
|
function logStartCodecCandidateIgnored(codeSet, reason) {
|
@@ -6735,7 +6741,7 @@
|
|
6735
6741
|
});
|
6736
6742
|
}
|
6737
6743
|
function getCodecTiers(levels, audioTracksByGroup, minAutoLevel, maxAutoLevel) {
|
6738
|
-
return levels.slice(minAutoLevel, maxAutoLevel + 1).reduce(function (tiers, level) {
|
6744
|
+
return levels.slice(minAutoLevel, maxAutoLevel + 1).reduce(function (tiers, level, index) {
|
6739
6745
|
if (!level.codecSet) {
|
6740
6746
|
return tiers;
|
6741
6747
|
}
|
@@ -6746,6 +6752,7 @@
|
|
6746
6752
|
minBitrate: Infinity,
|
6747
6753
|
minHeight: Infinity,
|
6748
6754
|
minFramerate: Infinity,
|
6755
|
+
minIndex: index,
|
6749
6756
|
maxScore: 0,
|
6750
6757
|
videoRanges: {
|
6751
6758
|
SDR: 0
|
@@ -6761,6 +6768,7 @@
|
|
6761
6768
|
var lesserWidthOrHeight = Math.min(level.height, level.width);
|
6762
6769
|
tier.minHeight = Math.min(tier.minHeight, lesserWidthOrHeight);
|
6763
6770
|
tier.minFramerate = Math.min(tier.minFramerate, level.frameRate);
|
6771
|
+
tier.minIndex = Math.min(tier.minIndex, index);
|
6764
6772
|
tier.maxScore = Math.max(tier.maxScore, level.score);
|
6765
6773
|
tier.fragmentError += level.fragmentError;
|
6766
6774
|
tier.videoRanges[level.videoRange] = (tier.videoRanges[level.videoRange] || 0) + 1;
|
@@ -7205,6 +7213,7 @@
|
|
7205
7213
|
var audioPreference = config.audioPreference,
|
7206
7214
|
videoPreference = config.videoPreference;
|
7207
7215
|
var audioTracksByGroup = this.audioTracksByGroup || (this.audioTracksByGroup = getAudioTracksByGroup(allAudioTracks));
|
7216
|
+
var minStartIndex = -1;
|
7208
7217
|
if (firstSelection) {
|
7209
7218
|
if (this.firstSelection !== -1) {
|
7210
7219
|
return this.firstSelection;
|
@@ -7215,7 +7224,9 @@
|
|
7215
7224
|
videoRanges = startTier.videoRanges,
|
7216
7225
|
minFramerate = startTier.minFramerate,
|
7217
7226
|
minBitrate = startTier.minBitrate,
|
7227
|
+
minIndex = startTier.minIndex,
|
7218
7228
|
preferHDR = startTier.preferHDR;
|
7229
|
+
minStartIndex = minIndex;
|
7219
7230
|
currentCodecSet = codecSet;
|
7220
7231
|
currentVideoRange = preferHDR ? videoRanges[videoRanges.length - 1] : videoRanges[0];
|
7221
7232
|
currentFrameRate = minFramerate;
|
@@ -7239,8 +7250,10 @@
|
|
7239
7250
|
// skip candidates which change codec-family or video-range,
|
7240
7251
|
// and which decrease or increase frame-rate for up and down-switch respectfully
|
7241
7252
|
if (currentCodecSet && levelInfo.codecSet !== currentCodecSet || currentVideoRange && levelInfo.videoRange !== currentVideoRange || upSwitch && currentFrameRate > levelInfo.frameRate || !upSwitch && currentFrameRate > 0 && currentFrameRate < levelInfo.frameRate || levelInfo.supportedResult && !((_levelInfo$supportedR = levelInfo.supportedResult.decodingInfoResults) != null && _levelInfo$supportedR[0].smooth)) {
|
7242
|
-
|
7243
|
-
|
7253
|
+
if (firstSelection && i !== minStartIndex) {
|
7254
|
+
levelsSkipped.push(i);
|
7255
|
+
return 0; // continue
|
7256
|
+
}
|
7244
7257
|
}
|
7245
7258
|
var levelDetails = levelInfo.details;
|
7246
7259
|
var avgDuration = (partCurrent ? levelDetails == null ? void 0 : levelDetails.partTarget : levelDetails == null ? void 0 : levelDetails.averagetargetduration) || currentFragDuration;
|
@@ -7275,7 +7288,7 @@
|
|
7275
7288
|
if (levelsSkipped.length) {
|
7276
7289
|
_this3.trace("Skipped level(s) " + levelsSkipped.join(',') + " of " + maxAutoLevel + " max with CODECS and VIDEO-RANGE:\"" + levels[levelsSkipped[0]].codecs + "\" " + levels[levelsSkipped[0]].videoRange + "; not compatible with \"" + level.codecs + "\" " + currentVideoRange);
|
7277
7290
|
}
|
7278
|
-
_this3.info("switch candidate:" + selectionBaseLevel + "->" + i + " adjustedbw(" + Math.round(adjustedbw) + ")-bitrate=" + Math.round(adjustedbw - bitrate) + " ttfb:" + ttfbEstimateSec.toFixed(1) + " avgDuration:" + avgDuration.toFixed(1) + " maxFetchDuration:" + maxFetchDuration.toFixed(1) + " fetchDuration:" + fetchDuration.toFixed(1) + " firstSelection:" + firstSelection + " codecSet:" +
|
7291
|
+
_this3.info("switch candidate:" + selectionBaseLevel + "->" + i + " adjustedbw(" + Math.round(adjustedbw) + ")-bitrate=" + Math.round(adjustedbw - bitrate) + " ttfb:" + ttfbEstimateSec.toFixed(1) + " avgDuration:" + avgDuration.toFixed(1) + " maxFetchDuration:" + maxFetchDuration.toFixed(1) + " fetchDuration:" + fetchDuration.toFixed(1) + " firstSelection:" + firstSelection + " codecSet:" + level.codecSet + " videoRange:" + level.videoRange + " hls.loadLevel:" + loadLevel);
|
7279
7292
|
}
|
7280
7293
|
if (firstSelection) {
|
7281
7294
|
_this3.firstSelection = i;
|
@@ -21361,7 +21374,7 @@
|
|
21361
21374
|
*/
|
21362
21375
|
_proto.setAudioOption = function setAudioOption(audioOption) {
|
21363
21376
|
var _this$audioTrackContr;
|
21364
|
-
return (_this$audioTrackContr = this.audioTrackController) == null ? void 0 : _this$audioTrackContr.setAudioOption(audioOption);
|
21377
|
+
return ((_this$audioTrackContr = this.audioTrackController) == null ? void 0 : _this$audioTrackContr.setAudioOption(audioOption)) || null;
|
21365
21378
|
}
|
21366
21379
|
/**
|
21367
21380
|
* Find and select the best matching subtitle track, making a level switch when a Group change is necessary.
|
@@ -21369,8 +21382,7 @@
|
|
21369
21382
|
*/;
|
21370
21383
|
_proto.setSubtitleOption = function setSubtitleOption(subtitleOption) {
|
21371
21384
|
var _this$subtitleTrackCo;
|
21372
|
-
(_this$subtitleTrackCo = this.subtitleTrackController) == null ? void 0 : _this$subtitleTrackCo.setSubtitleOption(subtitleOption);
|
21373
|
-
return null;
|
21385
|
+
return ((_this$subtitleTrackCo = this.subtitleTrackController) == null ? void 0 : _this$subtitleTrackCo.setSubtitleOption(subtitleOption)) || null;
|
21374
21386
|
}
|
21375
21387
|
|
21376
21388
|
/**
|
@@ -21895,7 +21907,7 @@
|
|
21895
21907
|
* Get the video-dev/hls.js package version.
|
21896
21908
|
*/
|
21897
21909
|
function get() {
|
21898
|
-
return "1.5.12-0.canary.
|
21910
|
+
return "1.5.12-0.canary.10352";
|
21899
21911
|
}
|
21900
21912
|
}, {
|
21901
21913
|
key: "Events",
|