rx-player 3.27.0-dev.2022032100 → 3.27.0-dev.2022032500
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 +3 -1
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.js +9 -11
- package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.js +16 -6
- package/dist/_esm5.processed/compat/eme/generate_key_request.d.ts +4 -6
- package/dist/_esm5.processed/compat/eme/generate_key_request.js +4 -6
- package/dist/_esm5.processed/config.d.ts +0 -3
- package/dist/_esm5.processed/core/api/public_api.js +2 -2
- package/dist/_esm5.processed/core/decrypt/content_decryptor.js +11 -3
- package/dist/_esm5.processed/core/decrypt/create_or_load_session.js +1 -1
- package/dist/_esm5.processed/core/decrypt/create_session.d.ts +3 -1
- package/dist/_esm5.processed/core/decrypt/create_session.js +15 -5
- package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.d.ts +94 -1
- package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +237 -96
- package/dist/_esm5.processed/core/stream/representation/append_segment_to_buffer.js +4 -3
- package/dist/_esm5.processed/default_config.d.ts +0 -27
- package/dist/_esm5.processed/default_config.js +0 -27
- package/dist/rx-player.js +727 -444
- package/dist/rx-player.min.js +1 -1
- package/package.json +1 -1
- package/sonar-project.properties +1 -1
- package/src/compat/eme/custom_media_keys/old_webkit_media_keys.ts +10 -12
- package/src/compat/eme/custom_media_keys/webkit_media_keys.ts +15 -8
- package/src/compat/eme/generate_key_request.ts +4 -6
- package/src/core/api/public_api.ts +2 -2
- package/src/core/decrypt/content_decryptor.ts +15 -4
- package/src/core/decrypt/create_or_load_session.ts +4 -1
- package/src/core/decrypt/create_session.ts +23 -9
- package/src/core/decrypt/utils/loaded_sessions_store.ts +254 -102
- package/src/core/stream/representation/append_segment_to_buffer.ts +17 -13
- package/src/default_config.ts +0 -30
package/dist/rx-player.js
CHANGED
|
@@ -624,18 +624,23 @@ var OldWebkitMediaKeySession = /*#__PURE__*/function (_EventEmitter) {
|
|
|
624
624
|
_this.sessionId = "";
|
|
625
625
|
_this._closeSession = noop/* default */.Z; // Just here to make TypeScript happy
|
|
626
626
|
|
|
627
|
-
_this.closed = new Promise(function (resolve) {
|
|
628
|
-
_this._closeSession = resolve;
|
|
629
|
-
});
|
|
630
627
|
_this.keyStatuses = new Map();
|
|
631
628
|
_this.expiration = NaN;
|
|
632
629
|
|
|
633
|
-
|
|
630
|
+
var onSessionRelatedEvent = function onSessionRelatedEvent(evt) {
|
|
634
631
|
_this.trigger(evt.type, evt);
|
|
635
632
|
};
|
|
636
633
|
|
|
634
|
+
_this.closed = new Promise(function (resolve) {
|
|
635
|
+
_this._closeSession = function () {
|
|
636
|
+
["keymessage", "message", "keyadded", "ready", "keyerror", "error"].forEach(function (evt) {
|
|
637
|
+
return mediaElement.removeEventListener(evt, onSessionRelatedEvent);
|
|
638
|
+
});
|
|
639
|
+
resolve();
|
|
640
|
+
};
|
|
641
|
+
});
|
|
637
642
|
["keymessage", "message", "keyadded", "ready", "keyerror", "error"].forEach(function (evt) {
|
|
638
|
-
return mediaElement.addEventListener(evt,
|
|
643
|
+
return mediaElement.addEventListener(evt, onSessionRelatedEvent);
|
|
639
644
|
});
|
|
640
645
|
return _this;
|
|
641
646
|
}
|
|
@@ -692,8 +697,6 @@ var OldWebkitMediaKeySession = /*#__PURE__*/function (_EventEmitter) {
|
|
|
692
697
|
var _this4 = this;
|
|
693
698
|
|
|
694
699
|
return new Promise(function (resolve) {
|
|
695
|
-
_this4._unbindSession();
|
|
696
|
-
|
|
697
700
|
_this4._closeSession();
|
|
698
701
|
|
|
699
702
|
resolve();
|
|
@@ -715,14 +718,6 @@ var OldWebkitMediaKeySession = /*#__PURE__*/function (_EventEmitter) {
|
|
|
715
718
|
return Promise.resolve();
|
|
716
719
|
};
|
|
717
720
|
|
|
718
|
-
_proto._unbindSession = function _unbindSession() {
|
|
719
|
-
var _this5 = this;
|
|
720
|
-
|
|
721
|
-
["keymessage", "message", "keyadded", "ready", "keyerror", "error"].forEach(function (evt) {
|
|
722
|
-
return _this5._vid.removeEventListener(evt, _this5._onSessionRelatedEvent);
|
|
723
|
-
});
|
|
724
|
-
};
|
|
725
|
-
|
|
726
721
|
return OldWebkitMediaKeySession;
|
|
727
722
|
}(event_emitter/* default */.Z);
|
|
728
723
|
|
|
@@ -941,11 +936,6 @@ var WebkitMediaKeySession = /*#__PURE__*/function (_EventEmitter) {
|
|
|
941
936
|
});
|
|
942
937
|
_this.keyStatuses = new Map();
|
|
943
938
|
_this.expiration = NaN;
|
|
944
|
-
|
|
945
|
-
_this._onEvent = function (evt) {
|
|
946
|
-
_this.trigger(evt.type, evt);
|
|
947
|
-
};
|
|
948
|
-
|
|
949
939
|
return _this;
|
|
950
940
|
}
|
|
951
941
|
|
|
@@ -961,9 +951,20 @@ var WebkitMediaKeySession = /*#__PURE__*/function (_EventEmitter) {
|
|
|
961
951
|
}
|
|
962
952
|
|
|
963
953
|
try {
|
|
954
|
+
var uInt8Arraylicense;
|
|
955
|
+
|
|
956
|
+
if (license instanceof ArrayBuffer) {
|
|
957
|
+
uInt8Arraylicense = new Uint8Array(license);
|
|
958
|
+
} else if (license instanceof Uint8Array) {
|
|
959
|
+
uInt8Arraylicense = license;
|
|
960
|
+
} else {
|
|
961
|
+
uInt8Arraylicense = new Uint8Array(license.buffer);
|
|
962
|
+
}
|
|
964
963
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
965
964
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
966
|
-
|
|
965
|
+
|
|
966
|
+
|
|
967
|
+
resolve(_this2._nativeSession.update(uInt8Arraylicense));
|
|
967
968
|
/* eslint-enable @typescript-eslint/no-unsafe-member-access */
|
|
968
969
|
} catch (err) {
|
|
969
970
|
reject(err);
|
|
@@ -1047,6 +1048,10 @@ var WebkitMediaKeySession = /*#__PURE__*/function (_EventEmitter) {
|
|
|
1047
1048
|
|
|
1048
1049
|
this._unbindSession(); // If previous session was linked
|
|
1049
1050
|
|
|
1051
|
+
|
|
1052
|
+
var onEvent = function onEvent(evt) {
|
|
1053
|
+
_this5.trigger(evt.type, evt);
|
|
1054
|
+
};
|
|
1050
1055
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
1051
1056
|
|
|
1052
1057
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
@@ -1055,12 +1060,12 @@ var WebkitMediaKeySession = /*#__PURE__*/function (_EventEmitter) {
|
|
|
1055
1060
|
|
|
1056
1061
|
|
|
1057
1062
|
["keymessage", "message", "keyadded", "ready", "keyerror", "error"].forEach(function (evt) {
|
|
1058
|
-
return session.addEventListener(evt,
|
|
1063
|
+
return session.addEventListener(evt, onEvent);
|
|
1059
1064
|
});
|
|
1060
1065
|
|
|
1061
1066
|
this._unbindSession = function () {
|
|
1062
1067
|
["keymessage", "message", "keyadded", "ready", "keyerror", "error"].forEach(function (evt) {
|
|
1063
|
-
return session.removeEventListener(evt,
|
|
1068
|
+
return session.removeEventListener(evt, onEvent);
|
|
1064
1069
|
});
|
|
1065
1070
|
};
|
|
1066
1071
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
@@ -3216,36 +3221,6 @@ var DEFAULT_CONFIG = {
|
|
|
3216
3221
|
*/
|
|
3217
3222
|
EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION: 1000,
|
|
3218
3223
|
|
|
3219
|
-
/**
|
|
3220
|
-
* Attempts to closing a MediaKeySession can fail, most likely because the
|
|
3221
|
-
* MediaKeySession was not initialized yet.
|
|
3222
|
-
* When we consider that we're in one of these case, we will retry to close it.
|
|
3223
|
-
*
|
|
3224
|
-
* To avoid going into an infinite loop of retry, this number indicates a
|
|
3225
|
-
* maximum number of attemps we're going to make (`0` meaning no retry at all,
|
|
3226
|
-
* `1` only one retry and so on).
|
|
3227
|
-
*/
|
|
3228
|
-
EME_SESSION_CLOSING_MAX_RETRY: 5,
|
|
3229
|
-
|
|
3230
|
-
/**
|
|
3231
|
-
* When closing a MediaKeySession failed due to the reasons explained for the
|
|
3232
|
-
* `EME_SESSION_CLOSING_MAX_RETRY` config property, we may (among other
|
|
3233
|
-
* triggers) choose to wait a delay raising exponentially at each retry before
|
|
3234
|
-
* that new attempt.
|
|
3235
|
-
* This value indicates the initial value for this delay, in milliseconds.
|
|
3236
|
-
*/
|
|
3237
|
-
EME_SESSION_CLOSING_INITIAL_DELAY: 100,
|
|
3238
|
-
|
|
3239
|
-
/**
|
|
3240
|
-
* When closing a MediaKeySession failed due to the reasons explained for the
|
|
3241
|
-
* `EME_SESSION_CLOSING_MAX_RETRY` config property, we may (among other
|
|
3242
|
-
* triggers) choose to wait a delay raising exponentially at each retry before
|
|
3243
|
-
* that new attempt.
|
|
3244
|
-
* This value indicates the maximum possible value for this delay, in
|
|
3245
|
-
* milliseconds.
|
|
3246
|
-
*/
|
|
3247
|
-
EME_SESSION_CLOSING_MAX_DELAY: 1000,
|
|
3248
|
-
|
|
3249
3224
|
/**
|
|
3250
3225
|
* After loading a persistent MediaKeySession, the RxPlayer needs to ensure
|
|
3251
3226
|
* that its keys still allow to decrypt a content.
|
|
@@ -4722,146 +4697,6 @@ function getInitData(encryptedEvent) {
|
|
|
4722
4697
|
values: values
|
|
4723
4698
|
};
|
|
4724
4699
|
}
|
|
4725
|
-
// EXTERNAL MODULE: ./src/parsers/containers/isobmff/get_box.ts
|
|
4726
|
-
var get_box = __webpack_require__(2297);
|
|
4727
|
-
;// CONCATENATED MODULE: ./src/compat/eme/generate_key_request.ts
|
|
4728
|
-
/**
|
|
4729
|
-
* Copyright 2015 CANAL+ Group
|
|
4730
|
-
*
|
|
4731
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4732
|
-
* you may not use this file except in compliance with the License.
|
|
4733
|
-
* You may obtain a copy of the License at
|
|
4734
|
-
*
|
|
4735
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4736
|
-
*
|
|
4737
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
4738
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4739
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4740
|
-
* See the License for the specific language governing permissions and
|
|
4741
|
-
* limitations under the License.
|
|
4742
|
-
*/
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
/**
|
|
4748
|
-
* Modify "initialization data" sent to a `generateKeyRequest` EME call to
|
|
4749
|
-
* improve the player's browser compatibility:
|
|
4750
|
-
*
|
|
4751
|
-
* 1. some browsers/CDM have problems when the CENC PSSH box is the first
|
|
4752
|
-
* encountered PSSH box in the initialization data (for the moment just
|
|
4753
|
-
* Edge was noted with this behavior).
|
|
4754
|
-
* We found however that it works on every browser when the CENC pssh
|
|
4755
|
-
* box(es) is/are the last box(es) encountered.
|
|
4756
|
-
*
|
|
4757
|
-
* To that end, we move CENC pssh boxes at the end of the initialization
|
|
4758
|
-
* data in this function.
|
|
4759
|
-
*
|
|
4760
|
-
* 2. Some poorly encoded/packaged contents communicate both a CENC with a
|
|
4761
|
-
* pssh version of 0 and one with a version of 1. We found out that this is
|
|
4762
|
-
* not always well handled on some devices/browsers (on Edge and some other
|
|
4763
|
-
* embedded devices that shall remain nameless for now!).
|
|
4764
|
-
*
|
|
4765
|
-
* Here this function will filter out CENC pssh with a version different to
|
|
4766
|
-
* 1 when one(s) with a version of 1 is/are already present.
|
|
4767
|
-
*
|
|
4768
|
-
* If the initData is unrecognized or if a CENC PSSH is not found, this function
|
|
4769
|
-
* throws.
|
|
4770
|
-
* @param {Uint8Array} initData - Initialization data you want to patch
|
|
4771
|
-
* @returns {Uint8Array} - Initialization data, patched
|
|
4772
|
-
*/
|
|
4773
|
-
|
|
4774
|
-
function patchInitData(initData) {
|
|
4775
|
-
log/* default.info */.Z.info("Compat: Trying to move CENC PSSH from init data at the end of it.");
|
|
4776
|
-
var foundCencV1 = false;
|
|
4777
|
-
var concatenatedCencs = new Uint8Array();
|
|
4778
|
-
var resInitData = new Uint8Array();
|
|
4779
|
-
var offset = 0;
|
|
4780
|
-
|
|
4781
|
-
while (offset < initData.length) {
|
|
4782
|
-
if (initData.length < offset + 8 || (0,byte_parsing/* be4toi */.pX)(initData, offset + 4) !== PSSH_TO_INTEGER) {
|
|
4783
|
-
log/* default.warn */.Z.warn("Compat: unrecognized initialization data. Cannot patch it.");
|
|
4784
|
-
throw new Error("Compat: unrecognized initialization data. Cannot patch it.");
|
|
4785
|
-
}
|
|
4786
|
-
|
|
4787
|
-
var len = (0,byte_parsing/* be4toi */.pX)(new Uint8Array(initData), offset);
|
|
4788
|
-
|
|
4789
|
-
if (offset + len > initData.length) {
|
|
4790
|
-
log/* default.warn */.Z.warn("Compat: unrecognized initialization data. Cannot patch it.");
|
|
4791
|
-
throw new Error("Compat: unrecognized initialization data. Cannot patch it.");
|
|
4792
|
-
}
|
|
4793
|
-
|
|
4794
|
-
var currentPSSH = initData.subarray(offset, offset + len); // yep
|
|
4795
|
-
|
|
4796
|
-
if (initData[offset + 12] === 0x10 && initData[offset + 13] === 0x77 && initData[offset + 14] === 0xEF && initData[offset + 15] === 0xEC && initData[offset + 16] === 0xC0 && initData[offset + 17] === 0xB2 && initData[offset + 18] === 0x4D && initData[offset + 19] === 0x02 && initData[offset + 20] === 0xAC && initData[offset + 21] === 0xE3 && initData[offset + 22] === 0x3C && initData[offset + 23] === 0x1E && initData[offset + 24] === 0x52 && initData[offset + 25] === 0xE2 && initData[offset + 26] === 0xFB && initData[offset + 27] === 0x4B) {
|
|
4797
|
-
var cencOffsets = (0,get_box/* getNextBoxOffsets */.Xj)(currentPSSH);
|
|
4798
|
-
var version = cencOffsets === null ? undefined : currentPSSH[cencOffsets[1]];
|
|
4799
|
-
log/* default.info */.Z.info("Compat: CENC PSSH found with version", version);
|
|
4800
|
-
|
|
4801
|
-
if (version === undefined) {
|
|
4802
|
-
log/* default.warn */.Z.warn("Compat: could not read version of CENC PSSH");
|
|
4803
|
-
} else if (foundCencV1 === (version === 1)) {
|
|
4804
|
-
// Either `concatenatedCencs` only contains v1 or does not contain any
|
|
4805
|
-
concatenatedCencs = (0,byte_parsing/* concat */.zo)(concatenatedCencs, currentPSSH);
|
|
4806
|
-
} else if (version === 1) {
|
|
4807
|
-
log/* default.warn */.Z.warn("Compat: cenc version 1 encountered, " + "removing every other cenc pssh box.");
|
|
4808
|
-
concatenatedCencs = currentPSSH;
|
|
4809
|
-
foundCencV1 = true;
|
|
4810
|
-
} else {
|
|
4811
|
-
log/* default.warn */.Z.warn("Compat: filtering out cenc pssh box with wrong version", version);
|
|
4812
|
-
}
|
|
4813
|
-
} else {
|
|
4814
|
-
resInitData = (0,byte_parsing/* concat */.zo)(resInitData, currentPSSH);
|
|
4815
|
-
}
|
|
4816
|
-
|
|
4817
|
-
offset += len;
|
|
4818
|
-
}
|
|
4819
|
-
|
|
4820
|
-
if (offset !== initData.length) {
|
|
4821
|
-
log/* default.warn */.Z.warn("Compat: unrecognized initialization data. Cannot patch it.");
|
|
4822
|
-
throw new Error("Compat: unrecognized initialization data. Cannot patch it.");
|
|
4823
|
-
}
|
|
4824
|
-
|
|
4825
|
-
return (0,byte_parsing/* concat */.zo)(resInitData, concatenatedCencs);
|
|
4826
|
-
}
|
|
4827
|
-
/**
|
|
4828
|
-
* Generate a request from session.
|
|
4829
|
-
* @param {MediaKeySession} session - MediaKeySession on which the request will
|
|
4830
|
-
* be done.
|
|
4831
|
-
* @param {Uint8Array} initData - Initialization data given e.g. by the
|
|
4832
|
-
* "encrypted" event for the corresponding request.
|
|
4833
|
-
* @param {string} initDataType - Initialization data type given e.g. by the
|
|
4834
|
-
* "encrypted" event for the corresponding request.
|
|
4835
|
-
* @param {string} sessionType - Type of session you want to generate. Consult
|
|
4836
|
-
* EME Specification for more information on session types.
|
|
4837
|
-
* @returns {Promise} - Emit when done. Errors if fails.
|
|
4838
|
-
*/
|
|
4839
|
-
|
|
4840
|
-
function generateKeyRequest(session, initializationDataType, initializationData) {
|
|
4841
|
-
log/* default.debug */.Z.debug("Compat: Calling generateRequest on the MediaKeySession");
|
|
4842
|
-
var patchedInit;
|
|
4843
|
-
|
|
4844
|
-
try {
|
|
4845
|
-
patchedInit = patchInitData(initializationData);
|
|
4846
|
-
} catch (_e) {
|
|
4847
|
-
patchedInit = initializationData;
|
|
4848
|
-
}
|
|
4849
|
-
|
|
4850
|
-
var initDataType = initializationDataType !== null && initializationDataType !== void 0 ? initializationDataType : "";
|
|
4851
|
-
return session.generateRequest(initDataType, patchedInit)["catch"](function (error) {
|
|
4852
|
-
if (initDataType !== "" || !(error instanceof TypeError)) {
|
|
4853
|
-
throw error;
|
|
4854
|
-
} // On newer EME versions of the specification, the initialization data
|
|
4855
|
-
// type given to generateRequest cannot be an empty string (it returns
|
|
4856
|
-
// a rejected promise with a TypeError in that case).
|
|
4857
|
-
// Retry with a default "cenc" value for initialization data type if
|
|
4858
|
-
// we're in that condition.
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
log/* default.warn */.Z.warn("Compat: error while calling `generateRequest` with an empty " + "initialization data type. Retrying with a default \"cenc\" value.", error);
|
|
4862
|
-
return session.generateRequest("cenc", patchedInit);
|
|
4863
|
-
});
|
|
4864
|
-
}
|
|
4865
4700
|
// EXTERNAL MODULE: ./src/compat/event_listeners.ts + 6 modules
|
|
4866
4701
|
var event_listeners = __webpack_require__(4804);
|
|
4867
4702
|
// EXTERNAL MODULE: ./src/config.ts + 2 modules
|
|
@@ -4979,92 +4814,6 @@ function _attachMediaKeys() {
|
|
|
4979
4814
|
}));
|
|
4980
4815
|
return _attachMediaKeys.apply(this, arguments);
|
|
4981
4816
|
}
|
|
4982
|
-
;// CONCATENATED MODULE: ./src/compat/eme/load_session.ts
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
/**
|
|
4987
|
-
* Copyright 2015 CANAL+ Group
|
|
4988
|
-
*
|
|
4989
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4990
|
-
* you may not use this file except in compliance with the License.
|
|
4991
|
-
* You may obtain a copy of the License at
|
|
4992
|
-
*
|
|
4993
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4994
|
-
*
|
|
4995
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
4996
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4997
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4998
|
-
* See the License for the specific language governing permissions and
|
|
4999
|
-
* limitations under the License.
|
|
5000
|
-
*/
|
|
5001
|
-
|
|
5002
|
-
var EME_WAITING_DELAY_LOADED_SESSION_EMPTY_KEYSTATUSES = 100;
|
|
5003
|
-
/**
|
|
5004
|
-
* Load a persistent session, based on its `sessionId`, on the given
|
|
5005
|
-
* MediaKeySession.
|
|
5006
|
-
*
|
|
5007
|
-
* Returns an Observable which emits:
|
|
5008
|
-
* - true if the persistent MediaKeySession was found and loaded
|
|
5009
|
-
* - false if no persistent MediaKeySession was found with that `sessionId`.
|
|
5010
|
-
* Then completes.
|
|
5011
|
-
*
|
|
5012
|
-
* The Observable throws if anything goes wrong in the process.
|
|
5013
|
-
* @param {MediaKeySession} session
|
|
5014
|
-
* @param {string} sessionId
|
|
5015
|
-
* @returns {Observable}
|
|
5016
|
-
*/
|
|
5017
|
-
|
|
5018
|
-
function loadSession(_x, _x2) {
|
|
5019
|
-
return _loadSession.apply(this, arguments);
|
|
5020
|
-
}
|
|
5021
|
-
|
|
5022
|
-
function _loadSession() {
|
|
5023
|
-
_loadSession = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee(session, sessionId) {
|
|
5024
|
-
var isLoaded;
|
|
5025
|
-
return regenerator_default().wrap(function _callee$(_context) {
|
|
5026
|
-
while (1) {
|
|
5027
|
-
switch (_context.prev = _context.next) {
|
|
5028
|
-
case 0:
|
|
5029
|
-
log/* default.info */.Z.info("Compat/DRM: Load persisted session", sessionId);
|
|
5030
|
-
_context.next = 3;
|
|
5031
|
-
return session.load(sessionId);
|
|
5032
|
-
|
|
5033
|
-
case 3:
|
|
5034
|
-
isLoaded = _context.sent;
|
|
5035
|
-
|
|
5036
|
-
if (!(!isLoaded || session.keyStatuses.size > 0)) {
|
|
5037
|
-
_context.next = 6;
|
|
5038
|
-
break;
|
|
5039
|
-
}
|
|
5040
|
-
|
|
5041
|
-
return _context.abrupt("return", isLoaded);
|
|
5042
|
-
|
|
5043
|
-
case 6:
|
|
5044
|
-
return _context.abrupt("return", new Promise(function (resolve) {
|
|
5045
|
-
session.addEventListener("keystatuseschange", resolveWithLoadedStatus);
|
|
5046
|
-
var timeout = setTimeout(resolveWithLoadedStatus, EME_WAITING_DELAY_LOADED_SESSION_EMPTY_KEYSTATUSES);
|
|
5047
|
-
|
|
5048
|
-
function resolveWithLoadedStatus() {
|
|
5049
|
-
cleanUp();
|
|
5050
|
-
resolve(isLoaded);
|
|
5051
|
-
}
|
|
5052
|
-
|
|
5053
|
-
function cleanUp() {
|
|
5054
|
-
clearTimeout(timeout);
|
|
5055
|
-
session.removeEventListener("keystatuseschange", resolveWithLoadedStatus);
|
|
5056
|
-
}
|
|
5057
|
-
}));
|
|
5058
|
-
|
|
5059
|
-
case 7:
|
|
5060
|
-
case "end":
|
|
5061
|
-
return _context.stop();
|
|
5062
|
-
}
|
|
5063
|
-
}
|
|
5064
|
-
}, _callee);
|
|
5065
|
-
}));
|
|
5066
|
-
return _loadSession.apply(this, arguments);
|
|
5067
|
-
}
|
|
5068
4817
|
;// CONCATENATED MODULE: ./src/core/decrypt/utils/is_session_usable.ts
|
|
5069
4818
|
/**
|
|
5070
4819
|
* Copyright 2015 CANAL+ Group
|
|
@@ -5141,7 +4890,6 @@ function isSessionUsable(loadedSession) {
|
|
|
5141
4890
|
*/
|
|
5142
4891
|
|
|
5143
4892
|
|
|
5144
|
-
|
|
5145
4893
|
/**
|
|
5146
4894
|
* Create a new Session or load a persistent one on the given MediaKeys,
|
|
5147
4895
|
* according to wanted settings and what is currently stored.
|
|
@@ -5155,10 +4903,11 @@ function isSessionUsable(loadedSession) {
|
|
|
5155
4903
|
* @param {Object} stores
|
|
5156
4904
|
* @param {Object} initData
|
|
5157
4905
|
* @param {string} wantedSessionType
|
|
4906
|
+
* @param {Object} cancelSignal
|
|
5158
4907
|
* @returns {Promise}
|
|
5159
4908
|
*/
|
|
5160
4909
|
|
|
5161
|
-
function createSession(stores, initData, wantedSessionType) {
|
|
4910
|
+
function createSession(stores, initData, wantedSessionType, cancelSignal) {
|
|
5162
4911
|
var loadedSessionsStore = stores.loadedSessionsStore,
|
|
5163
4912
|
persistentSessionsStore = stores.persistentSessionsStore;
|
|
5164
4913
|
|
|
@@ -5169,7 +4918,7 @@ function createSession(stores, initData, wantedSessionType) {
|
|
|
5169
4918
|
return createTemporarySession(loadedSessionsStore, initData);
|
|
5170
4919
|
}
|
|
5171
4920
|
|
|
5172
|
-
return createAndTryToRetrievePersistentSession(loadedSessionsStore, persistentSessionsStore, initData);
|
|
4921
|
+
return createAndTryToRetrievePersistentSession(loadedSessionsStore, persistentSessionsStore, initData, cancelSignal);
|
|
5173
4922
|
}
|
|
5174
4923
|
/**
|
|
5175
4924
|
* Create a new temporary MediaKeySession linked to the given initData and
|
|
@@ -5195,16 +4944,17 @@ function createTemporarySession(loadedSessionsStore, initData) {
|
|
|
5195
4944
|
* @param {Object} loadedSessionsStore
|
|
5196
4945
|
* @param {Object} persistentSessionsStore
|
|
5197
4946
|
* @param {Object} initData
|
|
4947
|
+
* @param {Object} cancelSignal
|
|
5198
4948
|
* @returns {Promise}
|
|
5199
4949
|
*/
|
|
5200
4950
|
|
|
5201
4951
|
|
|
5202
|
-
function createAndTryToRetrievePersistentSession(_x, _x2, _x3) {
|
|
4952
|
+
function createAndTryToRetrievePersistentSession(_x, _x2, _x3, _x4) {
|
|
5203
4953
|
return _createAndTryToRetrievePersistentSession.apply(this, arguments);
|
|
5204
4954
|
}
|
|
5205
4955
|
|
|
5206
4956
|
function _createAndTryToRetrievePersistentSession() {
|
|
5207
|
-
_createAndTryToRetrievePersistentSession = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee2(loadedSessionsStore, persistentSessionsStore, initData) {
|
|
4957
|
+
_createAndTryToRetrievePersistentSession = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee2(loadedSessionsStore, persistentSessionsStore, initData, cancelSignal) {
|
|
5208
4958
|
var entry, storedEntry, hasLoadedSession, recreatePersistentSession, _recreatePersistentSession;
|
|
5209
4959
|
|
|
5210
4960
|
return regenerator_default().wrap(function _callee2$(_context2) {
|
|
@@ -5218,6 +4968,14 @@ function _createAndTryToRetrievePersistentSession() {
|
|
|
5218
4968
|
while (1) {
|
|
5219
4969
|
switch (_context.prev = _context.next) {
|
|
5220
4970
|
case 0:
|
|
4971
|
+
if (!(cancelSignal.cancellationError !== null)) {
|
|
4972
|
+
_context.next = 2;
|
|
4973
|
+
break;
|
|
4974
|
+
}
|
|
4975
|
+
|
|
4976
|
+
throw cancelSignal.cancellationError;
|
|
4977
|
+
|
|
4978
|
+
case 2:
|
|
5221
4979
|
log/* default.info */.Z.info("DRM: Removing previous persistent session.");
|
|
5222
4980
|
persistentEntry = persistentSessionsStore.get(initData);
|
|
5223
4981
|
|
|
@@ -5225,10 +4983,18 @@ function _createAndTryToRetrievePersistentSession() {
|
|
|
5225
4983
|
persistentSessionsStore["delete"](persistentEntry.sessionId);
|
|
5226
4984
|
}
|
|
5227
4985
|
|
|
5228
|
-
_context.next =
|
|
4986
|
+
_context.next = 7;
|
|
5229
4987
|
return loadedSessionsStore.closeSession(entry.mediaKeySession);
|
|
5230
4988
|
|
|
5231
|
-
case
|
|
4989
|
+
case 7:
|
|
4990
|
+
if (!(cancelSignal.cancellationError !== null)) {
|
|
4991
|
+
_context.next = 9;
|
|
4992
|
+
break;
|
|
4993
|
+
}
|
|
4994
|
+
|
|
4995
|
+
throw cancelSignal.cancellationError;
|
|
4996
|
+
|
|
4997
|
+
case 9:
|
|
5232
4998
|
newEntry = loadedSessionsStore.createSession(initData, "persistent-license");
|
|
5233
4999
|
return _context.abrupt("return", {
|
|
5234
5000
|
type: "created-session"
|
|
@@ -5237,7 +5003,7 @@ function _createAndTryToRetrievePersistentSession() {
|
|
|
5237
5003
|
value: newEntry
|
|
5238
5004
|
});
|
|
5239
5005
|
|
|
5240
|
-
case
|
|
5006
|
+
case 11:
|
|
5241
5007
|
case "end":
|
|
5242
5008
|
return _context.stop();
|
|
5243
5009
|
}
|
|
@@ -5251,12 +5017,20 @@ function _createAndTryToRetrievePersistentSession() {
|
|
|
5251
5017
|
return _recreatePersistentSession.apply(this, arguments);
|
|
5252
5018
|
};
|
|
5253
5019
|
|
|
5020
|
+
if (!(cancelSignal.cancellationError !== null)) {
|
|
5021
|
+
_context2.next = 4;
|
|
5022
|
+
break;
|
|
5023
|
+
}
|
|
5024
|
+
|
|
5025
|
+
throw cancelSignal.cancellationError;
|
|
5026
|
+
|
|
5027
|
+
case 4:
|
|
5254
5028
|
log/* default.info */.Z.info("DRM: Creating persistent MediaKeySession");
|
|
5255
5029
|
entry = loadedSessionsStore.createSession(initData, "persistent-license");
|
|
5256
5030
|
storedEntry = persistentSessionsStore.getAndReuse(initData);
|
|
5257
5031
|
|
|
5258
5032
|
if (!(storedEntry === null)) {
|
|
5259
|
-
_context2.next =
|
|
5033
|
+
_context2.next = 9;
|
|
5260
5034
|
break;
|
|
5261
5035
|
}
|
|
5262
5036
|
|
|
@@ -5267,16 +5041,16 @@ function _createAndTryToRetrievePersistentSession() {
|
|
|
5267
5041
|
value: entry
|
|
5268
5042
|
});
|
|
5269
5043
|
|
|
5270
|
-
case
|
|
5271
|
-
_context2.prev =
|
|
5272
|
-
_context2.next =
|
|
5273
|
-
return
|
|
5044
|
+
case 9:
|
|
5045
|
+
_context2.prev = 9;
|
|
5046
|
+
_context2.next = 12;
|
|
5047
|
+
return loadedSessionsStore.loadPersistentSession(entry.mediaKeySession, storedEntry.sessionId);
|
|
5274
5048
|
|
|
5275
|
-
case
|
|
5049
|
+
case 12:
|
|
5276
5050
|
hasLoadedSession = _context2.sent;
|
|
5277
5051
|
|
|
5278
5052
|
if (hasLoadedSession) {
|
|
5279
|
-
_context2.next =
|
|
5053
|
+
_context2.next = 17;
|
|
5280
5054
|
break;
|
|
5281
5055
|
}
|
|
5282
5056
|
|
|
@@ -5289,9 +5063,9 @@ function _createAndTryToRetrievePersistentSession() {
|
|
|
5289
5063
|
value: entry
|
|
5290
5064
|
});
|
|
5291
5065
|
|
|
5292
|
-
case
|
|
5066
|
+
case 17:
|
|
5293
5067
|
if (!(hasLoadedSession && isSessionUsable(entry.mediaKeySession))) {
|
|
5294
|
-
_context2.next =
|
|
5068
|
+
_context2.next = 21;
|
|
5295
5069
|
break;
|
|
5296
5070
|
}
|
|
5297
5071
|
|
|
@@ -5304,23 +5078,23 @@ function _createAndTryToRetrievePersistentSession() {
|
|
|
5304
5078
|
value: entry
|
|
5305
5079
|
});
|
|
5306
5080
|
|
|
5307
|
-
case
|
|
5081
|
+
case 21:
|
|
5308
5082
|
// Unusable persistent session: recreate a new session from scratch.
|
|
5309
5083
|
log/* default.warn */.Z.warn("DRM: Previous persistent session not usable anymore.");
|
|
5310
5084
|
return _context2.abrupt("return", recreatePersistentSession());
|
|
5311
5085
|
|
|
5312
|
-
case
|
|
5313
|
-
_context2.prev =
|
|
5314
|
-
_context2.t0 = _context2["catch"](
|
|
5086
|
+
case 25:
|
|
5087
|
+
_context2.prev = 25;
|
|
5088
|
+
_context2.t0 = _context2["catch"](9);
|
|
5315
5089
|
log/* default.warn */.Z.warn("DRM: Unable to load persistent session: " + (_context2.t0 instanceof Error ? _context2.t0.toString() : "Unknown Error"));
|
|
5316
5090
|
return _context2.abrupt("return", recreatePersistentSession());
|
|
5317
5091
|
|
|
5318
|
-
case
|
|
5092
|
+
case 29:
|
|
5319
5093
|
case "end":
|
|
5320
5094
|
return _context2.stop();
|
|
5321
5095
|
}
|
|
5322
5096
|
}
|
|
5323
|
-
}, _callee2, null, [[
|
|
5097
|
+
}, _callee2, null, [[9, 25]]);
|
|
5324
5098
|
}));
|
|
5325
5099
|
return _createAndTryToRetrievePersistentSession.apply(this, arguments);
|
|
5326
5100
|
}
|
|
@@ -5516,7 +5290,7 @@ function _createOrLoadSession() {
|
|
|
5516
5290
|
|
|
5517
5291
|
case 20:
|
|
5518
5292
|
_context.next = 22;
|
|
5519
|
-
return createSession(stores, initializationData, wantedSessionType);
|
|
5293
|
+
return createSession(stores, initializationData, wantedSessionType, cancelSignal);
|
|
5520
5294
|
|
|
5521
5295
|
case 22:
|
|
5522
5296
|
evt = _context.sent;
|
|
@@ -5915,6 +5689,230 @@ function getMediaKeySystemAccess(mediaElement, keySystemsConfigs, cancelSignal)
|
|
|
5915
5689
|
return _recursivelyTestKeySystems.apply(this, arguments);
|
|
5916
5690
|
}
|
|
5917
5691
|
}
|
|
5692
|
+
// EXTERNAL MODULE: ./src/parsers/containers/isobmff/get_box.ts
|
|
5693
|
+
var get_box = __webpack_require__(2297);
|
|
5694
|
+
;// CONCATENATED MODULE: ./src/compat/eme/generate_key_request.ts
|
|
5695
|
+
/**
|
|
5696
|
+
* Copyright 2015 CANAL+ Group
|
|
5697
|
+
*
|
|
5698
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5699
|
+
* you may not use this file except in compliance with the License.
|
|
5700
|
+
* You may obtain a copy of the License at
|
|
5701
|
+
*
|
|
5702
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5703
|
+
*
|
|
5704
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5705
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5706
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5707
|
+
* See the License for the specific language governing permissions and
|
|
5708
|
+
* limitations under the License.
|
|
5709
|
+
*/
|
|
5710
|
+
|
|
5711
|
+
|
|
5712
|
+
|
|
5713
|
+
|
|
5714
|
+
/**
|
|
5715
|
+
* Modify "initialization data" sent to a `generateKeyRequest` EME call to
|
|
5716
|
+
* improve the player's browser compatibility:
|
|
5717
|
+
*
|
|
5718
|
+
* 1. some browsers/CDM have problems when the CENC PSSH box is the first
|
|
5719
|
+
* encountered PSSH box in the initialization data (for the moment just
|
|
5720
|
+
* Edge was noted with this behavior).
|
|
5721
|
+
* We found however that it works on every browser when the CENC pssh
|
|
5722
|
+
* box(es) is/are the last box(es) encountered.
|
|
5723
|
+
*
|
|
5724
|
+
* To that end, we move CENC pssh boxes at the end of the initialization
|
|
5725
|
+
* data in this function.
|
|
5726
|
+
*
|
|
5727
|
+
* 2. Some poorly encoded/packaged contents communicate both a CENC with a
|
|
5728
|
+
* pssh version of 0 and one with a version of 1. We found out that this is
|
|
5729
|
+
* not always well handled on some devices/browsers (on Edge and some other
|
|
5730
|
+
* embedded devices that shall remain nameless for now!).
|
|
5731
|
+
*
|
|
5732
|
+
* Here this function will filter out CENC pssh with a version different to
|
|
5733
|
+
* 1 when one(s) with a version of 1 is/are already present.
|
|
5734
|
+
*
|
|
5735
|
+
* If the initData is unrecognized or if a CENC PSSH is not found, this function
|
|
5736
|
+
* throws.
|
|
5737
|
+
* @param {Uint8Array} initData - Initialization data you want to patch
|
|
5738
|
+
* @returns {Uint8Array} - Initialization data, patched
|
|
5739
|
+
*/
|
|
5740
|
+
|
|
5741
|
+
function patchInitData(initData) {
|
|
5742
|
+
log/* default.info */.Z.info("Compat: Trying to move CENC PSSH from init data at the end of it.");
|
|
5743
|
+
var foundCencV1 = false;
|
|
5744
|
+
var concatenatedCencs = new Uint8Array();
|
|
5745
|
+
var resInitData = new Uint8Array();
|
|
5746
|
+
var offset = 0;
|
|
5747
|
+
|
|
5748
|
+
while (offset < initData.length) {
|
|
5749
|
+
if (initData.length < offset + 8 || (0,byte_parsing/* be4toi */.pX)(initData, offset + 4) !== PSSH_TO_INTEGER) {
|
|
5750
|
+
log/* default.warn */.Z.warn("Compat: unrecognized initialization data. Cannot patch it.");
|
|
5751
|
+
throw new Error("Compat: unrecognized initialization data. Cannot patch it.");
|
|
5752
|
+
}
|
|
5753
|
+
|
|
5754
|
+
var len = (0,byte_parsing/* be4toi */.pX)(new Uint8Array(initData), offset);
|
|
5755
|
+
|
|
5756
|
+
if (offset + len > initData.length) {
|
|
5757
|
+
log/* default.warn */.Z.warn("Compat: unrecognized initialization data. Cannot patch it.");
|
|
5758
|
+
throw new Error("Compat: unrecognized initialization data. Cannot patch it.");
|
|
5759
|
+
}
|
|
5760
|
+
|
|
5761
|
+
var currentPSSH = initData.subarray(offset, offset + len); // yep
|
|
5762
|
+
|
|
5763
|
+
if (initData[offset + 12] === 0x10 && initData[offset + 13] === 0x77 && initData[offset + 14] === 0xEF && initData[offset + 15] === 0xEC && initData[offset + 16] === 0xC0 && initData[offset + 17] === 0xB2 && initData[offset + 18] === 0x4D && initData[offset + 19] === 0x02 && initData[offset + 20] === 0xAC && initData[offset + 21] === 0xE3 && initData[offset + 22] === 0x3C && initData[offset + 23] === 0x1E && initData[offset + 24] === 0x52 && initData[offset + 25] === 0xE2 && initData[offset + 26] === 0xFB && initData[offset + 27] === 0x4B) {
|
|
5764
|
+
var cencOffsets = (0,get_box/* getNextBoxOffsets */.Xj)(currentPSSH);
|
|
5765
|
+
var version = cencOffsets === null ? undefined : currentPSSH[cencOffsets[1]];
|
|
5766
|
+
log/* default.info */.Z.info("Compat: CENC PSSH found with version", version);
|
|
5767
|
+
|
|
5768
|
+
if (version === undefined) {
|
|
5769
|
+
log/* default.warn */.Z.warn("Compat: could not read version of CENC PSSH");
|
|
5770
|
+
} else if (foundCencV1 === (version === 1)) {
|
|
5771
|
+
// Either `concatenatedCencs` only contains v1 or does not contain any
|
|
5772
|
+
concatenatedCencs = (0,byte_parsing/* concat */.zo)(concatenatedCencs, currentPSSH);
|
|
5773
|
+
} else if (version === 1) {
|
|
5774
|
+
log/* default.warn */.Z.warn("Compat: cenc version 1 encountered, " + "removing every other cenc pssh box.");
|
|
5775
|
+
concatenatedCencs = currentPSSH;
|
|
5776
|
+
foundCencV1 = true;
|
|
5777
|
+
} else {
|
|
5778
|
+
log/* default.warn */.Z.warn("Compat: filtering out cenc pssh box with wrong version", version);
|
|
5779
|
+
}
|
|
5780
|
+
} else {
|
|
5781
|
+
resInitData = (0,byte_parsing/* concat */.zo)(resInitData, currentPSSH);
|
|
5782
|
+
}
|
|
5783
|
+
|
|
5784
|
+
offset += len;
|
|
5785
|
+
}
|
|
5786
|
+
|
|
5787
|
+
if (offset !== initData.length) {
|
|
5788
|
+
log/* default.warn */.Z.warn("Compat: unrecognized initialization data. Cannot patch it.");
|
|
5789
|
+
throw new Error("Compat: unrecognized initialization data. Cannot patch it.");
|
|
5790
|
+
}
|
|
5791
|
+
|
|
5792
|
+
return (0,byte_parsing/* concat */.zo)(resInitData, concatenatedCencs);
|
|
5793
|
+
}
|
|
5794
|
+
/**
|
|
5795
|
+
* Generate a request from session.
|
|
5796
|
+
* @param {MediaKeySession} session - MediaKeySession on which the request will
|
|
5797
|
+
* be done.
|
|
5798
|
+
* @param {string} initializationDataType - Initialization data type given e.g.
|
|
5799
|
+
* by the "encrypted" event for the corresponding request.
|
|
5800
|
+
* @param {Uint8Array} initializationData - Initialization data given e.g. by
|
|
5801
|
+
* the "encrypted" event for the corresponding request.
|
|
5802
|
+
* @returns {Promise} - Emit when done. Errors if fails.
|
|
5803
|
+
*/
|
|
5804
|
+
|
|
5805
|
+
function generateKeyRequest(session, initializationDataType, initializationData) {
|
|
5806
|
+
log/* default.debug */.Z.debug("Compat: Calling generateRequest on the MediaKeySession");
|
|
5807
|
+
var patchedInit;
|
|
5808
|
+
|
|
5809
|
+
try {
|
|
5810
|
+
patchedInit = patchInitData(initializationData);
|
|
5811
|
+
} catch (_e) {
|
|
5812
|
+
patchedInit = initializationData;
|
|
5813
|
+
}
|
|
5814
|
+
|
|
5815
|
+
var initDataType = initializationDataType !== null && initializationDataType !== void 0 ? initializationDataType : "";
|
|
5816
|
+
return session.generateRequest(initDataType, patchedInit)["catch"](function (error) {
|
|
5817
|
+
if (initDataType !== "" || !(error instanceof TypeError)) {
|
|
5818
|
+
throw error;
|
|
5819
|
+
} // On newer EME versions of the specification, the initialization data
|
|
5820
|
+
// type given to generateRequest cannot be an empty string (it returns
|
|
5821
|
+
// a rejected promise with a TypeError in that case).
|
|
5822
|
+
// Retry with a default "cenc" value for initialization data type if
|
|
5823
|
+
// we're in that condition.
|
|
5824
|
+
|
|
5825
|
+
|
|
5826
|
+
log/* default.warn */.Z.warn("Compat: error while calling `generateRequest` with an empty " + "initialization data type. Retrying with a default \"cenc\" value.", error);
|
|
5827
|
+
return session.generateRequest("cenc", patchedInit);
|
|
5828
|
+
});
|
|
5829
|
+
}
|
|
5830
|
+
;// CONCATENATED MODULE: ./src/compat/eme/load_session.ts
|
|
5831
|
+
|
|
5832
|
+
|
|
5833
|
+
|
|
5834
|
+
/**
|
|
5835
|
+
* Copyright 2015 CANAL+ Group
|
|
5836
|
+
*
|
|
5837
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5838
|
+
* you may not use this file except in compliance with the License.
|
|
5839
|
+
* You may obtain a copy of the License at
|
|
5840
|
+
*
|
|
5841
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5842
|
+
*
|
|
5843
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5844
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5845
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5846
|
+
* See the License for the specific language governing permissions and
|
|
5847
|
+
* limitations under the License.
|
|
5848
|
+
*/
|
|
5849
|
+
|
|
5850
|
+
var EME_WAITING_DELAY_LOADED_SESSION_EMPTY_KEYSTATUSES = 100;
|
|
5851
|
+
/**
|
|
5852
|
+
* Load a persistent session, based on its `sessionId`, on the given
|
|
5853
|
+
* MediaKeySession.
|
|
5854
|
+
*
|
|
5855
|
+
* Returns an Observable which emits:
|
|
5856
|
+
* - true if the persistent MediaKeySession was found and loaded
|
|
5857
|
+
* - false if no persistent MediaKeySession was found with that `sessionId`.
|
|
5858
|
+
* Then completes.
|
|
5859
|
+
*
|
|
5860
|
+
* The Observable throws if anything goes wrong in the process.
|
|
5861
|
+
* @param {MediaKeySession} session
|
|
5862
|
+
* @param {string} sessionId
|
|
5863
|
+
* @returns {Observable}
|
|
5864
|
+
*/
|
|
5865
|
+
|
|
5866
|
+
function loadSession(_x, _x2) {
|
|
5867
|
+
return _loadSession.apply(this, arguments);
|
|
5868
|
+
}
|
|
5869
|
+
|
|
5870
|
+
function _loadSession() {
|
|
5871
|
+
_loadSession = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee(session, sessionId) {
|
|
5872
|
+
var isLoaded;
|
|
5873
|
+
return regenerator_default().wrap(function _callee$(_context) {
|
|
5874
|
+
while (1) {
|
|
5875
|
+
switch (_context.prev = _context.next) {
|
|
5876
|
+
case 0:
|
|
5877
|
+
log/* default.info */.Z.info("Compat/DRM: Load persisted session", sessionId);
|
|
5878
|
+
_context.next = 3;
|
|
5879
|
+
return session.load(sessionId);
|
|
5880
|
+
|
|
5881
|
+
case 3:
|
|
5882
|
+
isLoaded = _context.sent;
|
|
5883
|
+
|
|
5884
|
+
if (!(!isLoaded || session.keyStatuses.size > 0)) {
|
|
5885
|
+
_context.next = 6;
|
|
5886
|
+
break;
|
|
5887
|
+
}
|
|
5888
|
+
|
|
5889
|
+
return _context.abrupt("return", isLoaded);
|
|
5890
|
+
|
|
5891
|
+
case 6:
|
|
5892
|
+
return _context.abrupt("return", new Promise(function (resolve) {
|
|
5893
|
+
session.addEventListener("keystatuseschange", resolveWithLoadedStatus);
|
|
5894
|
+
var timeout = setTimeout(resolveWithLoadedStatus, EME_WAITING_DELAY_LOADED_SESSION_EMPTY_KEYSTATUSES);
|
|
5895
|
+
|
|
5896
|
+
function resolveWithLoadedStatus() {
|
|
5897
|
+
cleanUp();
|
|
5898
|
+
resolve(isLoaded);
|
|
5899
|
+
}
|
|
5900
|
+
|
|
5901
|
+
function cleanUp() {
|
|
5902
|
+
clearTimeout(timeout);
|
|
5903
|
+
session.removeEventListener("keystatuseschange", resolveWithLoadedStatus);
|
|
5904
|
+
}
|
|
5905
|
+
}));
|
|
5906
|
+
|
|
5907
|
+
case 7:
|
|
5908
|
+
case "end":
|
|
5909
|
+
return _context.stop();
|
|
5910
|
+
}
|
|
5911
|
+
}
|
|
5912
|
+
}, _callee);
|
|
5913
|
+
}));
|
|
5914
|
+
return _loadSession.apply(this, arguments);
|
|
5915
|
+
}
|
|
5918
5916
|
// EXTERNAL MODULE: ./src/utils/cancellable_sleep.ts
|
|
5919
5917
|
var cancellable_sleep = __webpack_require__(7864);
|
|
5920
5918
|
;// CONCATENATED MODULE: ./src/compat/eme/close_session.ts
|
|
@@ -6411,8 +6409,6 @@ function loaded_sessions_store_arrayLikeToArray(arr, len) { if (len == null || l
|
|
|
6411
6409
|
|
|
6412
6410
|
|
|
6413
6411
|
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
6412
|
/**
|
|
6417
6413
|
* Create and store MediaKeySessions linked to a single MediaKeys
|
|
6418
6414
|
* instance.
|
|
@@ -6434,7 +6430,7 @@ var LoadedSessionsStore = /*#__PURE__*/function () {
|
|
|
6434
6430
|
}
|
|
6435
6431
|
/**
|
|
6436
6432
|
* Create a new MediaKeySession and store it in this store.
|
|
6437
|
-
* @param {Object}
|
|
6433
|
+
* @param {Object} initData
|
|
6438
6434
|
* @param {string} sessionType
|
|
6439
6435
|
* @returns {Object}
|
|
6440
6436
|
*/
|
|
@@ -6452,7 +6448,12 @@ var LoadedSessionsStore = /*#__PURE__*/function () {
|
|
|
6452
6448
|
var entry = {
|
|
6453
6449
|
mediaKeySession: mediaKeySession,
|
|
6454
6450
|
sessionType: sessionType,
|
|
6455
|
-
keySessionRecord: keySessionRecord
|
|
6451
|
+
keySessionRecord: keySessionRecord,
|
|
6452
|
+
isGeneratingRequest: false,
|
|
6453
|
+
isLoadingPersistentSession: false,
|
|
6454
|
+
closingStatus: {
|
|
6455
|
+
type: "none"
|
|
6456
|
+
}
|
|
6456
6457
|
};
|
|
6457
6458
|
|
|
6458
6459
|
if (!(0,is_null_or_undefined/* default */.Z)(mediaKeySession.closed)) {
|
|
@@ -6470,11 +6471,7 @@ var LoadedSessionsStore = /*#__PURE__*/function () {
|
|
|
6470
6471
|
|
|
6471
6472
|
log/* default.debug */.Z.debug("DRM-LSS: Add MediaKeySession", entry.sessionType);
|
|
6472
6473
|
|
|
6473
|
-
this._storage.push({
|
|
6474
|
-
keySessionRecord: keySessionRecord,
|
|
6475
|
-
mediaKeySession: mediaKeySession,
|
|
6476
|
-
sessionType: sessionType
|
|
6477
|
-
});
|
|
6474
|
+
this._storage.push(Object.assign({}, entry));
|
|
6478
6475
|
|
|
6479
6476
|
return entry;
|
|
6480
6477
|
}
|
|
@@ -6501,29 +6498,49 @@ var LoadedSessionsStore = /*#__PURE__*/function () {
|
|
|
6501
6498
|
|
|
6502
6499
|
this._storage.push(stored);
|
|
6503
6500
|
|
|
6504
|
-
return {
|
|
6505
|
-
keySessionRecord: stored.keySessionRecord,
|
|
6506
|
-
mediaKeySession: stored.mediaKeySession,
|
|
6507
|
-
sessionType: stored.sessionType
|
|
6508
|
-
};
|
|
6501
|
+
return Object.assign({}, stored);
|
|
6509
6502
|
}
|
|
6510
6503
|
}
|
|
6511
6504
|
|
|
6512
6505
|
return null;
|
|
6513
6506
|
}
|
|
6514
6507
|
/**
|
|
6515
|
-
*
|
|
6508
|
+
* Get `LoadedSessionsStore`'s entry for a given MediaKeySession.
|
|
6509
|
+
* Returns `null` if the given MediaKeySession is not stored in the
|
|
6516
6510
|
* `LoadedSessionsStore`.
|
|
6517
|
-
*
|
|
6511
|
+
* @param {MediaKeySession} mediaKeySession
|
|
6512
|
+
* @returns {Object|null}
|
|
6513
|
+
*/
|
|
6514
|
+
;
|
|
6515
|
+
|
|
6516
|
+
_proto.getEntryForSession = function getEntryForSession(mediaKeySession) {
|
|
6517
|
+
for (var i = this._storage.length - 1; i >= 0; i--) {
|
|
6518
|
+
var stored = this._storage[i];
|
|
6519
|
+
|
|
6520
|
+
if (stored.mediaKeySession === mediaKeySession) {
|
|
6521
|
+
return Object.assign({}, stored);
|
|
6522
|
+
}
|
|
6523
|
+
}
|
|
6524
|
+
|
|
6525
|
+
return null;
|
|
6526
|
+
}
|
|
6527
|
+
/**
|
|
6528
|
+
* Generate a license request on the given MediaKeySession, while indicating
|
|
6529
|
+
* to the LoadedSessionsStore that a license-request is pending so
|
|
6530
|
+
* session-closing orders are properly scheduled after it is done.
|
|
6518
6531
|
* @param {Object} mediaKeySession
|
|
6532
|
+
* @param {string} initializationDataType - Initialization data type given
|
|
6533
|
+
* e.g. by the "encrypted" event for the corresponding request.
|
|
6534
|
+
* @param {Uint8Array} initializationData - Initialization data given e.g. by
|
|
6535
|
+
* the "encrypted" event for the corresponding request.
|
|
6519
6536
|
* @returns {Promise}
|
|
6520
6537
|
*/
|
|
6521
6538
|
;
|
|
6522
6539
|
|
|
6523
|
-
_proto.
|
|
6540
|
+
_proto.generateLicenseRequest =
|
|
6524
6541
|
/*#__PURE__*/
|
|
6525
6542
|
function () {
|
|
6526
|
-
var
|
|
6543
|
+
var _generateLicenseRequest = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee(mediaKeySession, initializationDataType, initializationData) {
|
|
6527
6544
|
var entry, _iterator, _step, stored;
|
|
6528
6545
|
|
|
6529
6546
|
return regenerator_default().wrap(function _callee$(_context) {
|
|
@@ -6558,25 +6575,260 @@ var LoadedSessionsStore = /*#__PURE__*/function () {
|
|
|
6558
6575
|
break;
|
|
6559
6576
|
}
|
|
6560
6577
|
|
|
6561
|
-
log/* default.
|
|
6562
|
-
return _context.abrupt("return",
|
|
6578
|
+
log/* default.error */.Z.error("DRM-LSS: generateRequest error. No MediaKeySession found with " + "the given initData and initDataType");
|
|
6579
|
+
return _context.abrupt("return", generateKeyRequest(mediaKeySession, initializationDataType, initializationData));
|
|
6563
6580
|
|
|
6564
6581
|
case 11:
|
|
6565
|
-
|
|
6566
|
-
|
|
6582
|
+
entry.isGeneratingRequest = true; // Note the `as string` is needed due to TypeScript not understanding that
|
|
6583
|
+
// the `closingStatus` might change in the next checks
|
|
6567
6584
|
|
|
6568
|
-
|
|
6569
|
-
|
|
6585
|
+
if (!(entry.closingStatus.type !== "none")) {
|
|
6586
|
+
_context.next = 14;
|
|
6587
|
+
break;
|
|
6588
|
+
}
|
|
6589
|
+
|
|
6590
|
+
throw new Error("The `MediaKeySession` is being closed.");
|
|
6570
6591
|
|
|
6571
6592
|
case 14:
|
|
6593
|
+
_context.prev = 14;
|
|
6594
|
+
_context.next = 17;
|
|
6595
|
+
return generateKeyRequest(mediaKeySession, initializationDataType, initializationData);
|
|
6596
|
+
|
|
6597
|
+
case 17:
|
|
6598
|
+
_context.next = 26;
|
|
6599
|
+
break;
|
|
6600
|
+
|
|
6601
|
+
case 19:
|
|
6602
|
+
_context.prev = 19;
|
|
6603
|
+
_context.t0 = _context["catch"](14);
|
|
6604
|
+
|
|
6605
|
+
if (!(entry === undefined)) {
|
|
6606
|
+
_context.next = 23;
|
|
6607
|
+
break;
|
|
6608
|
+
}
|
|
6609
|
+
|
|
6610
|
+
throw _context.t0;
|
|
6611
|
+
|
|
6612
|
+
case 23:
|
|
6613
|
+
entry.isGeneratingRequest = false;
|
|
6614
|
+
|
|
6615
|
+
if (entry.closingStatus.type === "awaiting") {
|
|
6616
|
+
entry.closingStatus.start();
|
|
6617
|
+
}
|
|
6618
|
+
|
|
6619
|
+
throw _context.t0;
|
|
6620
|
+
|
|
6621
|
+
case 26:
|
|
6622
|
+
if (!(entry === undefined)) {
|
|
6623
|
+
_context.next = 28;
|
|
6624
|
+
break;
|
|
6625
|
+
}
|
|
6626
|
+
|
|
6627
|
+
return _context.abrupt("return", undefined);
|
|
6628
|
+
|
|
6629
|
+
case 28:
|
|
6630
|
+
entry.isGeneratingRequest = false;
|
|
6631
|
+
|
|
6632
|
+
if (entry.closingStatus.type === "awaiting") {
|
|
6633
|
+
entry.closingStatus.start();
|
|
6634
|
+
}
|
|
6635
|
+
|
|
6636
|
+
case 30:
|
|
6572
6637
|
case "end":
|
|
6573
6638
|
return _context.stop();
|
|
6574
6639
|
}
|
|
6575
6640
|
}
|
|
6576
|
-
}, _callee, this);
|
|
6641
|
+
}, _callee, this, [[14, 19]]);
|
|
6642
|
+
}));
|
|
6643
|
+
|
|
6644
|
+
function generateLicenseRequest(_x, _x2, _x3) {
|
|
6645
|
+
return _generateLicenseRequest.apply(this, arguments);
|
|
6646
|
+
}
|
|
6647
|
+
|
|
6648
|
+
return generateLicenseRequest;
|
|
6649
|
+
}()
|
|
6650
|
+
/**
|
|
6651
|
+
* @param {Object} mediaKeySession
|
|
6652
|
+
* @param {string} sessionId
|
|
6653
|
+
* @returns {Promise}
|
|
6654
|
+
*/
|
|
6655
|
+
;
|
|
6656
|
+
|
|
6657
|
+
_proto.loadPersistentSession =
|
|
6658
|
+
/*#__PURE__*/
|
|
6659
|
+
function () {
|
|
6660
|
+
var _loadPersistentSession = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee2(mediaKeySession, sessionId) {
|
|
6661
|
+
var entry, _iterator2, _step2, stored, ret;
|
|
6662
|
+
|
|
6663
|
+
return regenerator_default().wrap(function _callee2$(_context2) {
|
|
6664
|
+
while (1) {
|
|
6665
|
+
switch (_context2.prev = _context2.next) {
|
|
6666
|
+
case 0:
|
|
6667
|
+
_iterator2 = loaded_sessions_store_createForOfIteratorHelperLoose(this._storage);
|
|
6668
|
+
|
|
6669
|
+
case 1:
|
|
6670
|
+
if ((_step2 = _iterator2()).done) {
|
|
6671
|
+
_context2.next = 8;
|
|
6672
|
+
break;
|
|
6673
|
+
}
|
|
6674
|
+
|
|
6675
|
+
stored = _step2.value;
|
|
6676
|
+
|
|
6677
|
+
if (!(stored.mediaKeySession === mediaKeySession)) {
|
|
6678
|
+
_context2.next = 6;
|
|
6679
|
+
break;
|
|
6680
|
+
}
|
|
6681
|
+
|
|
6682
|
+
entry = stored;
|
|
6683
|
+
return _context2.abrupt("break", 8);
|
|
6684
|
+
|
|
6685
|
+
case 6:
|
|
6686
|
+
_context2.next = 1;
|
|
6687
|
+
break;
|
|
6688
|
+
|
|
6689
|
+
case 8:
|
|
6690
|
+
if (!(entry === undefined)) {
|
|
6691
|
+
_context2.next = 11;
|
|
6692
|
+
break;
|
|
6693
|
+
}
|
|
6694
|
+
|
|
6695
|
+
log/* default.error */.Z.error("DRM-LSS: loadPersistentSession error. No MediaKeySession found with " + "the given initData and initDataType");
|
|
6696
|
+
return _context2.abrupt("return", loadSession(mediaKeySession, sessionId));
|
|
6697
|
+
|
|
6698
|
+
case 11:
|
|
6699
|
+
entry.isLoadingPersistentSession = true; // Note the `as string` is needed due to TypeScript not understanding that
|
|
6700
|
+
// the `closingStatus` might change in the next checks
|
|
6701
|
+
|
|
6702
|
+
if (!(entry.closingStatus.type !== "none")) {
|
|
6703
|
+
_context2.next = 14;
|
|
6704
|
+
break;
|
|
6705
|
+
}
|
|
6706
|
+
|
|
6707
|
+
throw new Error("The `MediaKeySession` is being closed.");
|
|
6708
|
+
|
|
6709
|
+
case 14:
|
|
6710
|
+
_context2.prev = 14;
|
|
6711
|
+
_context2.next = 17;
|
|
6712
|
+
return loadSession(mediaKeySession, sessionId);
|
|
6713
|
+
|
|
6714
|
+
case 17:
|
|
6715
|
+
ret = _context2.sent;
|
|
6716
|
+
_context2.next = 27;
|
|
6717
|
+
break;
|
|
6718
|
+
|
|
6719
|
+
case 20:
|
|
6720
|
+
_context2.prev = 20;
|
|
6721
|
+
_context2.t0 = _context2["catch"](14);
|
|
6722
|
+
|
|
6723
|
+
if (!(entry === undefined)) {
|
|
6724
|
+
_context2.next = 24;
|
|
6725
|
+
break;
|
|
6726
|
+
}
|
|
6727
|
+
|
|
6728
|
+
throw _context2.t0;
|
|
6729
|
+
|
|
6730
|
+
case 24:
|
|
6731
|
+
entry.isLoadingPersistentSession = false;
|
|
6732
|
+
|
|
6733
|
+
if (entry.closingStatus.type === "awaiting") {
|
|
6734
|
+
entry.closingStatus.start();
|
|
6735
|
+
}
|
|
6736
|
+
|
|
6737
|
+
throw _context2.t0;
|
|
6738
|
+
|
|
6739
|
+
case 27:
|
|
6740
|
+
if (!(entry === undefined)) {
|
|
6741
|
+
_context2.next = 29;
|
|
6742
|
+
break;
|
|
6743
|
+
}
|
|
6744
|
+
|
|
6745
|
+
return _context2.abrupt("return", ret);
|
|
6746
|
+
|
|
6747
|
+
case 29:
|
|
6748
|
+
entry.isLoadingPersistentSession = false;
|
|
6749
|
+
|
|
6750
|
+
if (entry.closingStatus.type === "awaiting") {
|
|
6751
|
+
entry.closingStatus.start();
|
|
6752
|
+
}
|
|
6753
|
+
|
|
6754
|
+
return _context2.abrupt("return", ret);
|
|
6755
|
+
|
|
6756
|
+
case 32:
|
|
6757
|
+
case "end":
|
|
6758
|
+
return _context2.stop();
|
|
6759
|
+
}
|
|
6760
|
+
}
|
|
6761
|
+
}, _callee2, this, [[14, 20]]);
|
|
6762
|
+
}));
|
|
6763
|
+
|
|
6764
|
+
function loadPersistentSession(_x4, _x5) {
|
|
6765
|
+
return _loadPersistentSession.apply(this, arguments);
|
|
6766
|
+
}
|
|
6767
|
+
|
|
6768
|
+
return loadPersistentSession;
|
|
6769
|
+
}()
|
|
6770
|
+
/**
|
|
6771
|
+
* Close a MediaKeySession and remove its related stored information from the
|
|
6772
|
+
* `LoadedSessionsStore`.
|
|
6773
|
+
* Emit when done.
|
|
6774
|
+
* @param {Object} mediaKeySession
|
|
6775
|
+
* @returns {Promise}
|
|
6776
|
+
*/
|
|
6777
|
+
;
|
|
6778
|
+
|
|
6779
|
+
_proto.closeSession =
|
|
6780
|
+
/*#__PURE__*/
|
|
6781
|
+
function () {
|
|
6782
|
+
var _closeSession = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee3(mediaKeySession) {
|
|
6783
|
+
var entry, _iterator3, _step3, stored;
|
|
6784
|
+
|
|
6785
|
+
return regenerator_default().wrap(function _callee3$(_context3) {
|
|
6786
|
+
while (1) {
|
|
6787
|
+
switch (_context3.prev = _context3.next) {
|
|
6788
|
+
case 0:
|
|
6789
|
+
_iterator3 = loaded_sessions_store_createForOfIteratorHelperLoose(this._storage);
|
|
6790
|
+
|
|
6791
|
+
case 1:
|
|
6792
|
+
if ((_step3 = _iterator3()).done) {
|
|
6793
|
+
_context3.next = 8;
|
|
6794
|
+
break;
|
|
6795
|
+
}
|
|
6796
|
+
|
|
6797
|
+
stored = _step3.value;
|
|
6798
|
+
|
|
6799
|
+
if (!(stored.mediaKeySession === mediaKeySession)) {
|
|
6800
|
+
_context3.next = 6;
|
|
6801
|
+
break;
|
|
6802
|
+
}
|
|
6803
|
+
|
|
6804
|
+
entry = stored;
|
|
6805
|
+
return _context3.abrupt("break", 8);
|
|
6806
|
+
|
|
6807
|
+
case 6:
|
|
6808
|
+
_context3.next = 1;
|
|
6809
|
+
break;
|
|
6810
|
+
|
|
6811
|
+
case 8:
|
|
6812
|
+
if (!(entry === undefined)) {
|
|
6813
|
+
_context3.next = 11;
|
|
6814
|
+
break;
|
|
6815
|
+
}
|
|
6816
|
+
|
|
6817
|
+
log/* default.warn */.Z.warn("DRM-LSS: No MediaKeySession found with " + "the given initData and initDataType");
|
|
6818
|
+
return _context3.abrupt("return", Promise.resolve(false));
|
|
6819
|
+
|
|
6820
|
+
case 11:
|
|
6821
|
+
return _context3.abrupt("return", this._closeEntry(entry));
|
|
6822
|
+
|
|
6823
|
+
case 12:
|
|
6824
|
+
case "end":
|
|
6825
|
+
return _context3.stop();
|
|
6826
|
+
}
|
|
6827
|
+
}
|
|
6828
|
+
}, _callee3, this);
|
|
6577
6829
|
}));
|
|
6578
6830
|
|
|
6579
|
-
function closeSession(
|
|
6831
|
+
function closeSession(_x6) {
|
|
6580
6832
|
return _closeSession.apply(this, arguments);
|
|
6581
6833
|
}
|
|
6582
6834
|
|
|
@@ -6611,11 +6863,13 @@ var LoadedSessionsStore = /*#__PURE__*/function () {
|
|
|
6611
6863
|
_proto.closeAllSessions =
|
|
6612
6864
|
/*#__PURE__*/
|
|
6613
6865
|
function () {
|
|
6614
|
-
var _closeAllSessions = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function
|
|
6866
|
+
var _closeAllSessions = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee4() {
|
|
6867
|
+
var _this2 = this;
|
|
6868
|
+
|
|
6615
6869
|
var allEntries, closingProms;
|
|
6616
|
-
return regenerator_default().wrap(function
|
|
6870
|
+
return regenerator_default().wrap(function _callee4$(_context4) {
|
|
6617
6871
|
while (1) {
|
|
6618
|
-
switch (
|
|
6872
|
+
switch (_context4.prev = _context4.next) {
|
|
6619
6873
|
case 0:
|
|
6620
6874
|
allEntries = this._storage;
|
|
6621
6875
|
log/* default.debug */.Z.debug("DRM-LSS: Closing all current MediaKeySessions", allEntries.length); // re-initialize the storage, so that new interactions with the
|
|
@@ -6624,17 +6878,17 @@ var LoadedSessionsStore = /*#__PURE__*/function () {
|
|
|
6624
6878
|
|
|
6625
6879
|
this._storage = [];
|
|
6626
6880
|
closingProms = allEntries.map(function (entry) {
|
|
6627
|
-
return
|
|
6881
|
+
return _this2._closeEntry(entry);
|
|
6628
6882
|
});
|
|
6629
|
-
|
|
6883
|
+
_context4.next = 6;
|
|
6630
6884
|
return Promise.all(closingProms);
|
|
6631
6885
|
|
|
6632
6886
|
case 6:
|
|
6633
6887
|
case "end":
|
|
6634
|
-
return
|
|
6888
|
+
return _context4.stop();
|
|
6635
6889
|
}
|
|
6636
6890
|
}
|
|
6637
|
-
},
|
|
6891
|
+
}, _callee4, this);
|
|
6638
6892
|
}));
|
|
6639
6893
|
|
|
6640
6894
|
function closeAllSessions() {
|
|
@@ -6642,7 +6896,15 @@ var LoadedSessionsStore = /*#__PURE__*/function () {
|
|
|
6642
6896
|
}
|
|
6643
6897
|
|
|
6644
6898
|
return closeAllSessions;
|
|
6645
|
-
}()
|
|
6899
|
+
}()
|
|
6900
|
+
/**
|
|
6901
|
+
* Get the index of a stored MediaKeySession entry based on its
|
|
6902
|
+
* `KeySessionRecord`.
|
|
6903
|
+
* Returns -1 if not found.
|
|
6904
|
+
* @param {Object} record
|
|
6905
|
+
* @returns {number}
|
|
6906
|
+
*/
|
|
6907
|
+
;
|
|
6646
6908
|
|
|
6647
6909
|
_proto.getIndex = function getIndex(record) {
|
|
6648
6910
|
for (var i = 0; i < this._storage.length; i++) {
|
|
@@ -6654,122 +6916,124 @@ var LoadedSessionsStore = /*#__PURE__*/function () {
|
|
|
6654
6916
|
}
|
|
6655
6917
|
|
|
6656
6918
|
return -1;
|
|
6657
|
-
};
|
|
6658
|
-
|
|
6659
|
-
return LoadedSessionsStore;
|
|
6660
|
-
}();
|
|
6661
|
-
/**
|
|
6662
|
-
* Close a MediaKeySession with multiple attempts if needed and do not throw if
|
|
6663
|
-
* this action throws an error.
|
|
6664
|
-
* Emits then complete when done.
|
|
6665
|
-
* @param {MediaKeySession} mediaKeySession
|
|
6666
|
-
* @returns {Observable}
|
|
6667
|
-
*/
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
function safelyCloseMediaKeySession(mediaKeySession) {
|
|
6673
|
-
return recursivelyTryToCloseMediaKeySession(0);
|
|
6674
|
-
/**
|
|
6675
|
-
* Perform a new attempt at closing the MediaKeySession.
|
|
6676
|
-
* If this operation fails due to a not-"callable" (an EME term)
|
|
6677
|
-
* MediaKeySession, retry based on either a timer or on MediaKeySession
|
|
6678
|
-
* events, whichever comes first.
|
|
6679
|
-
* Emits then complete when done.
|
|
6680
|
-
* @param {number} retryNb - The attempt number starting at 0.
|
|
6681
|
-
* @returns {Observable}
|
|
6682
|
-
*/
|
|
6683
|
-
|
|
6684
|
-
function recursivelyTryToCloseMediaKeySession(_x2) {
|
|
6685
|
-
return _recursivelyTryToCloseMediaKeySession.apply(this, arguments);
|
|
6686
6919
|
}
|
|
6687
6920
|
/**
|
|
6688
|
-
*
|
|
6689
|
-
*
|
|
6690
|
-
*
|
|
6691
|
-
*
|
|
6921
|
+
* Prepare the closure of a `MediaKeySession` stored as an entry of the
|
|
6922
|
+
* `LoadedSessionsStore`.
|
|
6923
|
+
* Allows to postpone the closure action if another MediaKeySession action
|
|
6924
|
+
* is already pending.
|
|
6925
|
+
* @param {Object} entry
|
|
6926
|
+
* @returns {Promise.<boolean>}
|
|
6692
6927
|
*/
|
|
6928
|
+
;
|
|
6693
6929
|
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
return regenerator_default().wrap(function
|
|
6930
|
+
_proto._closeEntry =
|
|
6931
|
+
/*#__PURE__*/
|
|
6932
|
+
function () {
|
|
6933
|
+
var _closeEntry2 = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee5(entry) {
|
|
6934
|
+
var mediaKeySession;
|
|
6935
|
+
return regenerator_default().wrap(function _callee5$(_context5) {
|
|
6700
6936
|
while (1) {
|
|
6701
|
-
switch (
|
|
6937
|
+
switch (_context5.prev = _context5.next) {
|
|
6702
6938
|
case 0:
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6939
|
+
mediaKeySession = entry.mediaKeySession;
|
|
6940
|
+
return _context5.abrupt("return", new Promise(function (resolve, reject) {
|
|
6941
|
+
if (entry !== undefined && (entry.isLoadingPersistentSession || entry.isGeneratingRequest)) {
|
|
6942
|
+
entry.closingStatus = {
|
|
6943
|
+
type: "awaiting",
|
|
6944
|
+
start: tryClosingEntryAndResolve
|
|
6945
|
+
};
|
|
6946
|
+
} else {
|
|
6947
|
+
tryClosingEntryAndResolve();
|
|
6948
|
+
}
|
|
6707
6949
|
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6950
|
+
function tryClosingEntryAndResolve() {
|
|
6951
|
+
if (entry !== undefined) {
|
|
6952
|
+
entry.closingStatus = {
|
|
6953
|
+
type: "pending"
|
|
6954
|
+
};
|
|
6955
|
+
}
|
|
6711
6956
|
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6957
|
+
safelyCloseMediaKeySession(mediaKeySession).then(function () {
|
|
6958
|
+
if (entry !== undefined) {
|
|
6959
|
+
entry.closingStatus = {
|
|
6960
|
+
type: "done"
|
|
6961
|
+
};
|
|
6962
|
+
}
|
|
6715
6963
|
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6964
|
+
resolve(true);
|
|
6965
|
+
})["catch"](function (err) {
|
|
6966
|
+
if (entry !== undefined) {
|
|
6967
|
+
entry.closingStatus = {
|
|
6968
|
+
type: "failed"
|
|
6969
|
+
};
|
|
6970
|
+
}
|
|
6720
6971
|
|
|
6721
|
-
|
|
6972
|
+
reject(err);
|
|
6973
|
+
});
|
|
6974
|
+
}
|
|
6975
|
+
}));
|
|
6722
6976
|
|
|
6723
|
-
case
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6977
|
+
case 2:
|
|
6978
|
+
case "end":
|
|
6979
|
+
return _context5.stop();
|
|
6980
|
+
}
|
|
6981
|
+
}
|
|
6982
|
+
}, _callee5);
|
|
6983
|
+
}));
|
|
6728
6984
|
|
|
6729
|
-
|
|
6985
|
+
function _closeEntry(_x7) {
|
|
6986
|
+
return _closeEntry2.apply(this, arguments);
|
|
6987
|
+
}
|
|
6730
6988
|
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
break;
|
|
6734
|
-
}
|
|
6989
|
+
return _closeEntry;
|
|
6990
|
+
}();
|
|
6735
6991
|
|
|
6736
|
-
|
|
6992
|
+
return LoadedSessionsStore;
|
|
6993
|
+
}();
|
|
6994
|
+
/**
|
|
6995
|
+
* Close a MediaKeySession and just log an error if it fails (while resolving).
|
|
6996
|
+
* Emits then complete when done.
|
|
6997
|
+
* @param {MediaKeySession} mediaKeySession
|
|
6998
|
+
* @returns {Observable}
|
|
6999
|
+
*/
|
|
6737
7000
|
|
|
6738
|
-
case 16:
|
|
6739
|
-
delay = Math.min(Math.pow(2, retryNb) * EME_SESSION_CLOSING_INITIAL_DELAY, EME_SESSION_CLOSING_MAX_DELAY);
|
|
6740
|
-
log/* default.warn */.Z.warn("DRM: attempt to close a mediaKeySession failed, " + "scheduling retry...", delay);
|
|
6741
|
-
ksChangeProm = new Promise(function (res) {
|
|
6742
|
-
ksChangeSub = (0,event_listeners/* onKeyStatusesChange$ */.eX)(mediaKeySession).subscribe(res);
|
|
6743
|
-
});
|
|
6744
|
-
ksMsgProm = new Promise(function (res) {
|
|
6745
|
-
ksMsgSub = (0,event_listeners/* onKeyMessage$ */.GJ)(mediaKeySession).subscribe(res);
|
|
6746
|
-
});
|
|
6747
|
-
sleepProm = new Promise(function (res) {
|
|
6748
|
-
sleepTimer = window.setTimeout(res, delay);
|
|
6749
|
-
});
|
|
6750
|
-
_context3.next = 23;
|
|
6751
|
-
return Promise.race([ksChangeProm, ksMsgProm, sleepProm]);
|
|
6752
7001
|
|
|
6753
|
-
case 23:
|
|
6754
|
-
ksChangeSub === null || ksChangeSub === void 0 ? void 0 : ksChangeSub.unsubscribe();
|
|
6755
|
-
ksMsgSub === null || ksMsgSub === void 0 ? void 0 : ksMsgSub.unsubscribe();
|
|
6756
|
-
clearTimeout(sleepTimer);
|
|
6757
|
-
return _context3.abrupt("return", recursivelyTryToCloseMediaKeySession(nextRetryNb));
|
|
6758
7002
|
|
|
6759
|
-
case 27:
|
|
6760
|
-
case "end":
|
|
6761
|
-
return _context3.stop();
|
|
6762
|
-
}
|
|
6763
|
-
}
|
|
6764
|
-
}, _callee3, null, [[1, 8]]);
|
|
6765
|
-
}));
|
|
6766
|
-
return _recursivelyTryToCloseMediaKeySession.apply(this, arguments);
|
|
6767
|
-
}
|
|
6768
7003
|
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
|
|
7004
|
+
function safelyCloseMediaKeySession(_x8) {
|
|
7005
|
+
return _safelyCloseMediaKeySession.apply(this, arguments);
|
|
7006
|
+
}
|
|
7007
|
+
|
|
7008
|
+
function _safelyCloseMediaKeySession() {
|
|
7009
|
+
_safelyCloseMediaKeySession = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee6(mediaKeySession) {
|
|
7010
|
+
return regenerator_default().wrap(function _callee6$(_context6) {
|
|
7011
|
+
while (1) {
|
|
7012
|
+
switch (_context6.prev = _context6.next) {
|
|
7013
|
+
case 0:
|
|
7014
|
+
log/* default.debug */.Z.debug("DRM: Trying to close a MediaKeySession", mediaKeySession.sessionId);
|
|
7015
|
+
_context6.prev = 1;
|
|
7016
|
+
_context6.next = 4;
|
|
7017
|
+
return closeSession(mediaKeySession);
|
|
7018
|
+
|
|
7019
|
+
case 4:
|
|
7020
|
+
log/* default.debug */.Z.debug("DRM: Succeeded to close MediaKeySession");
|
|
7021
|
+
return _context6.abrupt("return");
|
|
7022
|
+
|
|
7023
|
+
case 8:
|
|
7024
|
+
_context6.prev = 8;
|
|
7025
|
+
_context6.t0 = _context6["catch"](1);
|
|
7026
|
+
log/* default.error */.Z.error("DRM: Could not close MediaKeySession: " + (_context6.t0 instanceof Error ? _context6.t0.toString() : "Unknown error"));
|
|
7027
|
+
return _context6.abrupt("return");
|
|
7028
|
+
|
|
7029
|
+
case 12:
|
|
7030
|
+
case "end":
|
|
7031
|
+
return _context6.stop();
|
|
7032
|
+
}
|
|
7033
|
+
}
|
|
7034
|
+
}, _callee6, null, [[1, 8]]);
|
|
7035
|
+
}));
|
|
7036
|
+
return _safelyCloseMediaKeySession.apply(this, arguments);
|
|
6773
7037
|
}
|
|
6774
7038
|
// EXTERNAL MODULE: ./src/utils/assert.ts
|
|
6775
7039
|
var assert = __webpack_require__(811);
|
|
@@ -9088,7 +9352,7 @@ var ContentDecryptor = /*#__PURE__*/function (_EventEmitter) {
|
|
|
9088
9352
|
var _processInitializationData2 = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee2(initializationData, mediaKeysData) {
|
|
9089
9353
|
var _this4 = this;
|
|
9090
9354
|
|
|
9091
|
-
var mediaKeySystemAccess, stores, options, firstCreatedSession, keyIds, hexKids, period, createdSessions, periodKeys, _iterator, _step, createdSess, periodKeysArr, _i, _periodKeysArr, kid, _iterator2, _step2, innerKid, wantedSessionType, _config$getCurrent, EME_DEFAULT_MAX_SIMULTANEOUS_MEDIA_KEY_SESSIONS, EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION, maxSessionCacheSize, sessionRes, sessionInfo, _sessionRes$value, mediaKeySession, sessionType, isSessionPersisted, sub, requestData;
|
|
9355
|
+
var mediaKeySystemAccess, stores, options, firstCreatedSession, keyIds, hexKids, period, createdSessions, periodKeys, _iterator, _step, createdSess, periodKeysArr, _i, _periodKeysArr, kid, _iterator2, _step2, innerKid, wantedSessionType, _config$getCurrent, EME_DEFAULT_MAX_SIMULTANEOUS_MEDIA_KEY_SESSIONS, EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION, maxSessionCacheSize, sessionRes, sessionInfo, _sessionRes$value, mediaKeySession, sessionType, isSessionPersisted, sub, requestData, entry, indexInCurrent;
|
|
9092
9356
|
|
|
9093
9357
|
return regenerator_default().wrap(function _callee2$(_context2) {
|
|
9094
9358
|
while (1) {
|
|
@@ -9350,28 +9614,47 @@ var ContentDecryptor = /*#__PURE__*/function (_EventEmitter) {
|
|
|
9350
9614
|
if (!(sessionRes.type === "created-session"
|
|
9351
9615
|
/* Created */
|
|
9352
9616
|
)) {
|
|
9353
|
-
_context2.next =
|
|
9617
|
+
_context2.next = 68;
|
|
9354
9618
|
break;
|
|
9355
9619
|
}
|
|
9356
9620
|
|
|
9357
9621
|
requestData = initializationData.values.constructRequestData();
|
|
9358
9622
|
_context2.prev = 55;
|
|
9359
9623
|
_context2.next = 58;
|
|
9360
|
-
return
|
|
9624
|
+
return stores.loadedSessionsStore.generateLicenseRequest(mediaKeySession, initializationData.type, requestData);
|
|
9361
9625
|
|
|
9362
9626
|
case 58:
|
|
9363
|
-
_context2.next =
|
|
9627
|
+
_context2.next = 68;
|
|
9364
9628
|
break;
|
|
9365
9629
|
|
|
9366
9630
|
case 60:
|
|
9367
9631
|
_context2.prev = 60;
|
|
9368
9632
|
_context2.t0 = _context2["catch"](55);
|
|
9633
|
+
// First check that the error was not due to the MediaKeySession closing
|
|
9634
|
+
// or being closed
|
|
9635
|
+
entry = stores.loadedSessionsStore.getEntryForSession(mediaKeySession);
|
|
9636
|
+
|
|
9637
|
+
if (!(entry === null || entry.closingStatus.type !== "none")) {
|
|
9638
|
+
_context2.next = 67;
|
|
9639
|
+
break;
|
|
9640
|
+
}
|
|
9641
|
+
|
|
9642
|
+
// MediaKeySession closing/closed: Just remove from handled list and abort.
|
|
9643
|
+
indexInCurrent = this._currentSessions.indexOf(sessionInfo);
|
|
9644
|
+
|
|
9645
|
+
if (indexInCurrent >= 0) {
|
|
9646
|
+
this._currentSessions.splice(indexInCurrent, 1);
|
|
9647
|
+
}
|
|
9648
|
+
|
|
9649
|
+
return _context2.abrupt("return", Promise.resolve());
|
|
9650
|
+
|
|
9651
|
+
case 67:
|
|
9369
9652
|
throw new encrypted_media_error/* default */.Z("KEY_GENERATE_REQUEST_ERROR", _context2.t0 instanceof Error ? _context2.t0.toString() : "Unknown error");
|
|
9370
9653
|
|
|
9371
|
-
case
|
|
9654
|
+
case 68:
|
|
9372
9655
|
return _context2.abrupt("return", Promise.resolve());
|
|
9373
9656
|
|
|
9374
|
-
case
|
|
9657
|
+
case 69:
|
|
9375
9658
|
case "end":
|
|
9376
9659
|
return _context2.stop();
|
|
9377
9660
|
}
|
|
@@ -53882,7 +54165,7 @@ function appendSegmentToBuffer(playbackObserver, segmentBuffer, dataInfos) {
|
|
|
53882
54165
|
throw new media_error/* default */.Z("BUFFER_APPEND_ERROR", reason);
|
|
53883
54166
|
}
|
|
53884
54167
|
|
|
53885
|
-
return playbackObserver.observe(true).pipe((0,mergeMap/* mergeMap */.z)(function (observation) {
|
|
54168
|
+
return playbackObserver.observe(true).pipe((0,take/* take */.q)(1), (0,mergeMap/* mergeMap */.z)(function (observation) {
|
|
53886
54169
|
var currentPos = observation.position + observation.wantedTimeOffset;
|
|
53887
54170
|
return (0,concat/* concat */.z)(forceGarbageCollection(currentPos, segmentBuffer).pipe((0,ignoreElements/* ignoreElements */.l)()), append$).pipe((0,catchError/* catchError */.K)(function (forcedGCError) {
|
|
53888
54171
|
var reason = forcedGCError instanceof Error ? forcedGCError.toString() : "Could not clean the buffer";
|
|
@@ -60153,7 +60436,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
60153
60436
|
videoElement.preload = "auto";
|
|
60154
60437
|
_this.version =
|
|
60155
60438
|
/* PLAYER_VERSION */
|
|
60156
|
-
"3.27.0-dev.
|
|
60439
|
+
"3.27.0-dev.2022032500";
|
|
60157
60440
|
_this.log = log/* default */.Z;
|
|
60158
60441
|
_this.state = "STOPPED";
|
|
60159
60442
|
_this.videoElement = videoElement;
|
|
@@ -62982,7 +63265,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
62982
63265
|
|
|
62983
63266
|
Player.version =
|
|
62984
63267
|
/* PLAYER_VERSION */
|
|
62985
|
-
"3.27.0-dev.
|
|
63268
|
+
"3.27.0-dev.2022032500";
|
|
62986
63269
|
/* harmony default export */ var public_api = (Player);
|
|
62987
63270
|
;// CONCATENATED MODULE: ./src/core/api/index.ts
|
|
62988
63271
|
/**
|