rx-player 3.28.0-dev.2022061700 → 3.28.0-dev.2022062000
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/CHANGELOG.md +4 -3
- package/VERSION +1 -1
- package/appveyor.yml +1 -1
- package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.d.ts +32 -11
- package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +18 -20
- package/dist/_esm5.processed/core/api/public_api.js +2 -2
- package/dist/_esm5.processed/core/decrypt/content_decryptor.js +60 -31
- package/dist/_esm5.processed/core/stream/adaptation/create_representation_estimator.js +1 -1
- package/dist/_esm5.processed/utils/reference.d.ts +27 -17
- package/dist/_esm5.processed/utils/reference.js +16 -1
- package/dist/rx-player.js +119 -62
- package/dist/rx-player.min.js +1 -1
- package/package.json +1 -1
- package/sonar-project.properties +1 -1
- package/src/core/adaptive/adaptive_representation_selector.ts +46 -33
- package/src/core/api/public_api.ts +2 -2
- package/src/core/decrypt/content_decryptor.ts +57 -23
- package/src/core/stream/adaptation/create_representation_estimator.ts +6 -6
- package/src/utils/reference.ts +33 -23
package/dist/rx-player.js
CHANGED
|
@@ -9919,23 +9919,9 @@ var ContentDecryptor = /*#__PURE__*/function (_EventEmitter) {
|
|
|
9919
9919
|
return;
|
|
9920
9920
|
}
|
|
9921
9921
|
|
|
9922
|
-
var linkedKeys
|
|
9923
|
-
|
|
9924
|
-
if (sessionInfo.source === "created-session"
|
|
9922
|
+
var linkedKeys = getKeyIdsLinkedToSession(initializationData, sessionInfo.record, options.singleLicensePer, sessionInfo.source === "created-session"
|
|
9925
9923
|
/* MediaKeySessionLoadingType.Created */
|
|
9926
|
-
)
|
|
9927
|
-
// When the license has been fetched, there might be implicit key ids
|
|
9928
|
-
// linked to the session depending on the `singleLicensePer` option.
|
|
9929
|
-
linkedKeys = getFetchedLicenseKeysInfo(initializationData, options.singleLicensePer, evt.value.whitelistedKeyIds, evt.value.blacklistedKeyIDs);
|
|
9930
|
-
} else {
|
|
9931
|
-
// When the MediaKeySession is just a cached/persisted one, we don't
|
|
9932
|
-
// have any concept of "implicit key id".
|
|
9933
|
-
linkedKeys = {
|
|
9934
|
-
whitelisted: evt.value.whitelistedKeyIds,
|
|
9935
|
-
blacklisted: evt.value.blacklistedKeyIDs
|
|
9936
|
-
};
|
|
9937
|
-
}
|
|
9938
|
-
|
|
9924
|
+
, evt.value.whitelistedKeyIds, evt.value.blacklistedKeyIDs);
|
|
9939
9925
|
sessionInfo.record.associateKeyIds(linkedKeys.whitelisted);
|
|
9940
9926
|
sessionInfo.record.associateKeyIds(linkedKeys.blacklisted);
|
|
9941
9927
|
sessionInfo.keyStatuses = {
|
|
@@ -10336,22 +10322,44 @@ var ContentDecryptorState;
|
|
|
10336
10322
|
ContentDecryptorState[ContentDecryptorState["Disposed"] = 4] = "Disposed";
|
|
10337
10323
|
})(ContentDecryptorState || (ContentDecryptorState = {}));
|
|
10338
10324
|
/**
|
|
10339
|
-
* Returns
|
|
10340
|
-
* a
|
|
10325
|
+
* Returns set of all usable and unusable keys - explicit or implicit - that are
|
|
10326
|
+
* linked to a `MediaKeySession`.
|
|
10341
10327
|
*
|
|
10342
10328
|
* In the RxPlayer, there is a concept of "explicit" key ids, which are key ids
|
|
10343
10329
|
* found in a license whose status can be known through the `keyStatuses`
|
|
10344
10330
|
* property from a `MediaKeySession`, and of "implicit" key ids, which are key
|
|
10345
10331
|
* ids which were expected to be in a fetched license, but apparently weren't.
|
|
10346
|
-
*
|
|
10347
|
-
* @param {
|
|
10348
|
-
*
|
|
10349
|
-
* @param {
|
|
10350
|
-
*
|
|
10332
|
+
*
|
|
10333
|
+
* @param {Object} initializationData - Initialization data object used to make
|
|
10334
|
+
* the request for the current license.
|
|
10335
|
+
* @param {Object} keySessionRecord - The `KeySessionRecord` associated with the
|
|
10336
|
+
* session that has been loaded. It might give supplementary information on
|
|
10337
|
+
* keys implicitly linked to the license.
|
|
10338
|
+
* @param {string|undefined} singleLicensePer - Setting allowing to indicate the
|
|
10339
|
+
* scope a given license should have.
|
|
10340
|
+
* @param {boolean} isCurrentLicense - If `true` the license has been fetched
|
|
10341
|
+
* especially for the current content.
|
|
10342
|
+
*
|
|
10343
|
+
* Knowing this allows to determine that if decryption keys that should have
|
|
10344
|
+
* been referenced in the fetched license (according to the `singleLicensePer`
|
|
10345
|
+
* setting) are missing, then the keys surely must have been voluntarly
|
|
10346
|
+
* removed from the license.
|
|
10347
|
+
*
|
|
10348
|
+
* If it is however set to `false`, it means that the license is an older
|
|
10349
|
+
* license that might have been linked to another content, thus we cannot make
|
|
10350
|
+
* that assumption.
|
|
10351
|
+
* @param {Array.<Uint8Array>} usableKeyIds - Key ids that are present in the
|
|
10352
|
+
* license and can be used.
|
|
10353
|
+
* @param {Array.<Uint8Array>} unusableKeyIds - Key ids that are present in the
|
|
10354
|
+
* license yet cannot be used.
|
|
10355
|
+
* @returns {Object} - Returns an object with the following properties:
|
|
10356
|
+
* - `whitelisted`: Array of key ids for keys that are known to be usable
|
|
10357
|
+
* - `blacklisted`: Array of key ids for keys that are considered unusable.
|
|
10358
|
+
* The qualities linked to those keys should not be played.
|
|
10351
10359
|
*/
|
|
10352
10360
|
|
|
10353
10361
|
|
|
10354
|
-
function
|
|
10362
|
+
function getKeyIdsLinkedToSession(initializationData, keySessionRecord, singleLicensePer, isCurrentLicense, usableKeyIds, unusableKeyIds) {
|
|
10355
10363
|
var _a;
|
|
10356
10364
|
/**
|
|
10357
10365
|
* Every key id associated with the MediaKeySession, starting with
|
|
@@ -10359,7 +10367,28 @@ function getFetchedLicenseKeysInfo(initializationData, singleLicensePer, usableK
|
|
|
10359
10367
|
*/
|
|
10360
10368
|
|
|
10361
10369
|
|
|
10362
|
-
var associatedKeyIds = [].concat(usableKeyIds, unusableKeyIds);
|
|
10370
|
+
var associatedKeyIds = [].concat(usableKeyIds, unusableKeyIds); // Add all key ids associated to the `KeySessionRecord` yet not in
|
|
10371
|
+
// `usableKeyIds` nor in `unusableKeyIds`
|
|
10372
|
+
|
|
10373
|
+
var allKnownKeyIds = keySessionRecord.getAssociatedKeyIds();
|
|
10374
|
+
|
|
10375
|
+
var _loop3 = function _loop3() {
|
|
10376
|
+
var kid = _step3.value;
|
|
10377
|
+
|
|
10378
|
+
if (!associatedKeyIds.some(function (ak) {
|
|
10379
|
+
return areKeyIdsEqual(ak, kid);
|
|
10380
|
+
})) {
|
|
10381
|
+
if (log/* default.hasLevel */.Z.hasLevel("DEBUG")) {
|
|
10382
|
+
log/* default.debug */.Z.debug("DRM: KeySessionRecord's key missing in the license, blacklisting it", (0,string_parsing/* bytesToHex */.ci)(kid));
|
|
10383
|
+
}
|
|
10384
|
+
|
|
10385
|
+
associatedKeyIds.push(kid);
|
|
10386
|
+
}
|
|
10387
|
+
};
|
|
10388
|
+
|
|
10389
|
+
for (var _iterator3 = content_decryptor_createForOfIteratorHelperLoose(allKnownKeyIds), _step3; !(_step3 = _iterator3()).done;) {
|
|
10390
|
+
_loop3();
|
|
10391
|
+
}
|
|
10363
10392
|
|
|
10364
10393
|
if (singleLicensePer !== undefined && singleLicensePer !== "init-data") {
|
|
10365
10394
|
// We want to add the current key ids in the blacklist if it is
|
|
@@ -10386,18 +10415,24 @@ function getFetchedLicenseKeysInfo(initializationData, singleLicensePer, usableK
|
|
|
10386
10415
|
});
|
|
10387
10416
|
|
|
10388
10417
|
if (missingKeyIds.length > 0) {
|
|
10418
|
+
if (log/* default.hasLevel */.Z.hasLevel("DEBUG")) {
|
|
10419
|
+
log/* default.debug */.Z.debug("DRM: init data keys missing in the license, blacklisting them", missingKeyIds.map(function (m) {
|
|
10420
|
+
return (0,string_parsing/* bytesToHex */.ci)(m);
|
|
10421
|
+
}).join(", "));
|
|
10422
|
+
}
|
|
10423
|
+
|
|
10389
10424
|
associatedKeyIds.push.apply(associatedKeyIds, missingKeyIds);
|
|
10390
10425
|
}
|
|
10391
10426
|
}
|
|
10392
10427
|
|
|
10393
|
-
if (content !== undefined) {
|
|
10428
|
+
if (isCurrentLicense && content !== undefined) {
|
|
10394
10429
|
if (singleLicensePer === "content") {
|
|
10395
10430
|
// Put it in a Set to automatically filter out duplicates (by ref)
|
|
10396
10431
|
var contentKeys = new Set();
|
|
10397
10432
|
var manifest = content.manifest;
|
|
10398
10433
|
|
|
10399
|
-
for (var
|
|
10400
|
-
var period =
|
|
10434
|
+
for (var _iterator4 = content_decryptor_createForOfIteratorHelperLoose(manifest.periods), _step4; !(_step4 = _iterator4()).done;) {
|
|
10435
|
+
var period = _step4.value;
|
|
10401
10436
|
addKeyIdsFromPeriod(contentKeys, period);
|
|
10402
10437
|
}
|
|
10403
10438
|
|
|
@@ -10405,8 +10440,8 @@ function getFetchedLicenseKeysInfo(initializationData, singleLicensePer, usableK
|
|
|
10405
10440
|
} else if (singleLicensePer === "periods") {
|
|
10406
10441
|
var _manifest = content.manifest;
|
|
10407
10442
|
|
|
10408
|
-
for (var
|
|
10409
|
-
var _period =
|
|
10443
|
+
for (var _iterator5 = content_decryptor_createForOfIteratorHelperLoose(_manifest.periods), _step5; !(_step5 = _iterator5()).done;) {
|
|
10444
|
+
var _period = _step5.value;
|
|
10410
10445
|
var periodKeys = new Set();
|
|
10411
10446
|
addKeyIdsFromPeriod(periodKeys, _period);
|
|
10412
10447
|
|
|
@@ -10449,7 +10484,7 @@ function getFetchedLicenseKeysInfo(initializationData, singleLicensePer, usableK
|
|
|
10449
10484
|
function mergeKeyIdSetIntoArray(set, arr) {
|
|
10450
10485
|
var setArr = Array.from(set.values());
|
|
10451
10486
|
|
|
10452
|
-
var
|
|
10487
|
+
var _loop4 = function _loop4() {
|
|
10453
10488
|
var kid = _setArr[_i3];
|
|
10454
10489
|
var isFound = arr.some(function (k) {
|
|
10455
10490
|
return areKeyIdsEqual(k, kid);
|
|
@@ -10461,20 +10496,20 @@ function mergeKeyIdSetIntoArray(set, arr) {
|
|
|
10461
10496
|
};
|
|
10462
10497
|
|
|
10463
10498
|
for (var _i3 = 0, _setArr = setArr; _i3 < _setArr.length; _i3++) {
|
|
10464
|
-
|
|
10499
|
+
_loop4();
|
|
10465
10500
|
}
|
|
10466
10501
|
}
|
|
10467
10502
|
|
|
10468
10503
|
function addKeyIdsFromPeriod(set, period) {
|
|
10469
|
-
for (var
|
|
10470
|
-
var adaptation =
|
|
10504
|
+
for (var _iterator6 = content_decryptor_createForOfIteratorHelperLoose(period.getAdaptations()), _step6; !(_step6 = _iterator6()).done;) {
|
|
10505
|
+
var adaptation = _step6.value;
|
|
10471
10506
|
|
|
10472
|
-
for (var
|
|
10473
|
-
var representation =
|
|
10507
|
+
for (var _iterator7 = content_decryptor_createForOfIteratorHelperLoose(adaptation.representations), _step7; !(_step7 = _iterator7()).done;) {
|
|
10508
|
+
var representation = _step7.value;
|
|
10474
10509
|
|
|
10475
10510
|
if (representation.contentProtections !== undefined && representation.contentProtections.keyIds !== undefined) {
|
|
10476
|
-
for (var
|
|
10477
|
-
var kidInf =
|
|
10511
|
+
for (var _iterator8 = content_decryptor_createForOfIteratorHelperLoose(representation.contentProtections.keyIds), _step8; !(_step8 = _iterator8()).done;) {
|
|
10512
|
+
var kidInf = _step8.value;
|
|
10478
10513
|
set.add(kidInf.keyId);
|
|
10479
10514
|
}
|
|
10480
10515
|
}
|
|
@@ -41379,7 +41414,7 @@ function createSharedReference(initialValue) {
|
|
|
41379
41414
|
|
|
41380
41415
|
/**
|
|
41381
41416
|
* Update the value of this shared reference.
|
|
41382
|
-
* @param {*}
|
|
41417
|
+
* @param {*} newVal
|
|
41383
41418
|
*/
|
|
41384
41419
|
setValue: function setValue(newVal) {
|
|
41385
41420
|
if (isFinished) {
|
|
@@ -41408,6 +41443,11 @@ function createSharedReference(initialValue) {
|
|
|
41408
41443
|
}
|
|
41409
41444
|
}
|
|
41410
41445
|
},
|
|
41446
|
+
|
|
41447
|
+
/**
|
|
41448
|
+
* Update the value of this shared reference only if it changed.
|
|
41449
|
+
* @param {*} newVal
|
|
41450
|
+
*/
|
|
41411
41451
|
setValueIfChanged: function setValueIfChanged(newVal) {
|
|
41412
41452
|
if (newVal !== value) {
|
|
41413
41453
|
this.setValue(newVal);
|
|
@@ -41525,6 +41565,18 @@ function createSharedReference(initialValue) {
|
|
|
41525
41565
|
}
|
|
41526
41566
|
};
|
|
41527
41567
|
}
|
|
41568
|
+
/**
|
|
41569
|
+
* Create a new `ISharedReference` based on another one by mapping over its
|
|
41570
|
+
* referenced value each time it is updated.
|
|
41571
|
+
* @param {Object} originalRef - The Original `ISharedReference` you wish to map
|
|
41572
|
+
* over.
|
|
41573
|
+
* @param {Function} mappingFn - The mapping function which will receives
|
|
41574
|
+
* `originalRef`'s value and outputs this new reference's value.
|
|
41575
|
+
* @param {Object | undefined} [cancellationSignal] - Optionally, a
|
|
41576
|
+
* `CancellationSignal` which will finish that reference when it emits.
|
|
41577
|
+
* @returns {Object} - The new, mapped, reference.
|
|
41578
|
+
*/
|
|
41579
|
+
|
|
41528
41580
|
function createMappedReference(originalRef, mappingFn, cancellationSignal) {
|
|
41529
41581
|
var newRef = createSharedReference(mappingFn(originalRef.getValue()));
|
|
41530
41582
|
originalRef.onUpdate(function mapOriginalReference(x) {
|
|
@@ -50557,8 +50609,10 @@ function selectOptimalRepresentation(representations, optimalBitrate, minBitrate
|
|
|
50557
50609
|
/**
|
|
50558
50610
|
* Select the most adapted Representation according to the network and buffer
|
|
50559
50611
|
* metrics it receives.
|
|
50612
|
+
*
|
|
50560
50613
|
* @param {Object} options - Initial configuration (see type definition)
|
|
50561
|
-
* @returns {Object} - Interface allowing to select a Representation
|
|
50614
|
+
* @returns {Object} - Interface allowing to select a Representation.
|
|
50615
|
+
* @see IRepresentationEstimator
|
|
50562
50616
|
*/
|
|
50563
50617
|
|
|
50564
50618
|
function createAdaptiveRepresentationSelector(options) {
|
|
@@ -50576,18 +50630,17 @@ function createAdaptiveRepresentationSelector(options) {
|
|
|
50576
50630
|
/**
|
|
50577
50631
|
* Returns Object emitting Representation estimates as well as callbacks
|
|
50578
50632
|
* allowing to helping it produce them.
|
|
50633
|
+
*
|
|
50634
|
+
* @see IRepresentationEstimator
|
|
50579
50635
|
* @param {Object} context
|
|
50580
|
-
* @param {Object} currentRepresentation
|
|
50581
|
-
*
|
|
50582
|
-
* @param {Object}
|
|
50583
|
-
*
|
|
50584
|
-
* @param {Object} playbackObserver - Emits regularly playback conditions
|
|
50585
|
-
* @param {Object} cancellationSignal - After this `CancellationSignal` emits,
|
|
50586
|
-
* estimates will stop to be emitted.
|
|
50636
|
+
* @param {Object} currentRepresentation
|
|
50637
|
+
* @param {Object} representations
|
|
50638
|
+
* @param {Object} playbackObserver
|
|
50639
|
+
* @param {Object} stopAllEstimates
|
|
50587
50640
|
* @returns {Array.<Object>}
|
|
50588
50641
|
*/
|
|
50589
50642
|
|
|
50590
|
-
return function getEstimates(context, currentRepresentation, representations, playbackObserver,
|
|
50643
|
+
return function getEstimates(context, currentRepresentation, representations, playbackObserver, stopAllEstimates) {
|
|
50591
50644
|
var type = context.adaptation.type;
|
|
50592
50645
|
|
|
50593
50646
|
var bandwidthEstimator = _getBandwidthEstimator(type);
|
|
@@ -50612,7 +50665,7 @@ function createAdaptiveRepresentationSelector(options) {
|
|
|
50612
50665
|
playbackObserver: playbackObserver,
|
|
50613
50666
|
representations: representations,
|
|
50614
50667
|
lowLatencyMode: lowLatencyMode
|
|
50615
|
-
},
|
|
50668
|
+
}, stopAllEstimates);
|
|
50616
50669
|
};
|
|
50617
50670
|
/**
|
|
50618
50671
|
* Returns interface allowing to estimate network throughtput for a given type.
|
|
@@ -50649,11 +50702,11 @@ function createAdaptiveRepresentationSelector(options) {
|
|
|
50649
50702
|
* events to help it doing those estimates.
|
|
50650
50703
|
*
|
|
50651
50704
|
* @param {Object} args
|
|
50652
|
-
* @param {Object}
|
|
50705
|
+
* @param {Object} stopAllEstimates
|
|
50653
50706
|
* @returns {Array.<Object>}
|
|
50654
50707
|
*/
|
|
50655
50708
|
|
|
50656
|
-
function getEstimateReference(_ref,
|
|
50709
|
+
function getEstimateReference(_ref, stopAllEstimates) {
|
|
50657
50710
|
var bandwidthEstimator = _ref.bandwidthEstimator,
|
|
50658
50711
|
context = _ref.context,
|
|
50659
50712
|
currentRepresentation = _ref.currentRepresentation,
|
|
@@ -50684,19 +50737,21 @@ function getEstimateReference(_ref, cancellationSignal) {
|
|
|
50684
50737
|
* configuration and to cancel them altogether.
|
|
50685
50738
|
*/
|
|
50686
50739
|
|
|
50687
|
-
var currentEstimatesCanceller = new task_canceller/* default */.ZP(
|
|
50688
|
-
|
|
50689
|
-
currentEstimatesCanceller.cancel();
|
|
50740
|
+
var currentEstimatesCanceller = new task_canceller/* default */.ZP({
|
|
50741
|
+
cancelOn: stopAllEstimates
|
|
50690
50742
|
}); // Create `ISharedReference` on which estimates will be emitted.
|
|
50691
50743
|
|
|
50692
50744
|
var estimateRef = createEstimateReference(manualBitrate.getValue(), representationsRef.getValue(), currentEstimatesCanceller.signal);
|
|
50693
50745
|
manualBitrate.onUpdate(restartEstimatesProductionFromCurrentConditions, {
|
|
50694
|
-
clearSignal:
|
|
50746
|
+
clearSignal: stopAllEstimates
|
|
50695
50747
|
});
|
|
50696
50748
|
representationsRef.onUpdate(restartEstimatesProductionFromCurrentConditions, {
|
|
50697
|
-
clearSignal:
|
|
50749
|
+
clearSignal: stopAllEstimates
|
|
50698
50750
|
});
|
|
50699
|
-
return
|
|
50751
|
+
return {
|
|
50752
|
+
estimates: estimateRef,
|
|
50753
|
+
callbacks: callbacks
|
|
50754
|
+
};
|
|
50700
50755
|
|
|
50701
50756
|
function createEstimateReference(manualBitrateVal, representations, innerCancellationSignal) {
|
|
50702
50757
|
if (manualBitrateVal >= 0) {
|
|
@@ -50942,7 +50997,9 @@ function getEstimateReference(_ref, cancellationSignal) {
|
|
|
50942
50997
|
var manualBitrateVal = manualBitrate.getValue();
|
|
50943
50998
|
var representations = representationsRef.getValue();
|
|
50944
50999
|
currentEstimatesCanceller.cancel();
|
|
50945
|
-
currentEstimatesCanceller = new task_canceller/* default */.ZP(
|
|
51000
|
+
currentEstimatesCanceller = new task_canceller/* default */.ZP({
|
|
51001
|
+
cancelOn: stopAllEstimates
|
|
51002
|
+
});
|
|
50946
51003
|
var newRef = createEstimateReference(manualBitrateVal, representations, currentEstimatesCanceller.signal);
|
|
50947
51004
|
newRef.onUpdate(function onNewEstimate(newEstimate) {
|
|
50948
51005
|
estimateRef.setValue(newEstimate);
|
|
@@ -55013,8 +55070,8 @@ function getRepresentationEstimate(content, representationEstimator, currentRepr
|
|
|
55013
55070
|
var unregisterCleanUp = cancellationSignal.register(cleanUp);
|
|
55014
55071
|
|
|
55015
55072
|
var _representationEstima = representationEstimator(content, currentRepresentation, representations, playbackObserver, cancellationSignal),
|
|
55016
|
-
estimateRef = _representationEstima
|
|
55017
|
-
abrCallbacks = _representationEstima
|
|
55073
|
+
estimateRef = _representationEstima.estimates,
|
|
55074
|
+
abrCallbacks = _representationEstima.callbacks;
|
|
55018
55075
|
|
|
55019
55076
|
return {
|
|
55020
55077
|
abrCallbacks: abrCallbacks,
|
|
@@ -61183,7 +61240,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
61183
61240
|
videoElement.preload = "auto";
|
|
61184
61241
|
_this.version =
|
|
61185
61242
|
/* PLAYER_VERSION */
|
|
61186
|
-
"3.28.0-dev.
|
|
61243
|
+
"3.28.0-dev.2022062000";
|
|
61187
61244
|
_this.log = log/* default */.Z;
|
|
61188
61245
|
_this.state = "STOPPED";
|
|
61189
61246
|
_this.videoElement = videoElement;
|
|
@@ -64008,7 +64065,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
64008
64065
|
|
|
64009
64066
|
Player.version =
|
|
64010
64067
|
/* PLAYER_VERSION */
|
|
64011
|
-
"3.28.0-dev.
|
|
64068
|
+
"3.28.0-dev.2022062000";
|
|
64012
64069
|
/* harmony default export */ var public_api = (Player);
|
|
64013
64070
|
;// CONCATENATED MODULE: ./src/core/api/index.ts
|
|
64014
64071
|
/**
|