hls.js 1.6.3-0.canary.11253 → 1.6.3-0.canary.11255
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.d.mts +8 -4
- package/dist/hls.d.ts +8 -4
- package/dist/hls.js +220 -166
- package/dist/hls.js.d.ts +8 -4
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +72 -31
- 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 +69 -30
- 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 +127 -84
- package/dist/hls.mjs.map +1 -1
- package/dist/hls.worker.js +1 -1
- package/package.json +1 -1
- package/src/config.ts +2 -0
- package/src/controller/audio-stream-controller.ts +39 -31
- package/src/controller/base-stream-controller.ts +17 -6
- package/src/controller/eme-controller.ts +47 -19
- package/src/controller/fragment-finders.ts +18 -14
- package/src/controller/interstitials-controller.ts +1 -1
- package/src/loader/key-loader.ts +42 -17
package/dist/hls.light.mjs
CHANGED
@@ -523,7 +523,7 @@ function enableLogs(debugConfig, context, id) {
|
|
523
523
|
// Some browsers don't allow to use bind on console object anyway
|
524
524
|
// fallback to default if needed
|
525
525
|
try {
|
526
|
-
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.3-0.canary.
|
526
|
+
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.3-0.canary.11255"}`);
|
527
527
|
} catch (e) {
|
528
528
|
/* log fn threw an exception. All logger methods are no-ops. */
|
529
529
|
return createLogger();
|
@@ -3707,7 +3707,6 @@ function findFragmentByPDT(fragments, PDTValue, maxFragLookUpTolerance) {
|
|
3707
3707
|
if (PDTValue >= (endPDT || 0)) {
|
3708
3708
|
return null;
|
3709
3709
|
}
|
3710
|
-
maxFragLookUpTolerance = maxFragLookUpTolerance || 0;
|
3711
3710
|
for (let seg = 0; seg < fragments.length; ++seg) {
|
3712
3711
|
const frag = fragments[seg];
|
3713
3712
|
if (pdtWithinToleranceTest(PDTValue, maxFragLookUpTolerance, frag)) {
|
@@ -3818,16 +3817,37 @@ function pdtWithinToleranceTest(pdtBufferEnd, maxFragLookUpTolerance, candidate)
|
|
3818
3817
|
const endProgramDateTime = candidate.endProgramDateTime || 0;
|
3819
3818
|
return endProgramDateTime - candidateLookupTolerance > pdtBufferEnd;
|
3820
3819
|
}
|
3821
|
-
function
|
3822
|
-
|
3823
|
-
if (
|
3824
|
-
|
3825
|
-
|
3826
|
-
|
3827
|
-
|
3828
|
-
|
3820
|
+
function findNearestWithCC(details, cc, pos) {
|
3821
|
+
if (details) {
|
3822
|
+
if (details.startCC <= cc && details.endCC >= cc) {
|
3823
|
+
let fragments = details.fragments;
|
3824
|
+
const {
|
3825
|
+
fragmentHint
|
3826
|
+
} = details;
|
3827
|
+
if (fragmentHint) {
|
3828
|
+
fragments = fragments.concat(fragmentHint);
|
3829
|
+
}
|
3830
|
+
let closest;
|
3831
|
+
BinarySearch.search(fragments, candidate => {
|
3832
|
+
if (candidate.cc < cc) {
|
3833
|
+
return 1;
|
3834
|
+
}
|
3835
|
+
if (candidate.cc > cc) {
|
3836
|
+
return -1;
|
3837
|
+
}
|
3838
|
+
closest = candidate;
|
3839
|
+
if (candidate.end <= pos) {
|
3840
|
+
return 1;
|
3841
|
+
}
|
3842
|
+
if (candidate.start > pos) {
|
3843
|
+
return -1;
|
3844
|
+
}
|
3845
|
+
return 0;
|
3846
|
+
});
|
3847
|
+
return closest || null;
|
3829
3848
|
}
|
3830
|
-
}
|
3849
|
+
}
|
3850
|
+
return null;
|
3831
3851
|
}
|
3832
3852
|
|
3833
3853
|
function isTimeoutError(error) {
|
@@ -8415,8 +8435,11 @@ class BaseStreamController extends TaskLoop {
|
|
8415
8435
|
if (this.fragCurrent === null) {
|
8416
8436
|
keyLoadingPromise = Promise.reject(new Error(`frag load aborted, context changed in KEY_LOADING`));
|
8417
8437
|
}
|
8418
|
-
} else if (!frag.encrypted
|
8419
|
-
this.keyLoader.loadClear(frag, details.encryptedFragments);
|
8438
|
+
} else if (!frag.encrypted) {
|
8439
|
+
keyLoadingPromise = this.keyLoader.loadClear(frag, details.encryptedFragments);
|
8440
|
+
if (keyLoadingPromise) {
|
8441
|
+
this.log(`[eme] blocking frag load until media-keys acquired`);
|
8442
|
+
}
|
8420
8443
|
}
|
8421
8444
|
const fragPrevious = this.fragPrevious;
|
8422
8445
|
if (isMediaFragment(frag) && (!fragPrevious || frag.sn !== fragPrevious.sn)) {
|
@@ -8771,7 +8794,7 @@ class BaseStreamController extends TaskLoop {
|
|
8771
8794
|
this.log(`LL-Part loading ON for initial live fragment`);
|
8772
8795
|
this.loadingParts = true;
|
8773
8796
|
}
|
8774
|
-
frag = this.getInitialLiveFragment(levelDetails
|
8797
|
+
frag = this.getInitialLiveFragment(levelDetails);
|
8775
8798
|
const mainStart = this.hls.startPosition;
|
8776
8799
|
const liveSyncPosition = this.hls.liveSyncPosition;
|
8777
8800
|
const startPosition = frag ? (mainStart !== -1 && mainStart >= start ? mainStart : liveSyncPosition) || frag.start : pos;
|
@@ -8868,7 +8891,8 @@ class BaseStreamController extends TaskLoop {
|
|
8868
8891
|
"sliding" of the playlist, which is its offset from the start of playback. After sliding we can compute the real
|
8869
8892
|
start and end times for each fragment in the playlist (after which this method will not need to be called).
|
8870
8893
|
*/
|
8871
|
-
getInitialLiveFragment(levelDetails
|
8894
|
+
getInitialLiveFragment(levelDetails) {
|
8895
|
+
const fragments = levelDetails.fragments;
|
8872
8896
|
const fragPrevious = this.fragPrevious;
|
8873
8897
|
let frag = null;
|
8874
8898
|
if (fragPrevious) {
|
@@ -8891,7 +8915,7 @@ class BaseStreamController extends TaskLoop {
|
|
8891
8915
|
// It's important to stay within the continuity range if available; otherwise the fragments in the playlist
|
8892
8916
|
// will have the wrong start times
|
8893
8917
|
if (!frag) {
|
8894
|
-
frag =
|
8918
|
+
frag = findNearestWithCC(levelDetails, fragPrevious.cc, fragPrevious.end);
|
8895
8919
|
if (frag) {
|
8896
8920
|
this.log(`Live playlist, switching playlist, load frag with same CC: ${frag.sn}`);
|
8897
8921
|
}
|
@@ -17763,6 +17787,8 @@ const hlsDefaultConfig = _objectSpread2(_objectSpread2({
|
|
17763
17787
|
// used by eme-controller
|
17764
17788
|
requestMediaKeySystemAccessFunc: null,
|
17765
17789
|
// used by eme-controller
|
17790
|
+
requireKeySystemAccessOnStart: false,
|
17791
|
+
// used by eme-controller
|
17766
17792
|
testBandwidth: true,
|
17767
17793
|
progressive: false,
|
17768
17794
|
lowLatencyMode: true,
|
@@ -19871,7 +19897,7 @@ function assignTrackIdsByGroup(tracks) {
|
|
19871
19897
|
});
|
19872
19898
|
}
|
19873
19899
|
|
19874
|
-
const version = "1.6.3-0.canary.
|
19900
|
+
const version = "1.6.3-0.canary.11255";
|
19875
19901
|
|
19876
19902
|
// ensure the worker ends up in the bundle
|
19877
19903
|
// If the worker should not be included this gets aliased to empty.js
|
@@ -21621,22 +21647,35 @@ class KeyLoader {
|
|
21621
21647
|
});
|
21622
21648
|
}
|
21623
21649
|
loadClear(loadingFrag, encryptedFragments) {
|
21624
|
-
if (this.emeController && this.config.emeEnabled) {
|
21625
|
-
// access key-system with nearest key on start (
|
21626
|
-
|
21627
|
-
|
21628
|
-
|
21629
|
-
|
21630
|
-
|
21631
|
-
|
21632
|
-
|
21633
|
-
|
21634
|
-
frag.
|
21635
|
-
|
21636
|
-
|
21650
|
+
if (this.emeController && this.config.emeEnabled && !this.emeController.getSelectedKeySystemFormats().length) {
|
21651
|
+
// access key-system with nearest key on start (loading frag is unencrypted)
|
21652
|
+
if (encryptedFragments.length) {
|
21653
|
+
const {
|
21654
|
+
sn,
|
21655
|
+
cc
|
21656
|
+
} = loadingFrag;
|
21657
|
+
for (let i = 0; i < encryptedFragments.length; i++) {
|
21658
|
+
const frag = encryptedFragments[i];
|
21659
|
+
if (cc <= frag.cc && (sn === 'initSegment' || frag.sn === 'initSegment' || sn < frag.sn)) {
|
21660
|
+
return this.emeController.selectKeySystemFormat(frag).then(keySystemFormat => {
|
21661
|
+
frag.setKeyFormat(keySystemFormat);
|
21662
|
+
if (this.emeController && this.config.requireKeySystemAccessOnStart) {
|
21663
|
+
const keySystem = emptyEsExports.keySystemFormatToKeySystemDomain(keySystemFormat);
|
21664
|
+
if (keySystem) {
|
21665
|
+
return this.emeController.getKeySystemAccess([keySystem]);
|
21666
|
+
}
|
21667
|
+
}
|
21668
|
+
});
|
21669
|
+
}
|
21670
|
+
}
|
21671
|
+
} else if (this.config.requireKeySystemAccessOnStart) {
|
21672
|
+
const keySystemsInConfig = emptyEsExports.getKeySystemsForConfig(this.config);
|
21673
|
+
if (keySystemsInConfig.length) {
|
21674
|
+
return this.emeController.getKeySystemAccess(keySystemsInConfig);
|
21637
21675
|
}
|
21638
21676
|
}
|
21639
21677
|
}
|
21678
|
+
return null;
|
21640
21679
|
}
|
21641
21680
|
load(frag) {
|
21642
21681
|
if (!frag.decryptdata && frag.encrypted && this.emeController && this.config.emeEnabled) {
|