rx-player 3.27.0-dev.20220317 → 3.27.0-dev.2022032800
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/.eslintrc.js +0 -4
- package/CHANGELOG.md +5 -2
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/eme/close_session.js +1 -2
- package/dist/_esm5.processed/compat/eme/custom_key_system_access.d.ts +15 -0
- package/dist/_esm5.processed/compat/eme/custom_key_system_access.js +1 -17
- package/dist/_esm5.processed/compat/eme/custom_media_keys/ie11_media_keys.js +6 -7
- package/dist/_esm5.processed/compat/eme/custom_media_keys/index.js +3 -4
- package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.js +20 -17
- package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.js +29 -14
- 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/compat/eme/load_session.js +1 -2
- package/dist/_esm5.processed/config.d.ts +0 -3
- package/dist/_esm5.processed/core/api/option_utils.d.ts +3 -2
- package/dist/_esm5.processed/core/api/option_utils.js +2 -1
- package/dist/_esm5.processed/core/api/public_api.js +3 -4
- package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +1 -2
- package/dist/_esm5.processed/core/decrypt/clear_on_stop.js +1 -2
- package/dist/_esm5.processed/core/decrypt/content_decryptor.js +12 -5
- 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 +16 -7
- package/dist/_esm5.processed/core/decrypt/find_key_system.js +1 -2
- package/dist/_esm5.processed/core/decrypt/utils/clean_old_loaded_sessions.js +1 -2
- 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 +238 -98
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +1 -3
- package/dist/_esm5.processed/core/fetchers/utils/try_urls_with_backoff.js +2 -3
- package/dist/_esm5.processed/core/init/initialize_media_source.d.ts +2 -1
- package/dist/_esm5.processed/core/stream/index.d.ts +1 -0
- package/dist/_esm5.processed/core/stream/period/get_adaptation_switch_strategy.d.ts +15 -11
- package/dist/_esm5.processed/core/stream/period/get_adaptation_switch_strategy.js +5 -2
- package/dist/_esm5.processed/core/stream/period/index.d.ts +1 -0
- package/dist/_esm5.processed/core/stream/period/period_stream.d.ts +3 -11
- 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/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.js +5 -6
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/index.js +2 -3
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.d.ts +15 -0
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.js +1 -2
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.js +2 -3
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.js +2 -3
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.js +1 -2
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +1 -2
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.js +1 -2
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.js +1 -2
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +4 -5
- package/dist/_esm5.processed/public_types.d.ts +1 -0
- package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +1 -2
- package/dist/_esm5.processed/transports/dash/image_pipelines.d.ts +4 -3
- package/dist/_esm5.processed/transports/dash/image_pipelines.js +57 -11
- package/dist/_esm5.processed/transports/dash/init_segment_loader.js +1 -2
- package/dist/_esm5.processed/transports/dash/manifest_parser.js +2 -3
- package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +1 -1
- package/dist/_esm5.processed/transports/dash/segment_loader.js +3 -4
- package/dist/_esm5.processed/transports/dash/text_loader.js +1 -2
- package/dist/_esm5.processed/transports/local/segment_loader.js +2 -3
- package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +2 -3
- package/dist/_esm5.processed/transports/smooth/pipelines.js +3 -4
- package/dist/_esm5.processed/transports/smooth/segment_loader.js +3 -4
- package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +1 -2
- package/dist/_esm5.processed/utils/cancellable_sleep.js +1 -2
- package/dist/_esm5.processed/utils/cast_to_observable.js +1 -3
- package/dist/_esm5.processed/utils/request/xhr.js +1 -2
- package/dist/rx-player.js +851 -937
- package/dist/rx-player.min.js +1 -1
- package/package.json +1 -2
- package/scripts/update-version +2 -2
- package/sonar-project.properties +1 -1
- package/src/compat/__tests__/play.test.ts +2 -4
- package/src/compat/eme/close_session.ts +1 -2
- package/src/compat/eme/custom_key_system_access.ts +1 -2
- package/src/compat/eme/custom_media_keys/ie11_media_keys.ts +6 -7
- package/src/compat/eme/custom_media_keys/index.ts +3 -4
- package/src/compat/eme/custom_media_keys/old_webkit_media_keys.ts +21 -18
- package/src/compat/eme/custom_media_keys/webkit_media_keys.ts +28 -16
- package/src/compat/eme/generate_key_request.ts +4 -6
- package/src/compat/eme/load_session.ts +1 -2
- package/src/core/api/__tests__/option_utils.test.ts +12 -0
- package/src/core/api/option_utils.ts +5 -3
- package/src/core/api/public_api.ts +3 -4
- package/src/core/decrypt/attach_media_keys.ts +1 -2
- package/src/core/decrypt/clear_on_stop.ts +1 -2
- package/src/core/decrypt/content_decryptor.ts +16 -6
- package/src/core/decrypt/create_or_load_session.ts +4 -1
- package/src/core/decrypt/create_session.ts +25 -12
- package/src/core/decrypt/find_key_system.ts +1 -2
- package/src/core/decrypt/utils/clean_old_loaded_sessions.ts +1 -2
- package/src/core/decrypt/utils/loaded_sessions_store.ts +256 -105
- package/src/core/fetchers/manifest/manifest_fetcher.ts +1 -3
- package/src/core/fetchers/utils/try_urls_with_backoff.ts +2 -3
- package/src/core/init/initialize_media_source.ts +2 -1
- package/src/core/stream/index.ts +1 -0
- package/src/core/stream/period/get_adaptation_switch_strategy.ts +24 -14
- package/src/core/stream/period/index.ts +1 -0
- package/src/core/stream/period/period_stream.ts +5 -14
- package/src/core/stream/representation/append_segment_to_buffer.ts +17 -13
- package/src/default_config.ts +0 -30
- package/src/experimental/tools/VideoThumbnailLoader/thumbnail_loader.ts +5 -6
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/HDCPPolicy.test.ts +5 -6
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/decodingInfos.test.ts +2 -4
- package/src/experimental/tools/mediaCapabilitiesProber/api/index.ts +2 -3
- package/src/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.ts +1 -2
- package/src/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.ts +2 -3
- package/src/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.ts +2 -3
- package/src/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.ts +1 -2
- package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.ts +1 -2
- package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.ts +1 -2
- package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.ts +1 -2
- package/src/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.ts +4 -5
- package/src/public_types.ts +1 -0
- package/src/transports/dash/add_segment_integrity_checks_to_loader.ts +1 -2
- package/src/transports/dash/image_pipelines.ts +12 -14
- package/src/transports/dash/init_segment_loader.ts +1 -2
- package/src/transports/dash/manifest_parser.ts +2 -3
- package/src/transports/dash/segment_loader.ts +4 -5
- package/src/transports/dash/text_loader.ts +2 -3
- package/src/transports/local/segment_loader.ts +2 -3
- package/src/transports/metaplaylist/pipelines.ts +2 -3
- package/src/transports/smooth/pipelines.ts +4 -5
- package/src/transports/smooth/segment_loader.ts +5 -6
- package/src/transports/utils/call_custom_manifest_loader.ts +1 -2
- package/src/utils/cancellable_sleep.ts +1 -2
- package/src/utils/cast_to_observable.ts +0 -2
- package/src/utils/request/xhr.ts +1 -2
- package/tsconfig.json +0 -1
- package/tsconfig.modules.json +0 -1
- package/dist/_esm5.processed/utils/promise.d.ts +0 -17
- package/dist/_esm5.processed/utils/promise.js +0 -18
- package/src/typings/pinkie.d.ts +0 -19
- package/src/utils/__tests__/promise.test.ts +0 -23
- package/src/utils/promise.ts +0 -20
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { ICustomMediaKeySession } from "../../compat";
|
|
17
|
+
import { CancellationSignal } from "../../utils/task_canceller";
|
|
17
18
|
import { IProcessedProtectionData, IMediaKeySessionStores, MediaKeySessionLoadingType } from "./types";
|
|
18
19
|
import KeySessionRecord from "./utils/key_session_record";
|
|
19
20
|
/**
|
|
@@ -29,9 +30,10 @@ import KeySessionRecord from "./utils/key_session_record";
|
|
|
29
30
|
* @param {Object} stores
|
|
30
31
|
* @param {Object} initData
|
|
31
32
|
* @param {string} wantedSessionType
|
|
33
|
+
* @param {Object} cancelSignal
|
|
32
34
|
* @returns {Promise}
|
|
33
35
|
*/
|
|
34
|
-
export default function createSession(stores: IMediaKeySessionStores, initData: IProcessedProtectionData, wantedSessionType: MediaKeySessionType): Promise<ICreateSessionEvent>;
|
|
36
|
+
export default function createSession(stores: IMediaKeySessionStores, initData: IProcessedProtectionData, wantedSessionType: MediaKeySessionType, cancelSignal: CancellationSignal): Promise<ICreateSessionEvent>;
|
|
35
37
|
export interface INewSessionCreatedEvent {
|
|
36
38
|
type: MediaKeySessionLoadingType.Created;
|
|
37
39
|
value: {
|
|
@@ -49,8 +49,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
49
49
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
import PPromise from "pinkie";
|
|
53
|
-
import { loadSession, } from "../../compat";
|
|
54
52
|
import log from "../../log";
|
|
55
53
|
import isSessionUsable from "./utils/is_session_usable";
|
|
56
54
|
/**
|
|
@@ -66,9 +64,10 @@ import isSessionUsable from "./utils/is_session_usable";
|
|
|
66
64
|
* @param {Object} stores
|
|
67
65
|
* @param {Object} initData
|
|
68
66
|
* @param {string} wantedSessionType
|
|
67
|
+
* @param {Object} cancelSignal
|
|
69
68
|
* @returns {Promise}
|
|
70
69
|
*/
|
|
71
|
-
export default function createSession(stores, initData, wantedSessionType) {
|
|
70
|
+
export default function createSession(stores, initData, wantedSessionType, cancelSignal) {
|
|
72
71
|
var loadedSessionsStore = stores.loadedSessionsStore, persistentSessionsStore = stores.persistentSessionsStore;
|
|
73
72
|
if (wantedSessionType === "temporary") {
|
|
74
73
|
return createTemporarySession(loadedSessionsStore, initData);
|
|
@@ -78,7 +77,7 @@ export default function createSession(stores, initData, wantedSessionType) {
|
|
|
78
77
|
"PersistentSessionsStore not created.");
|
|
79
78
|
return createTemporarySession(loadedSessionsStore, initData);
|
|
80
79
|
}
|
|
81
|
-
return createAndTryToRetrievePersistentSession(loadedSessionsStore, persistentSessionsStore, initData);
|
|
80
|
+
return createAndTryToRetrievePersistentSession(loadedSessionsStore, persistentSessionsStore, initData, cancelSignal);
|
|
82
81
|
}
|
|
83
82
|
/**
|
|
84
83
|
* Create a new temporary MediaKeySession linked to the given initData and
|
|
@@ -90,7 +89,7 @@ export default function createSession(stores, initData, wantedSessionType) {
|
|
|
90
89
|
function createTemporarySession(loadedSessionsStore, initData) {
|
|
91
90
|
log.info("DRM: Creating a new temporary session");
|
|
92
91
|
var entry = loadedSessionsStore.createSession(initData, "temporary");
|
|
93
|
-
return
|
|
92
|
+
return Promise.resolve({ type: "created-session" /* Created */,
|
|
94
93
|
value: entry });
|
|
95
94
|
}
|
|
96
95
|
/**
|
|
@@ -99,9 +98,10 @@ function createTemporarySession(loadedSessionsStore, initData) {
|
|
|
99
98
|
* @param {Object} loadedSessionsStore
|
|
100
99
|
* @param {Object} persistentSessionsStore
|
|
101
100
|
* @param {Object} initData
|
|
101
|
+
* @param {Object} cancelSignal
|
|
102
102
|
* @returns {Promise}
|
|
103
103
|
*/
|
|
104
|
-
function createAndTryToRetrievePersistentSession(loadedSessionsStore, persistentSessionsStore, initData) {
|
|
104
|
+
function createAndTryToRetrievePersistentSession(loadedSessionsStore, persistentSessionsStore, initData, cancelSignal) {
|
|
105
105
|
return __awaiter(this, void 0, void 0, function () {
|
|
106
106
|
/**
|
|
107
107
|
* Helper function to close and restart the current persistent session
|
|
@@ -114,6 +114,9 @@ function createAndTryToRetrievePersistentSession(loadedSessionsStore, persistent
|
|
|
114
114
|
return __generator(this, function (_a) {
|
|
115
115
|
switch (_a.label) {
|
|
116
116
|
case 0:
|
|
117
|
+
if (cancelSignal.cancellationError !== null) {
|
|
118
|
+
throw cancelSignal.cancellationError;
|
|
119
|
+
}
|
|
117
120
|
log.info("DRM: Removing previous persistent session.");
|
|
118
121
|
persistentEntry = persistentSessionsStore.get(initData);
|
|
119
122
|
if (persistentEntry !== null) {
|
|
@@ -122,6 +125,9 @@ function createAndTryToRetrievePersistentSession(loadedSessionsStore, persistent
|
|
|
122
125
|
return [4 /*yield*/, loadedSessionsStore.closeSession(entry.mediaKeySession)];
|
|
123
126
|
case 1:
|
|
124
127
|
_a.sent();
|
|
128
|
+
if (cancelSignal.cancellationError !== null) {
|
|
129
|
+
throw cancelSignal.cancellationError;
|
|
130
|
+
}
|
|
125
131
|
newEntry = loadedSessionsStore.createSession(initData, "persistent-license");
|
|
126
132
|
return [2 /*return*/, { type: "created-session" /* Created */,
|
|
127
133
|
value: newEntry }];
|
|
@@ -133,6 +139,9 @@ function createAndTryToRetrievePersistentSession(loadedSessionsStore, persistent
|
|
|
133
139
|
return __generator(this, function (_a) {
|
|
134
140
|
switch (_a.label) {
|
|
135
141
|
case 0:
|
|
142
|
+
if (cancelSignal.cancellationError !== null) {
|
|
143
|
+
throw cancelSignal.cancellationError;
|
|
144
|
+
}
|
|
136
145
|
log.info("DRM: Creating persistent MediaKeySession");
|
|
137
146
|
entry = loadedSessionsStore.createSession(initData, "persistent-license");
|
|
138
147
|
storedEntry = persistentSessionsStore.getAndReuse(initData);
|
|
@@ -143,7 +152,7 @@ function createAndTryToRetrievePersistentSession(loadedSessionsStore, persistent
|
|
|
143
152
|
_a.label = 1;
|
|
144
153
|
case 1:
|
|
145
154
|
_a.trys.push([1, 3, , 4]);
|
|
146
|
-
return [4 /*yield*/,
|
|
155
|
+
return [4 /*yield*/, loadedSessionsStore.loadPersistentSession(entry.mediaKeySession, storedEntry.sessionId)];
|
|
147
156
|
case 2:
|
|
148
157
|
hasLoadedSession = _a.sent();
|
|
149
158
|
if (!hasLoadedSession) {
|
|
@@ -55,7 +55,6 @@ import { EncryptedMediaError } from "../../errors";
|
|
|
55
55
|
import log from "../../log";
|
|
56
56
|
import arrayIncludes from "../../utils/array_includes";
|
|
57
57
|
import flatMap from "../../utils/flat_map";
|
|
58
|
-
import PPromise from "../../utils/promise";
|
|
59
58
|
import MediaKeysInfosStore from "./utils/media_keys_infos_store";
|
|
60
59
|
/**
|
|
61
60
|
* @param {Array.<Object>} keySystems
|
|
@@ -213,7 +212,7 @@ export default function getMediaKeySystemAccess(mediaElement, keySystemsConfigs,
|
|
|
213
212
|
var cachedKeySystemAccess = checkCachedMediaKeySystemAccess(keySystemsConfigs, currentState.mediaKeySystemAccess, currentState.keySystemOptions);
|
|
214
213
|
if (cachedKeySystemAccess !== null) {
|
|
215
214
|
log.info("DRM: Found cached compatible keySystem");
|
|
216
|
-
return
|
|
215
|
+
return Promise.resolve({
|
|
217
216
|
type: "reuse-media-key-system-access",
|
|
218
217
|
value: { mediaKeySystemAccess: cachedKeySystemAccess.keySystemAccess,
|
|
219
218
|
options: cachedKeySystemAccess.keySystemOptions },
|
|
@@ -49,7 +49,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
49
49
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
import PPromise from "../../../utils/promise";
|
|
53
52
|
/**
|
|
54
53
|
* Close sessions from the loadedSessionsStore to allow at maximum `limit`
|
|
55
54
|
* stored MediaKeySessions in it.
|
|
@@ -75,7 +74,7 @@ export default function cleanOldLoadedSessions(loadedSessionsStore, limit) {
|
|
|
75
74
|
entry = entries[i];
|
|
76
75
|
proms.push(loadedSessionsStore.closeSession(entry.mediaKeySession));
|
|
77
76
|
}
|
|
78
|
-
return [4 /*yield*/,
|
|
77
|
+
return [4 /*yield*/, Promise.all(proms)];
|
|
79
78
|
case 1:
|
|
80
79
|
_a.sent();
|
|
81
80
|
return [2 /*return*/];
|
|
@@ -37,7 +37,7 @@ export default class LoadedSessionsStore {
|
|
|
37
37
|
constructor(mediaKeys: MediaKeys | ICustomMediaKeys);
|
|
38
38
|
/**
|
|
39
39
|
* Create a new MediaKeySession and store it in this store.
|
|
40
|
-
* @param {Object}
|
|
40
|
+
* @param {Object} initData
|
|
41
41
|
* @param {string} sessionType
|
|
42
42
|
* @returns {Object}
|
|
43
43
|
*/
|
|
@@ -55,6 +55,32 @@ export default class LoadedSessionsStore {
|
|
|
55
55
|
* @returns {Object|null}
|
|
56
56
|
*/
|
|
57
57
|
reuse(initializationData: IProcessedProtectionData): IStoredSessionEntry | null;
|
|
58
|
+
/**
|
|
59
|
+
* Get `LoadedSessionsStore`'s entry for a given MediaKeySession.
|
|
60
|
+
* Returns `null` if the given MediaKeySession is not stored in the
|
|
61
|
+
* `LoadedSessionsStore`.
|
|
62
|
+
* @param {MediaKeySession} mediaKeySession
|
|
63
|
+
* @returns {Object|null}
|
|
64
|
+
*/
|
|
65
|
+
getEntryForSession(mediaKeySession: MediaKeySession | ICustomMediaKeySession): IStoredSessionEntry | null;
|
|
66
|
+
/**
|
|
67
|
+
* Generate a license request on the given MediaKeySession, while indicating
|
|
68
|
+
* to the LoadedSessionsStore that a license-request is pending so
|
|
69
|
+
* session-closing orders are properly scheduled after it is done.
|
|
70
|
+
* @param {Object} mediaKeySession
|
|
71
|
+
* @param {string} initializationDataType - Initialization data type given
|
|
72
|
+
* e.g. by the "encrypted" event for the corresponding request.
|
|
73
|
+
* @param {Uint8Array} initializationData - Initialization data given e.g. by
|
|
74
|
+
* the "encrypted" event for the corresponding request.
|
|
75
|
+
* @returns {Promise}
|
|
76
|
+
*/
|
|
77
|
+
generateLicenseRequest(mediaKeySession: MediaKeySession | ICustomMediaKeySession, initializationDataType: string | undefined, initializationData: Uint8Array): Promise<unknown>;
|
|
78
|
+
/**
|
|
79
|
+
* @param {Object} mediaKeySession
|
|
80
|
+
* @param {string} sessionId
|
|
81
|
+
* @returns {Promise}
|
|
82
|
+
*/
|
|
83
|
+
loadPersistentSession(mediaKeySession: MediaKeySession | ICustomMediaKeySession, sessionId: string): Promise<boolean>;
|
|
58
84
|
/**
|
|
59
85
|
* Close a MediaKeySession and remove its related stored information from the
|
|
60
86
|
* `LoadedSessionsStore`.
|
|
@@ -80,7 +106,23 @@ export default class LoadedSessionsStore {
|
|
|
80
106
|
* @returns {Promise}
|
|
81
107
|
*/
|
|
82
108
|
closeAllSessions(): Promise<void>;
|
|
109
|
+
/**
|
|
110
|
+
* Get the index of a stored MediaKeySession entry based on its
|
|
111
|
+
* `KeySessionRecord`.
|
|
112
|
+
* Returns -1 if not found.
|
|
113
|
+
* @param {Object} record
|
|
114
|
+
* @returns {number}
|
|
115
|
+
*/
|
|
83
116
|
private getIndex;
|
|
117
|
+
/**
|
|
118
|
+
* Prepare the closure of a `MediaKeySession` stored as an entry of the
|
|
119
|
+
* `LoadedSessionsStore`.
|
|
120
|
+
* Allows to postpone the closure action if another MediaKeySession action
|
|
121
|
+
* is already pending.
|
|
122
|
+
* @param {Object} entry
|
|
123
|
+
* @returns {Promise.<boolean>}
|
|
124
|
+
*/
|
|
125
|
+
private _closeEntry;
|
|
84
126
|
}
|
|
85
127
|
/** Information linked to a `MediaKeySession` created by the `LoadedSessionsStore`. */
|
|
86
128
|
export interface IStoredSessionEntry {
|
|
@@ -105,4 +147,55 @@ export interface IStoredSessionEntry {
|
|
|
105
147
|
* which the MediaKeySession was created.
|
|
106
148
|
*/
|
|
107
149
|
sessionType: MediaKeySessionType;
|
|
150
|
+
/**
|
|
151
|
+
* Set to `true` while a `generateRequest` call is pending.
|
|
152
|
+
* This information might be useful as it is one of the operation we have to
|
|
153
|
+
* wait for before closing a MediaKeySession.
|
|
154
|
+
*/
|
|
155
|
+
isGeneratingRequest: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Set to `true` while a `load` call is pending.
|
|
158
|
+
* This information might be useful as it is one of the operation we have to
|
|
159
|
+
* wait for before closing a MediaKeySession.
|
|
160
|
+
*/
|
|
161
|
+
isLoadingPersistentSession: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* The status of a potential `MediaKeySession`'s close request.
|
|
164
|
+
* Closing a MediaKeySession could be made complex as it normally cannot
|
|
165
|
+
* happen until `generateRequest` or `load` has been called.
|
|
166
|
+
*
|
|
167
|
+
* To avoid problems while still staying compatible to the most devices
|
|
168
|
+
* possible - which may have strange implementation of the specification -
|
|
169
|
+
* we're adding the `closingStatus` property allowing to perform multiple
|
|
170
|
+
* type of interaction while a close operation is either pending or is
|
|
171
|
+
* awaited.
|
|
172
|
+
*/
|
|
173
|
+
closingStatus:
|
|
174
|
+
/** Status when the MediaKeySession is currently being closed. */
|
|
175
|
+
{
|
|
176
|
+
type: "pending";
|
|
177
|
+
} |
|
|
178
|
+
/** Status when the MediaKeySession has been closed. */
|
|
179
|
+
{
|
|
180
|
+
type: "done";
|
|
181
|
+
} |
|
|
182
|
+
/** Status when the MediaKeySession failed to close. */
|
|
183
|
+
{
|
|
184
|
+
type: "failed";
|
|
185
|
+
} |
|
|
186
|
+
/**
|
|
187
|
+
* Status when a close order has been received for this MediaKeySession
|
|
188
|
+
* while some sensitive operation (examples are `generateRequest` and `load`
|
|
189
|
+
* calls).
|
|
190
|
+
* The `LoadedSessionsStore` should call `start` once it has finished those
|
|
191
|
+
* operations.
|
|
192
|
+
*/
|
|
193
|
+
{
|
|
194
|
+
type: "awaiting";
|
|
195
|
+
start: () => void;
|
|
196
|
+
} |
|
|
197
|
+
/** Status when the MediaKeySession failed to close. */
|
|
198
|
+
{
|
|
199
|
+
type: "none";
|
|
200
|
+
};
|
|
108
201
|
}
|