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
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rx-player",
|
|
3
3
|
"author": "Canal+",
|
|
4
|
-
"version": "3.27.0-dev.
|
|
4
|
+
"version": "3.27.0-dev.2022032800",
|
|
5
5
|
"description": "Canal+ HTML5 Video Player",
|
|
6
6
|
"main": "./dist/rx-player.js",
|
|
7
7
|
"keywords": [
|
|
@@ -76,7 +76,6 @@
|
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"next-tick": "1.1.0",
|
|
79
|
-
"pinkie": "2.0.4",
|
|
80
79
|
"rxjs": "7.4.0"
|
|
81
80
|
},
|
|
82
81
|
"devDependencies": {
|
package/scripts/update-version
CHANGED
|
@@ -24,8 +24,8 @@ set -e
|
|
|
24
24
|
version=$1
|
|
25
25
|
|
|
26
26
|
sed -i.bak -e "s/\/\\* PLAYER_VERSION \\*\/\"\(.*\)\";/\/* PLAYER_VERSION *\/\"${version}\";/g" src/core/api/public_api.ts && rm src/core/api/public_api.ts.bak
|
|
27
|
-
sed -i.bak -e "s/\"version\"
|
|
28
|
-
sed -i.bak -e "s/sonar\.projectVersion=
|
|
27
|
+
sed -i.bak -e "s/\"version\":\s*\"[0-9]\+\.[0-9]\+\.[0-9]\+[^\"]*\"/\"version\": \"${version}\"/g" package.json && rm package.json.bak
|
|
28
|
+
sed -i.bak -e "s/sonar\.projectVersion= *.*/sonar.projectVersion=${version}/g" sonar-project.properties && rm sonar-project.properties.bak
|
|
29
29
|
echo $version > VERSION
|
|
30
30
|
|
|
31
31
|
npm install
|
package/sonar-project.properties
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
sonar.projectKey=rx-player
|
|
2
2
|
sonar.organization=rx-player
|
|
3
3
|
sonar.projectName=rx-player
|
|
4
|
-
sonar.projectVersion=3.27.0-dev.
|
|
4
|
+
sonar.projectVersion=3.27.0-dev.2022032800
|
|
5
5
|
sonar.sources=./src,./demo,./tests
|
|
6
6
|
sonar.exclusions=demo/full/bundle.js,demo/standalone/lib.js,demo/bundle.js
|
|
7
7
|
sonar.host.url=https://sonarcloud.io
|
|
@@ -21,11 +21,9 @@
|
|
|
21
21
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
22
22
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
23
23
|
|
|
24
|
-
import PPromise from "../../utils/promise";
|
|
25
|
-
|
|
26
24
|
describe("compat - play", () => {
|
|
27
25
|
it("should call play and returns an Observable if play returns a Promise", (done) => {
|
|
28
|
-
const mockPlay = jest.fn(() =>
|
|
26
|
+
const mockPlay = jest.fn(() => Promise.resolve());
|
|
29
27
|
const fakeMediaElement = { play: mockPlay };
|
|
30
28
|
|
|
31
29
|
const play$ = require("../play").default;
|
|
@@ -48,7 +46,7 @@ describe("compat - play", () => {
|
|
|
48
46
|
it("should throw through an Observable if the `play` promise is rejected", (done) => {
|
|
49
47
|
const notAllowedError = new Error("NotAllowedError: Can't play");
|
|
50
48
|
const mockPlay = jest.fn(() => {
|
|
51
|
-
return
|
|
49
|
+
return Promise.reject(notAllowedError);
|
|
52
50
|
});
|
|
53
51
|
const fakeMediaElement = { play: mockPlay };
|
|
54
52
|
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
import log from "../../log";
|
|
18
18
|
import cancellableSleep from "../../utils/cancellable_sleep";
|
|
19
|
-
import PPromise from "../../utils/promise";
|
|
20
19
|
import TaskCanceller, {
|
|
21
20
|
CancellationError,
|
|
22
21
|
} from "../../utils/task_canceller";
|
|
@@ -40,7 +39,7 @@ export default function closeSession(
|
|
|
40
39
|
): Promise<void> {
|
|
41
40
|
const timeoutCanceller = new TaskCanceller();
|
|
42
41
|
|
|
43
|
-
return
|
|
42
|
+
return Promise.race([
|
|
44
43
|
session.close()
|
|
45
44
|
.then(() => { timeoutCanceller.cancel(); }),
|
|
46
45
|
// The `closed` promise may resolve, even if `close()` result has not
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import PPromise from "../../utils/promise";
|
|
17
16
|
import { ICustomMediaKeys } from "./custom_media_keys";
|
|
18
17
|
|
|
19
18
|
// MediaKeySystemAccess implementation
|
|
@@ -56,7 +55,7 @@ export default class CustomMediaKeySystemAccess implements ICustomMediaKeySystem
|
|
|
56
55
|
* MediaKeySystemAccess. Never rejects.
|
|
57
56
|
*/
|
|
58
57
|
public createMediaKeys() : Promise<ICustomMediaKeys|MediaKeys> {
|
|
59
|
-
return new
|
|
58
|
+
return new Promise((res) => res(this._mediaKeys));
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
/**
|
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
takeUntil,
|
|
21
21
|
} from "rxjs";
|
|
22
22
|
import EventEmitter from "../../../utils/event_emitter";
|
|
23
|
-
import PPromise from "../../../utils/promise";
|
|
24
23
|
import { ICompatHTMLMediaElement } from "../../browser_compatibility_types";
|
|
25
24
|
import * as events from "../../event_listeners";
|
|
26
25
|
import {
|
|
@@ -52,11 +51,11 @@ class IE11MediaKeySession
|
|
|
52
51
|
this.keyStatuses = new Map();
|
|
53
52
|
this._mk = mk;
|
|
54
53
|
this._closeSession$ = new Subject();
|
|
55
|
-
this.closed = new
|
|
54
|
+
this.closed = new Promise((resolve) => {
|
|
56
55
|
this._closeSession$.subscribe(resolve);
|
|
57
56
|
});
|
|
58
57
|
this.update = (license: Uint8Array) => {
|
|
59
|
-
return new
|
|
58
|
+
return new Promise((resolve, reject) => {
|
|
60
59
|
if (this._ss === undefined) {
|
|
61
60
|
return reject("MediaKeySession not set.");
|
|
62
61
|
}
|
|
@@ -74,7 +73,7 @@ class IE11MediaKeySession
|
|
|
74
73
|
};
|
|
75
74
|
}
|
|
76
75
|
generateRequest(_initDataType: string, initData: BufferSource): Promise<void> {
|
|
77
|
-
return new
|
|
76
|
+
return new Promise((resolve) => {
|
|
78
77
|
const initDataU8 =
|
|
79
78
|
initData instanceof Uint8Array ? initData :
|
|
80
79
|
initData instanceof ArrayBuffer ? new Uint8Array(initData) :
|
|
@@ -89,7 +88,7 @@ class IE11MediaKeySession
|
|
|
89
88
|
});
|
|
90
89
|
}
|
|
91
90
|
close(): Promise<void> {
|
|
92
|
-
return new
|
|
91
|
+
return new Promise((resolve) => {
|
|
93
92
|
if (this._ss != null) {
|
|
94
93
|
this._ss.close();
|
|
95
94
|
this._ss = undefined;
|
|
@@ -100,10 +99,10 @@ class IE11MediaKeySession
|
|
|
100
99
|
});
|
|
101
100
|
}
|
|
102
101
|
load(): Promise<boolean> {
|
|
103
|
-
return
|
|
102
|
+
return Promise.resolve(false);
|
|
104
103
|
}
|
|
105
104
|
remove(): Promise<void> {
|
|
106
|
-
return
|
|
105
|
+
return Promise.resolve();
|
|
107
106
|
}
|
|
108
107
|
get sessionId(): string {
|
|
109
108
|
return this._ss?.sessionId ?? "";
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import PPromise from "pinkie";
|
|
18
17
|
import { MediaError } from "../../../errors";
|
|
19
18
|
import assert from "../../../utils/assert";
|
|
20
19
|
import { ICompatHTMLMediaElement } from "../../browser_compatibility_types";
|
|
@@ -154,7 +153,7 @@ if (isNode ||
|
|
|
154
153
|
keySystemConfigurations : MediaKeySystemConfiguration[]
|
|
155
154
|
) : Promise<MediaKeySystemAccess|CustomMediaKeySystemAccess> {
|
|
156
155
|
if (!isTypeSupported(keyType)) {
|
|
157
|
-
return
|
|
156
|
+
return Promise.reject(new Error("Unsupported key type"));
|
|
158
157
|
}
|
|
159
158
|
|
|
160
159
|
for (let i = 0; i < keySystemConfigurations.length; i++) {
|
|
@@ -185,7 +184,7 @@ if (isNode ||
|
|
|
185
184
|
|
|
186
185
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
187
186
|
const customMediaKeys = createCustomMediaKeys(keyType);
|
|
188
|
-
return
|
|
187
|
+
return Promise.resolve(
|
|
189
188
|
new CustomMediaKeySystemAccess(keyType,
|
|
190
189
|
customMediaKeys,
|
|
191
190
|
keySystemConfigurationResponse)
|
|
@@ -193,7 +192,7 @@ if (isNode ||
|
|
|
193
192
|
}
|
|
194
193
|
}
|
|
195
194
|
|
|
196
|
-
return
|
|
195
|
+
return Promise.reject(new Error("Unsupported configuration"));
|
|
197
196
|
};
|
|
198
197
|
}
|
|
199
198
|
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
import { base64ToBytes } from "../../../utils/base64";
|
|
18
18
|
import EventEmitter from "../../../utils/event_emitter";
|
|
19
19
|
import noop from "../../../utils/noop";
|
|
20
|
-
import PPromise from "../../../utils/promise";
|
|
21
20
|
import { utf8ToStr } from "../../../utils/string_parsing";
|
|
22
21
|
import {
|
|
23
22
|
ICustomMediaKeys,
|
|
@@ -67,7 +66,6 @@ class OldWebkitMediaKeySession
|
|
|
67
66
|
private readonly _vid: IOldWebkitHTMLMediaElement;
|
|
68
67
|
private readonly _key: string;
|
|
69
68
|
|
|
70
|
-
private readonly _onSessionRelatedEvent : (evt : Event) => void;
|
|
71
69
|
private _closeSession : () => void;
|
|
72
70
|
|
|
73
71
|
constructor(mediaElement: IOldWebkitHTMLMediaElement, keySystem: string) {
|
|
@@ -77,22 +75,33 @@ class OldWebkitMediaKeySession
|
|
|
77
75
|
|
|
78
76
|
this.sessionId = "";
|
|
79
77
|
this._closeSession = noop; // Just here to make TypeScript happy
|
|
80
|
-
this.closed = new PPromise((resolve) => {
|
|
81
|
-
this._closeSession = resolve;
|
|
82
|
-
});
|
|
83
78
|
this.keyStatuses = new Map();
|
|
84
79
|
this.expiration = NaN;
|
|
85
80
|
|
|
86
|
-
|
|
81
|
+
const onSessionRelatedEvent = (evt : Event) => {
|
|
87
82
|
this.trigger(evt.type, evt);
|
|
88
83
|
};
|
|
84
|
+
this.closed = new Promise((resolve) => {
|
|
85
|
+
this._closeSession = () => {
|
|
86
|
+
["keymessage", "message", "keyadded", "ready", "keyerror", "error"]
|
|
87
|
+
.forEach(evt => {
|
|
88
|
+
mediaElement.removeEventListener(evt, onSessionRelatedEvent);
|
|
89
|
+
mediaElement.removeEventListener(`webkit${evt}`, onSessionRelatedEvent);
|
|
90
|
+
});
|
|
91
|
+
resolve();
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
|
|
89
95
|
|
|
90
96
|
["keymessage", "message", "keyadded", "ready", "keyerror", "error"]
|
|
91
|
-
.forEach(evt =>
|
|
97
|
+
.forEach(evt => {
|
|
98
|
+
mediaElement.addEventListener(evt, onSessionRelatedEvent);
|
|
99
|
+
mediaElement.addEventListener(`webkit${evt}`, onSessionRelatedEvent);
|
|
100
|
+
});
|
|
92
101
|
}
|
|
93
102
|
|
|
94
103
|
public update(license: Uint8Array) : Promise<void> {
|
|
95
|
-
return new
|
|
104
|
+
return new Promise((resolve, reject) => {
|
|
96
105
|
try {
|
|
97
106
|
if (this._key.indexOf("clearkey") >= 0) {
|
|
98
107
|
const licenseTypedArray =
|
|
@@ -121,15 +130,14 @@ class OldWebkitMediaKeySession
|
|
|
121
130
|
_initDataType: string,
|
|
122
131
|
initData: ArrayBuffer
|
|
123
132
|
): Promise<void> {
|
|
124
|
-
return new
|
|
133
|
+
return new Promise((resolve) => {
|
|
125
134
|
this._vid.webkitGenerateKeyRequest(this._key, initData);
|
|
126
135
|
resolve();
|
|
127
136
|
});
|
|
128
137
|
}
|
|
129
138
|
|
|
130
139
|
public close(): Promise<void> {
|
|
131
|
-
return new
|
|
132
|
-
this._unbindSession();
|
|
140
|
+
return new Promise((resolve) => {
|
|
133
141
|
this._closeSession();
|
|
134
142
|
resolve();
|
|
135
143
|
});
|
|
@@ -142,16 +150,11 @@ class OldWebkitMediaKeySession
|
|
|
142
150
|
*/
|
|
143
151
|
public load(): Promise<boolean> {
|
|
144
152
|
// Not implemented. Always return false as in "no session with that id".
|
|
145
|
-
return
|
|
153
|
+
return Promise.resolve(false);
|
|
146
154
|
}
|
|
147
155
|
|
|
148
156
|
public remove(): Promise<void> {
|
|
149
|
-
return
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
private _unbindSession() {
|
|
153
|
-
["keymessage", "message", "keyadded", "ready", "keyerror", "error"]
|
|
154
|
-
.forEach(evt => this._vid.removeEventListener(evt, this._onSessionRelatedEvent));
|
|
157
|
+
return Promise.resolve();
|
|
155
158
|
}
|
|
156
159
|
}
|
|
157
160
|
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
import EventEmitter from "../../../utils/event_emitter";
|
|
18
18
|
import noop from "../../../utils/noop";
|
|
19
|
-
import PPromise from "../../../utils/promise";
|
|
20
19
|
import { ICompatHTMLMediaElement } from "../../browser_compatibility_types";
|
|
21
20
|
import getWebKitFairplayInitData from "../get_webkit_fairplay_initdata";
|
|
22
21
|
import {
|
|
@@ -84,7 +83,6 @@ class WebkitMediaKeySession
|
|
|
84
83
|
private _nativeSession: undefined | MediaKeySession;
|
|
85
84
|
private _serverCertificate: Uint8Array | undefined;
|
|
86
85
|
|
|
87
|
-
private readonly _onEvent : (evt : Event) => void;
|
|
88
86
|
private _closeSession : () => void;
|
|
89
87
|
private _unbindSession : () => void;
|
|
90
88
|
|
|
@@ -105,19 +103,15 @@ class WebkitMediaKeySession
|
|
|
105
103
|
|
|
106
104
|
this._unbindSession = noop;
|
|
107
105
|
this._closeSession = noop; // Just here to make TypeScript happy
|
|
108
|
-
this.closed = new
|
|
106
|
+
this.closed = new Promise((resolve) => {
|
|
109
107
|
this._closeSession = resolve;
|
|
110
108
|
});
|
|
111
109
|
this.keyStatuses = new Map();
|
|
112
110
|
this.expiration = NaN;
|
|
113
|
-
|
|
114
|
-
this._onEvent = (evt : Event) => {
|
|
115
|
-
this.trigger(evt.type, evt);
|
|
116
|
-
};
|
|
117
111
|
}
|
|
118
112
|
|
|
119
113
|
public update(license: BufferSource) : Promise<void> {
|
|
120
|
-
return new
|
|
114
|
+
return new Promise((resolve, reject) => {
|
|
121
115
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
122
116
|
if (this._nativeSession === undefined ||
|
|
123
117
|
this._nativeSession.update === undefined ||
|
|
@@ -125,9 +119,17 @@ class WebkitMediaKeySession
|
|
|
125
119
|
return reject("Unavailable WebKit key session.");
|
|
126
120
|
}
|
|
127
121
|
try {
|
|
122
|
+
let uInt8Arraylicense: Uint8Array;
|
|
123
|
+
if (license instanceof ArrayBuffer) {
|
|
124
|
+
uInt8Arraylicense = new Uint8Array(license);
|
|
125
|
+
} else if (license instanceof Uint8Array) {
|
|
126
|
+
uInt8Arraylicense = license;
|
|
127
|
+
} else {
|
|
128
|
+
uInt8Arraylicense = new Uint8Array(license.buffer);
|
|
129
|
+
}
|
|
128
130
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
129
131
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
130
|
-
resolve(this._nativeSession.update(
|
|
132
|
+
resolve(this._nativeSession.update(uInt8Arraylicense));
|
|
131
133
|
/* eslint-enable @typescript-eslint/no-unsafe-member-access */
|
|
132
134
|
} catch (err) {
|
|
133
135
|
reject(err);
|
|
@@ -140,7 +142,7 @@ class WebkitMediaKeySession
|
|
|
140
142
|
_initDataType: string,
|
|
141
143
|
initData: ArrayBuffer
|
|
142
144
|
): Promise<void> {
|
|
143
|
-
return new
|
|
145
|
+
return new Promise((resolve) => {
|
|
144
146
|
const elt = this._videoElement as ICompatHTMLMediaElement;
|
|
145
147
|
if (elt.webkitKeys?.createSession === undefined) {
|
|
146
148
|
throw new Error("No WebKitMediaKeys API.");
|
|
@@ -170,7 +172,7 @@ class WebkitMediaKeySession
|
|
|
170
172
|
}
|
|
171
173
|
|
|
172
174
|
public close(): Promise<void> {
|
|
173
|
-
return new
|
|
175
|
+
return new Promise((resolve, reject) => {
|
|
174
176
|
this._unbindSession();
|
|
175
177
|
this._closeSession();
|
|
176
178
|
if (this._nativeSession === undefined) {
|
|
@@ -185,11 +187,11 @@ class WebkitMediaKeySession
|
|
|
185
187
|
}
|
|
186
188
|
|
|
187
189
|
load(): Promise<boolean> {
|
|
188
|
-
return
|
|
190
|
+
return Promise.resolve(false);
|
|
189
191
|
}
|
|
190
192
|
|
|
191
193
|
remove(): Promise<void> {
|
|
192
|
-
return
|
|
194
|
+
return Promise.resolve();
|
|
193
195
|
}
|
|
194
196
|
|
|
195
197
|
get sessionId(): string {
|
|
@@ -203,15 +205,25 @@ class WebkitMediaKeySession
|
|
|
203
205
|
private _listenEvent(session: MediaKeySession) : void {
|
|
204
206
|
this._unbindSession(); // If previous session was linked
|
|
205
207
|
|
|
208
|
+
const onEvent = (evt : Event) => {
|
|
209
|
+
this.trigger(evt.type, evt);
|
|
210
|
+
};
|
|
211
|
+
|
|
206
212
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
207
213
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
208
214
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
209
215
|
["keymessage", "message", "keyadded", "ready", "keyerror", "error"]
|
|
210
|
-
.forEach(evt =>
|
|
216
|
+
.forEach(evt => {
|
|
217
|
+
session.addEventListener(evt, onEvent);
|
|
218
|
+
session.addEventListener(`webkit${evt}`, onEvent);
|
|
219
|
+
});
|
|
211
220
|
|
|
212
221
|
this._unbindSession = () => {
|
|
213
222
|
["keymessage", "message", "keyadded", "ready", "keyerror", "error"]
|
|
214
|
-
.forEach(evt =>
|
|
223
|
+
.forEach(evt => {
|
|
224
|
+
session.removeEventListener(evt, onEvent);
|
|
225
|
+
session.removeEventListener(`webkit${evt}`, onEvent);
|
|
226
|
+
});
|
|
215
227
|
};
|
|
216
228
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
217
229
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
@@ -253,7 +265,7 @@ class WebKitCustomMediaKeys implements ICustomWebKitMediaKeys {
|
|
|
253
265
|
|
|
254
266
|
setServerCertificate(serverCertificate: Uint8Array): Promise<void> {
|
|
255
267
|
this._serverCertificate = serverCertificate;
|
|
256
|
-
return
|
|
268
|
+
return Promise.resolve();
|
|
257
269
|
}
|
|
258
270
|
}
|
|
259
271
|
|
|
@@ -124,12 +124,10 @@ export function patchInitData(initData : Uint8Array) : Uint8Array {
|
|
|
124
124
|
* Generate a request from session.
|
|
125
125
|
* @param {MediaKeySession} session - MediaKeySession on which the request will
|
|
126
126
|
* be done.
|
|
127
|
-
* @param {
|
|
128
|
-
* "encrypted" event for the corresponding request.
|
|
129
|
-
* @param {
|
|
130
|
-
* "encrypted" event for the corresponding request.
|
|
131
|
-
* @param {string} sessionType - Type of session you want to generate. Consult
|
|
132
|
-
* EME Specification for more information on session types.
|
|
127
|
+
* @param {string} initializationDataType - Initialization data type given e.g.
|
|
128
|
+
* by the "encrypted" event for the corresponding request.
|
|
129
|
+
* @param {Uint8Array} initializationData - Initialization data given e.g. by
|
|
130
|
+
* the "encrypted" event for the corresponding request.
|
|
133
131
|
* @returns {Promise} - Emit when done. Errors if fails.
|
|
134
132
|
*/
|
|
135
133
|
export default function generateKeyRequest(
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import PPromise from "pinkie";
|
|
18
17
|
import log from "../../log";
|
|
19
18
|
import { ICustomMediaKeySession } from "./custom_media_keys";
|
|
20
19
|
|
|
@@ -49,7 +48,7 @@ export default async function loadSession(
|
|
|
49
48
|
// Chromium/Chrome versions where the `keyStatuses` property from a loaded
|
|
50
49
|
// MediaKeySession would not be populated directly as the load answer but
|
|
51
50
|
// asynchronously after.
|
|
52
|
-
return new
|
|
51
|
+
return new Promise((resolve) => {
|
|
53
52
|
(session as MediaKeySession).addEventListener("keystatuseschange",
|
|
54
53
|
resolveWithLoadedStatus);
|
|
55
54
|
const timeout = setTimeout(resolveWithLoadedStatus,
|
|
@@ -953,6 +953,17 @@ describe("API - parseLoadVideoOptions", () => {
|
|
|
953
953
|
audioTrackSwitchingMode: "direct",
|
|
954
954
|
});
|
|
955
955
|
|
|
956
|
+
expect(parseLoadVideoOptions({
|
|
957
|
+
audioTrackSwitchingMode: "reload",
|
|
958
|
+
url: "foo",
|
|
959
|
+
transport: "bar",
|
|
960
|
+
})).toEqual({
|
|
961
|
+
...defaultLoadVideoOptions,
|
|
962
|
+
url: "foo",
|
|
963
|
+
transport: "bar",
|
|
964
|
+
audioTrackSwitchingMode: "reload",
|
|
965
|
+
});
|
|
966
|
+
|
|
956
967
|
expect(parseLoadVideoOptions({
|
|
957
968
|
audioTrackSwitchingMode: "seamless",
|
|
958
969
|
url: "foo",
|
|
@@ -985,6 +996,7 @@ describe("API - parseLoadVideoOptions", () => {
|
|
|
985
996
|
`the following strategy name:
|
|
986
997
|
- \`seamless\`
|
|
987
998
|
- \`direct\`
|
|
999
|
+
- \`reload\`
|
|
988
1000
|
If badly set, seamless strategy will be used as default`);
|
|
989
1001
|
logWarnMock.mockReset();
|
|
990
1002
|
logWarnMock.mockReturnValue(undefined);
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
import objectAssign from "../../utils/object_assign";
|
|
38
38
|
import warnOnce from "../../utils/warn_once";
|
|
39
39
|
import { IKeySystemOption } from "../decrypt";
|
|
40
|
+
import { IAudioTrackSwitchingMode } from "../stream";
|
|
40
41
|
import {
|
|
41
42
|
IAudioTrackPreference,
|
|
42
43
|
ITextTrackPreference,
|
|
@@ -236,7 +237,7 @@ export interface ILoadVideoOptions {
|
|
|
236
237
|
textTrackElement? : HTMLElement;
|
|
237
238
|
manualBitrateSwitchingMode? : "seamless"|"direct";
|
|
238
239
|
enableFastSwitching? : boolean;
|
|
239
|
-
audioTrackSwitchingMode? :
|
|
240
|
+
audioTrackSwitchingMode? : IAudioTrackSwitchingMode;
|
|
240
241
|
onCodecSwitch? : "continue"|"reload";
|
|
241
242
|
|
|
242
243
|
/* eslint-disable import/no-deprecated */
|
|
@@ -266,7 +267,7 @@ interface IParsedLoadVideoOptionsBase {
|
|
|
266
267
|
startAt : IParsedStartAtOption|undefined;
|
|
267
268
|
manualBitrateSwitchingMode : "seamless"|"direct";
|
|
268
269
|
enableFastSwitching : boolean;
|
|
269
|
-
audioTrackSwitchingMode :
|
|
270
|
+
audioTrackSwitchingMode : IAudioTrackSwitchingMode;
|
|
270
271
|
onCodecSwitch : "continue"|"reload";
|
|
271
272
|
}
|
|
272
273
|
|
|
@@ -649,11 +650,12 @@ function parseLoadVideoOptions(
|
|
|
649
650
|
let audioTrackSwitchingMode = isNullOrUndefined(options.audioTrackSwitchingMode)
|
|
650
651
|
? DEFAULT_AUDIO_TRACK_SWITCHING_MODE
|
|
651
652
|
: options.audioTrackSwitchingMode;
|
|
652
|
-
if (!arrayIncludes(["seamless", "direct"], audioTrackSwitchingMode)) {
|
|
653
|
+
if (!arrayIncludes(["seamless", "direct", "reload"], audioTrackSwitchingMode)) {
|
|
653
654
|
log.warn("The `audioTrackSwitchingMode` loadVideo option must match one of " +
|
|
654
655
|
"the following strategy name:\n" +
|
|
655
656
|
"- `seamless`\n" +
|
|
656
657
|
"- `direct`\n" +
|
|
658
|
+
"- `reload`\n" +
|
|
657
659
|
"If badly set, " + DEFAULT_AUDIO_TRACK_SWITCHING_MODE +
|
|
658
660
|
" strategy will be used as default");
|
|
659
661
|
audioTrackSwitchingMode = DEFAULT_AUDIO_TRACK_SWITCHING_MODE;
|
|
@@ -76,7 +76,6 @@ import EventEmitter, {
|
|
|
76
76
|
import isNullOrUndefined from "../../utils/is_null_or_undefined";
|
|
77
77
|
import Logger from "../../utils/logger";
|
|
78
78
|
import objectAssign from "../../utils/object_assign";
|
|
79
|
-
import PPromise from "../../utils/promise";
|
|
80
79
|
import {
|
|
81
80
|
getLeftSizeOfRange,
|
|
82
81
|
getPlayedSizeOfRange,
|
|
@@ -428,7 +427,7 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
428
427
|
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
|
|
429
428
|
videoElement.preload = "auto";
|
|
430
429
|
|
|
431
|
-
this.version = /* PLAYER_VERSION */"3.27.0-dev.
|
|
430
|
+
this.version = /* PLAYER_VERSION */"3.27.0-dev.2022032800";
|
|
432
431
|
this.log = log;
|
|
433
432
|
this.state = "STOPPED";
|
|
434
433
|
this.videoElement = videoElement;
|
|
@@ -1539,7 +1538,7 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
1539
1538
|
/* eslint-disable @typescript-eslint/unbound-method */
|
|
1540
1539
|
if (isNullOrUndefined(playPromise) || typeof playPromise.catch !== "function") {
|
|
1541
1540
|
/* eslint-enable @typescript-eslint/unbound-method */
|
|
1542
|
-
return
|
|
1541
|
+
return Promise.resolve();
|
|
1543
1542
|
}
|
|
1544
1543
|
return playPromise.catch((error: Error) => {
|
|
1545
1544
|
if (error.name === "NotAllowedError") {
|
|
@@ -2947,7 +2946,7 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
2947
2946
|
return activeRepresentations[currentPeriod.id];
|
|
2948
2947
|
}
|
|
2949
2948
|
}
|
|
2950
|
-
Player.version = /* PLAYER_VERSION */"3.27.0-dev.
|
|
2949
|
+
Player.version = /* PLAYER_VERSION */"3.27.0-dev.2022032800";
|
|
2951
2950
|
|
|
2952
2951
|
/** Payload emitted with a `positionUpdate` event. */
|
|
2953
2952
|
export interface IPositionUpdateItem {
|
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
setMediaKeys,
|
|
21
21
|
} from "../../compat";
|
|
22
22
|
import log from "../../log";
|
|
23
|
-
import PPromise from "../../utils/promise";
|
|
24
23
|
import { CancellationSignal } from "../../utils/task_canceller";
|
|
25
24
|
import {
|
|
26
25
|
IKeySystemOption,
|
|
@@ -58,7 +57,7 @@ export default async function attachMediaKeys(
|
|
|
58
57
|
const closeAllSessions = previousState !== null &&
|
|
59
58
|
previousState.loadedSessionsStore !== loadedSessionsStore ?
|
|
60
59
|
previousState.loadedSessionsStore.closeAllSessions() :
|
|
61
|
-
|
|
60
|
+
Promise.resolve();
|
|
62
61
|
|
|
63
62
|
await closeAllSessions;
|
|
64
63
|
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
import { shouldUnsetMediaKeys } from "../../compat/";
|
|
18
18
|
import log from "../../log";
|
|
19
|
-
import PPromise from "../../utils/promise";
|
|
20
19
|
import disposeDecryptionResources from "./dispose_decryption_resources";
|
|
21
20
|
import MediaKeysInfosStore from "./utils/media_keys_infos_store";
|
|
22
21
|
|
|
@@ -44,5 +43,5 @@ export default function clearOnStop(
|
|
|
44
43
|
}
|
|
45
44
|
log.info("DRM: Nothing to clear. Returning right away. No state =",
|
|
46
45
|
currentState === null);
|
|
47
|
-
return
|
|
46
|
+
return Promise.resolve();
|
|
48
47
|
}
|
|
@@ -14,10 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import PPromise from "pinkie";
|
|
18
17
|
import {
|
|
19
18
|
events,
|
|
20
|
-
generateKeyRequest,
|
|
21
19
|
getInitData,
|
|
22
20
|
ICustomMediaKeys,
|
|
23
21
|
ICustomMediaKeySystemAccess,
|
|
@@ -568,17 +566,29 @@ export default class ContentDecryptor extends EventEmitter<IContentDecryptorEven
|
|
|
568
566
|
if (sessionRes.type === MediaKeySessionLoadingType.Created) {
|
|
569
567
|
const requestData = initializationData.values.constructRequestData();
|
|
570
568
|
try {
|
|
571
|
-
await
|
|
572
|
-
|
|
573
|
-
|
|
569
|
+
await stores.loadedSessionsStore.generateLicenseRequest(
|
|
570
|
+
mediaKeySession,
|
|
571
|
+
initializationData.type,
|
|
572
|
+
requestData);
|
|
574
573
|
} catch (error) {
|
|
574
|
+
// First check that the error was not due to the MediaKeySession closing
|
|
575
|
+
// or being closed
|
|
576
|
+
const entry = stores.loadedSessionsStore.getEntryForSession(mediaKeySession);
|
|
577
|
+
if (entry === null || entry.closingStatus.type !== "none") {
|
|
578
|
+
// MediaKeySession closing/closed: Just remove from handled list and abort.
|
|
579
|
+
const indexInCurrent = this._currentSessions.indexOf(sessionInfo);
|
|
580
|
+
if (indexInCurrent >= 0) {
|
|
581
|
+
this._currentSessions.splice(indexInCurrent, 1);
|
|
582
|
+
}
|
|
583
|
+
return Promise.resolve();
|
|
584
|
+
}
|
|
575
585
|
throw new EncryptedMediaError("KEY_GENERATE_REQUEST_ERROR",
|
|
576
586
|
error instanceof Error ? error.toString() :
|
|
577
587
|
"Unknown error");
|
|
578
588
|
}
|
|
579
589
|
}
|
|
580
590
|
|
|
581
|
-
return
|
|
591
|
+
return Promise.resolve();
|
|
582
592
|
}
|
|
583
593
|
|
|
584
594
|
private _tryToUseAlreadyCreatedSession(
|
|
@@ -88,7 +88,10 @@ export default async function createOrLoadSession(
|
|
|
88
88
|
throw cancelSignal.cancellationError; // stop here if cancelled since
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
const evt = await createSession(stores,
|
|
91
|
+
const evt = await createSession(stores,
|
|
92
|
+
initializationData,
|
|
93
|
+
wantedSessionType,
|
|
94
|
+
cancelSignal);
|
|
92
95
|
return { type: evt.type,
|
|
93
96
|
value: { mediaKeySession: evt.value.mediaKeySession,
|
|
94
97
|
sessionType: evt.value.sessionType,
|