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.js
CHANGED
@@ -1165,7 +1165,7 @@
|
|
1165
1165
|
// Some browsers don't allow to use bind on console object anyway
|
1166
1166
|
// fallback to default if needed
|
1167
1167
|
try {
|
1168
|
-
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.3-0.canary.
|
1168
|
+
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.3-0.canary.11255");
|
1169
1169
|
} catch (e) {
|
1170
1170
|
/* log fn threw an exception. All logger methods are no-ops. */
|
1171
1171
|
return createLogger();
|
@@ -4406,7 +4406,6 @@
|
|
4406
4406
|
if (PDTValue >= (endPDT || 0)) {
|
4407
4407
|
return null;
|
4408
4408
|
}
|
4409
|
-
maxFragLookUpTolerance = maxFragLookUpTolerance || 0;
|
4410
4409
|
for (var seg = 0; seg < fragments.length; ++seg) {
|
4411
4410
|
var frag = fragments[seg];
|
4412
4411
|
if (pdtWithinToleranceTest(PDTValue, maxFragLookUpTolerance, frag)) {
|
@@ -4532,16 +4531,35 @@
|
|
4532
4531
|
var endProgramDateTime = candidate.endProgramDateTime || 0;
|
4533
4532
|
return endProgramDateTime - candidateLookupTolerance > pdtBufferEnd;
|
4534
4533
|
}
|
4535
|
-
function
|
4536
|
-
|
4537
|
-
if (
|
4538
|
-
|
4539
|
-
|
4540
|
-
|
4541
|
-
|
4542
|
-
|
4534
|
+
function findNearestWithCC(details, cc, pos) {
|
4535
|
+
if (details) {
|
4536
|
+
if (details.startCC <= cc && details.endCC >= cc) {
|
4537
|
+
var fragments = details.fragments;
|
4538
|
+
var fragmentHint = details.fragmentHint;
|
4539
|
+
if (fragmentHint) {
|
4540
|
+
fragments = fragments.concat(fragmentHint);
|
4541
|
+
}
|
4542
|
+
var closest;
|
4543
|
+
BinarySearch.search(fragments, function (candidate) {
|
4544
|
+
if (candidate.cc < cc) {
|
4545
|
+
return 1;
|
4546
|
+
}
|
4547
|
+
if (candidate.cc > cc) {
|
4548
|
+
return -1;
|
4549
|
+
}
|
4550
|
+
closest = candidate;
|
4551
|
+
if (candidate.end <= pos) {
|
4552
|
+
return 1;
|
4553
|
+
}
|
4554
|
+
if (candidate.start > pos) {
|
4555
|
+
return -1;
|
4556
|
+
}
|
4557
|
+
return 0;
|
4558
|
+
});
|
4559
|
+
return closest || null;
|
4543
4560
|
}
|
4544
|
-
}
|
4561
|
+
}
|
4562
|
+
return null;
|
4545
4563
|
}
|
4546
4564
|
|
4547
4565
|
function isTimeoutError(error) {
|
@@ -15381,6 +15399,8 @@
|
|
15381
15399
|
// used by eme-controller
|
15382
15400
|
requestMediaKeySystemAccessFunc: null,
|
15383
15401
|
// used by eme-controller
|
15402
|
+
requireKeySystemAccessOnStart: false,
|
15403
|
+
// used by eme-controller
|
15384
15404
|
testBandwidth: true,
|
15385
15405
|
progressive: false,
|
15386
15406
|
lowLatencyMode: true,
|
@@ -17243,8 +17263,11 @@
|
|
17243
17263
|
if (this.fragCurrent === null) {
|
17244
17264
|
keyLoadingPromise = Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING"));
|
17245
17265
|
}
|
17246
|
-
} else if (!frag.encrypted
|
17247
|
-
this.keyLoader.loadClear(frag, details.encryptedFragments);
|
17266
|
+
} else if (!frag.encrypted) {
|
17267
|
+
keyLoadingPromise = this.keyLoader.loadClear(frag, details.encryptedFragments);
|
17268
|
+
if (keyLoadingPromise) {
|
17269
|
+
this.log("[eme] blocking frag load until media-keys acquired");
|
17270
|
+
}
|
17248
17271
|
}
|
17249
17272
|
var fragPrevious = this.fragPrevious;
|
17250
17273
|
if (isMediaFragment(frag) && (!fragPrevious || frag.sn !== fragPrevious.sn)) {
|
@@ -17600,7 +17623,7 @@
|
|
17600
17623
|
this.log("LL-Part loading ON for initial live fragment");
|
17601
17624
|
this.loadingParts = true;
|
17602
17625
|
}
|
17603
|
-
frag = this.getInitialLiveFragment(levelDetails
|
17626
|
+
frag = this.getInitialLiveFragment(levelDetails);
|
17604
17627
|
var mainStart = this.hls.startPosition;
|
17605
17628
|
var liveSyncPosition = this.hls.liveSyncPosition;
|
17606
17629
|
var startPosition = frag ? (mainStart !== -1 && mainStart >= start ? mainStart : liveSyncPosition) || frag.start : pos;
|
@@ -17693,7 +17716,8 @@
|
|
17693
17716
|
"sliding" of the playlist, which is its offset from the start of playback. After sliding we can compute the real
|
17694
17717
|
start and end times for each fragment in the playlist (after which this method will not need to be called).
|
17695
17718
|
*/;
|
17696
|
-
_proto.getInitialLiveFragment = function getInitialLiveFragment(levelDetails
|
17719
|
+
_proto.getInitialLiveFragment = function getInitialLiveFragment(levelDetails) {
|
17720
|
+
var fragments = levelDetails.fragments;
|
17697
17721
|
var fragPrevious = this.fragPrevious;
|
17698
17722
|
var frag = null;
|
17699
17723
|
if (fragPrevious) {
|
@@ -17716,7 +17740,7 @@
|
|
17716
17740
|
// It's important to stay within the continuity range if available; otherwise the fragments in the playlist
|
17717
17741
|
// will have the wrong start times
|
17718
17742
|
if (!frag) {
|
17719
|
-
frag =
|
17743
|
+
frag = findNearestWithCC(levelDetails, fragPrevious.cc, fragPrevious.end);
|
17720
17744
|
if (frag) {
|
17721
17745
|
this.log("Live playlist, switching playlist, load frag with same CC: " + frag.sn);
|
17722
17746
|
}
|
@@ -20500,7 +20524,7 @@
|
|
20500
20524
|
return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
|
20501
20525
|
}
|
20502
20526
|
|
20503
|
-
var version = "1.6.3-0.canary.
|
20527
|
+
var version = "1.6.3-0.canary.11255";
|
20504
20528
|
|
20505
20529
|
// ensure the worker ends up in the bundle
|
20506
20530
|
// If the worker should not be included this gets aliased to empty.js
|
@@ -22219,23 +22243,40 @@
|
|
22219
22243
|
};
|
22220
22244
|
_proto.loadClear = function loadClear(loadingFrag, encryptedFragments) {
|
22221
22245
|
var _this = this;
|
22222
|
-
if (this.emeController && this.config.emeEnabled) {
|
22223
|
-
// access key-system with nearest key on start (
|
22224
|
-
|
22225
|
-
|
22226
|
-
|
22227
|
-
var
|
22228
|
-
|
22229
|
-
|
22230
|
-
|
22231
|
-
|
22232
|
-
|
22246
|
+
if (this.emeController && this.config.emeEnabled && !this.emeController.getSelectedKeySystemFormats().length) {
|
22247
|
+
// access key-system with nearest key on start (loading frag is unencrypted)
|
22248
|
+
if (encryptedFragments.length) {
|
22249
|
+
var sn = loadingFrag.sn,
|
22250
|
+
cc = loadingFrag.cc;
|
22251
|
+
var _loop = function _loop() {
|
22252
|
+
var frag = encryptedFragments[i];
|
22253
|
+
if (cc <= frag.cc && (sn === 'initSegment' || frag.sn === 'initSegment' || sn < frag.sn)) {
|
22254
|
+
return {
|
22255
|
+
v: _this.emeController.selectKeySystemFormat(frag).then(function (keySystemFormat) {
|
22256
|
+
frag.setKeyFormat(keySystemFormat);
|
22257
|
+
if (_this.emeController && _this.config.requireKeySystemAccessOnStart) {
|
22258
|
+
var keySystem = emptyExports.keySystemFormatToKeySystemDomain(keySystemFormat);
|
22259
|
+
if (keySystem) {
|
22260
|
+
return _this.emeController.getKeySystemAccess([keySystem]);
|
22261
|
+
}
|
22262
|
+
}
|
22263
|
+
})
|
22264
|
+
};
|
22265
|
+
}
|
22266
|
+
},
|
22267
|
+
_ret;
|
22268
|
+
for (var i = 0; i < encryptedFragments.length; i++) {
|
22269
|
+
_ret = _loop();
|
22270
|
+
if (_ret) return _ret.v;
|
22271
|
+
}
|
22272
|
+
} else if (this.config.requireKeySystemAccessOnStart) {
|
22273
|
+
var keySystemsInConfig = emptyExports.getKeySystemsForConfig(this.config);
|
22274
|
+
if (keySystemsInConfig.length) {
|
22275
|
+
return this.emeController.getKeySystemAccess(keySystemsInConfig);
|
22233
22276
|
}
|
22234
|
-
};
|
22235
|
-
for (var i = 0; i < encryptedFragments.length; i++) {
|
22236
|
-
if (_loop()) break;
|
22237
22277
|
}
|
22238
22278
|
}
|
22279
|
+
return null;
|
22239
22280
|
};
|
22240
22281
|
_proto.load = function load(frag) {
|
22241
22282
|
var _this2 = this;
|