rx-player 3.27.0-dev.20220317 → 3.27.0-dev.2022032100
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 +3 -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 +6 -7
- package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.js +7 -8
- package/dist/_esm5.processed/compat/eme/load_session.js +1 -2
- 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 +1 -2
- package/dist/_esm5.processed/core/decrypt/create_session.js +1 -2
- 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.js +5 -6
- 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/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 +128 -501
- 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 +6 -7
- package/src/compat/eme/custom_media_keys/webkit_media_keys.ts +7 -8
- 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 +1 -2
- package/src/core/decrypt/create_session.ts +2 -3
- 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 +5 -6
- 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/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.2022032100",
|
|
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.2022032100
|
|
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,
|
|
@@ -77,7 +76,7 @@ class OldWebkitMediaKeySession
|
|
|
77
76
|
|
|
78
77
|
this.sessionId = "";
|
|
79
78
|
this._closeSession = noop; // Just here to make TypeScript happy
|
|
80
|
-
this.closed = new
|
|
79
|
+
this.closed = new Promise((resolve) => {
|
|
81
80
|
this._closeSession = resolve;
|
|
82
81
|
});
|
|
83
82
|
this.keyStatuses = new Map();
|
|
@@ -92,7 +91,7 @@ class OldWebkitMediaKeySession
|
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
public update(license: Uint8Array) : Promise<void> {
|
|
95
|
-
return new
|
|
94
|
+
return new Promise((resolve, reject) => {
|
|
96
95
|
try {
|
|
97
96
|
if (this._key.indexOf("clearkey") >= 0) {
|
|
98
97
|
const licenseTypedArray =
|
|
@@ -121,14 +120,14 @@ class OldWebkitMediaKeySession
|
|
|
121
120
|
_initDataType: string,
|
|
122
121
|
initData: ArrayBuffer
|
|
123
122
|
): Promise<void> {
|
|
124
|
-
return new
|
|
123
|
+
return new Promise((resolve) => {
|
|
125
124
|
this._vid.webkitGenerateKeyRequest(this._key, initData);
|
|
126
125
|
resolve();
|
|
127
126
|
});
|
|
128
127
|
}
|
|
129
128
|
|
|
130
129
|
public close(): Promise<void> {
|
|
131
|
-
return new
|
|
130
|
+
return new Promise((resolve) => {
|
|
132
131
|
this._unbindSession();
|
|
133
132
|
this._closeSession();
|
|
134
133
|
resolve();
|
|
@@ -142,11 +141,11 @@ class OldWebkitMediaKeySession
|
|
|
142
141
|
*/
|
|
143
142
|
public load(): Promise<boolean> {
|
|
144
143
|
// Not implemented. Always return false as in "no session with that id".
|
|
145
|
-
return
|
|
144
|
+
return Promise.resolve(false);
|
|
146
145
|
}
|
|
147
146
|
|
|
148
147
|
public remove(): Promise<void> {
|
|
149
|
-
return
|
|
148
|
+
return Promise.resolve();
|
|
150
149
|
}
|
|
151
150
|
|
|
152
151
|
private _unbindSession() {
|
|
@@ -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 {
|
|
@@ -105,7 +104,7 @@ class WebkitMediaKeySession
|
|
|
105
104
|
|
|
106
105
|
this._unbindSession = noop;
|
|
107
106
|
this._closeSession = noop; // Just here to make TypeScript happy
|
|
108
|
-
this.closed = new
|
|
107
|
+
this.closed = new Promise((resolve) => {
|
|
109
108
|
this._closeSession = resolve;
|
|
110
109
|
});
|
|
111
110
|
this.keyStatuses = new Map();
|
|
@@ -117,7 +116,7 @@ class WebkitMediaKeySession
|
|
|
117
116
|
}
|
|
118
117
|
|
|
119
118
|
public update(license: BufferSource) : Promise<void> {
|
|
120
|
-
return new
|
|
119
|
+
return new Promise((resolve, reject) => {
|
|
121
120
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
122
121
|
if (this._nativeSession === undefined ||
|
|
123
122
|
this._nativeSession.update === undefined ||
|
|
@@ -140,7 +139,7 @@ class WebkitMediaKeySession
|
|
|
140
139
|
_initDataType: string,
|
|
141
140
|
initData: ArrayBuffer
|
|
142
141
|
): Promise<void> {
|
|
143
|
-
return new
|
|
142
|
+
return new Promise((resolve) => {
|
|
144
143
|
const elt = this._videoElement as ICompatHTMLMediaElement;
|
|
145
144
|
if (elt.webkitKeys?.createSession === undefined) {
|
|
146
145
|
throw new Error("No WebKitMediaKeys API.");
|
|
@@ -170,7 +169,7 @@ class WebkitMediaKeySession
|
|
|
170
169
|
}
|
|
171
170
|
|
|
172
171
|
public close(): Promise<void> {
|
|
173
|
-
return new
|
|
172
|
+
return new Promise((resolve, reject) => {
|
|
174
173
|
this._unbindSession();
|
|
175
174
|
this._closeSession();
|
|
176
175
|
if (this._nativeSession === undefined) {
|
|
@@ -185,11 +184,11 @@ class WebkitMediaKeySession
|
|
|
185
184
|
}
|
|
186
185
|
|
|
187
186
|
load(): Promise<boolean> {
|
|
188
|
-
return
|
|
187
|
+
return Promise.resolve(false);
|
|
189
188
|
}
|
|
190
189
|
|
|
191
190
|
remove(): Promise<void> {
|
|
192
|
-
return
|
|
191
|
+
return Promise.resolve();
|
|
193
192
|
}
|
|
194
193
|
|
|
195
194
|
get sessionId(): string {
|
|
@@ -253,7 +252,7 @@ class WebKitCustomMediaKeys implements ICustomWebKitMediaKeys {
|
|
|
253
252
|
|
|
254
253
|
setServerCertificate(serverCertificate: Uint8Array): Promise<void> {
|
|
255
254
|
this._serverCertificate = serverCertificate;
|
|
256
|
-
return
|
|
255
|
+
return Promise.resolve();
|
|
257
256
|
}
|
|
258
257
|
}
|
|
259
258
|
|
|
@@ -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.2022032100";
|
|
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.2022032100";
|
|
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,7 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import PPromise from "pinkie";
|
|
18
17
|
import {
|
|
19
18
|
events,
|
|
20
19
|
generateKeyRequest,
|
|
@@ -578,7 +577,7 @@ export default class ContentDecryptor extends EventEmitter<IContentDecryptorEven
|
|
|
578
577
|
}
|
|
579
578
|
}
|
|
580
579
|
|
|
581
|
-
return
|
|
580
|
+
return Promise.resolve();
|
|
582
581
|
}
|
|
583
582
|
|
|
584
583
|
private _tryToUseAlreadyCreatedSession(
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import PPromise from "pinkie";
|
|
18
17
|
import {
|
|
19
18
|
ICustomMediaKeySession,
|
|
20
19
|
loadSession,
|
|
@@ -78,8 +77,8 @@ function createTemporarySession(
|
|
|
78
77
|
) : Promise<INewSessionCreatedEvent> {
|
|
79
78
|
log.info("DRM: Creating a new temporary session");
|
|
80
79
|
const entry = loadedSessionsStore.createSession(initData, "temporary");
|
|
81
|
-
return
|
|
82
|
-
|
|
80
|
+
return Promise.resolve({ type: MediaKeySessionLoadingType.Created,
|
|
81
|
+
value: entry });
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
/**
|
|
@@ -24,7 +24,6 @@ import { EncryptedMediaError } from "../../errors";
|
|
|
24
24
|
import log from "../../log";
|
|
25
25
|
import arrayIncludes from "../../utils/array_includes";
|
|
26
26
|
import flatMap from "../../utils/flat_map";
|
|
27
|
-
import PPromise from "../../utils/promise";
|
|
28
27
|
import { CancellationSignal } from "../../utils/task_canceller";
|
|
29
28
|
import { IKeySystemOption } from "./types";
|
|
30
29
|
import MediaKeysInfosStore from "./utils/media_keys_infos_store";
|
|
@@ -258,7 +257,7 @@ export default function getMediaKeySystemAccess(
|
|
|
258
257
|
currentState.keySystemOptions);
|
|
259
258
|
if (cachedKeySystemAccess !== null) {
|
|
260
259
|
log.info("DRM: Found cached compatible keySystem");
|
|
261
|
-
return
|
|
260
|
+
return Promise.resolve({
|
|
262
261
|
type: "reuse-media-key-system-access" as const,
|
|
263
262
|
value: { mediaKeySystemAccess: cachedKeySystemAccess.keySystemAccess,
|
|
264
263
|
options: cachedKeySystemAccess.keySystemOptions },
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import PPromise from "../../../utils/promise";
|
|
18
17
|
import LoadedSessionsStore from "./loaded_sessions_store";
|
|
19
18
|
|
|
20
19
|
/**
|
|
@@ -41,5 +40,5 @@ export default async function cleanOldLoadedSessions(
|
|
|
41
40
|
const entry = entries[i];
|
|
42
41
|
proms.push(loadedSessionsStore.closeSession(entry.mediaKeySession));
|
|
43
42
|
}
|
|
44
|
-
await
|
|
43
|
+
await Promise.all(proms);
|
|
45
44
|
}
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import PPromise from "pinkie";
|
|
18
17
|
import { Subscription } from "rxjs";
|
|
19
18
|
import {
|
|
20
19
|
closeSession,
|
|
@@ -138,10 +137,10 @@ export default class LoadedSessionsStore {
|
|
|
138
137
|
if (entry === undefined) {
|
|
139
138
|
log.warn("DRM-LSS: No MediaKeySession found with " +
|
|
140
139
|
"the given initData and initDataType");
|
|
141
|
-
return
|
|
140
|
+
return Promise.resolve(false);
|
|
142
141
|
}
|
|
143
142
|
await safelyCloseMediaKeySession(entry.mediaKeySession);
|
|
144
|
-
return
|
|
143
|
+
return Promise.resolve(true);
|
|
145
144
|
}
|
|
146
145
|
|
|
147
146
|
/**
|
|
@@ -177,7 +176,7 @@ export default class LoadedSessionsStore {
|
|
|
177
176
|
|
|
178
177
|
const closingProms = allEntries
|
|
179
178
|
.map((entry) => safelyCloseMediaKeySession(entry.mediaKeySession));
|
|
180
|
-
await
|
|
179
|
+
await Promise.all(closingProms);
|
|
181
180
|
}
|
|
182
181
|
|
|
183
182
|
private getIndex(record : KeySessionRecord) : number {
|
|
@@ -294,7 +293,7 @@ function safelyCloseMediaKeySession(
|
|
|
294
293
|
sleepTimer = window.setTimeout(res, delay);
|
|
295
294
|
});
|
|
296
295
|
|
|
297
|
-
await
|
|
296
|
+
await Promise.race([ksChangeProm, ksMsgProm, sleepProm]);
|
|
298
297
|
ksChangeSub?.unsubscribe();
|
|
299
298
|
ksMsgSub?.unsubscribe();
|
|
300
299
|
clearTimeout(sleepTimer);
|
|
@@ -313,6 +312,6 @@ function safelyCloseMediaKeySession(
|
|
|
313
312
|
log.error("DRM: Could not close MediaKeySession: " +
|
|
314
313
|
(err instanceof Error ? err.toString() :
|
|
315
314
|
"Unknown error"));
|
|
316
|
-
return
|
|
315
|
+
return Promise.resolve(null);
|
|
317
316
|
}
|
|
318
317
|
}
|
|
@@ -30,7 +30,6 @@ import {
|
|
|
30
30
|
ITransportPipelines,
|
|
31
31
|
} from "../../../transports";
|
|
32
32
|
import assert from "../../../utils/assert";
|
|
33
|
-
import PPromise from "../../../utils/promise";
|
|
34
33
|
import TaskCanceller from "../../../utils/task_canceller";
|
|
35
34
|
import errorSelector from "../utils/error_selector";
|
|
36
35
|
import {
|
|
@@ -431,6 +430,5 @@ export default class ManifestFetcher {
|
|
|
431
430
|
* @returns {boolean}
|
|
432
431
|
*/
|
|
433
432
|
function isPromise<T>(val : T | Promise<T>) : val is Promise<T> {
|
|
434
|
-
return val instanceof
|
|
435
|
-
val instanceof Promise;
|
|
433
|
+
return val instanceof Promise;
|
|
436
434
|
}
|
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
import log from "../../../log";
|
|
25
25
|
import cancellableSleep from "../../../utils/cancellable_sleep";
|
|
26
26
|
import getFuzzedDelay from "../../../utils/get_fuzzed_delay";
|
|
27
|
-
import PPromise from "../../../utils/promise";
|
|
28
27
|
import TaskCanceller, {
|
|
29
28
|
CancellationSignal,
|
|
30
29
|
} from "../../../utils/task_canceller";
|
|
@@ -171,7 +170,7 @@ export function tryURLsWithBackoff<T>(
|
|
|
171
170
|
cancellationSignal : CancellationSignal
|
|
172
171
|
) : Promise<T> {
|
|
173
172
|
if (cancellationSignal.isCancelled) {
|
|
174
|
-
return
|
|
173
|
+
return Promise.reject(cancellationSignal.cancellationError);
|
|
175
174
|
}
|
|
176
175
|
|
|
177
176
|
const { baseDelay,
|
|
@@ -185,7 +184,7 @@ export function tryURLsWithBackoff<T>(
|
|
|
185
184
|
const urlsToTry = urls.slice();
|
|
186
185
|
if (urlsToTry.length === 0) {
|
|
187
186
|
log.warn("Fetchers: no URL given to `tryURLsWithBackoff`.");
|
|
188
|
-
return
|
|
187
|
+
return Promise.reject(new Error("No URL to request"));
|
|
189
188
|
}
|
|
190
189
|
return tryURLsRecursively(urlsToTry[0], 0);
|
|
191
190
|
|
|
@@ -56,6 +56,7 @@ import {
|
|
|
56
56
|
SegmentFetcherCreator,
|
|
57
57
|
} from "../fetchers";
|
|
58
58
|
import { ITextTrackSegmentBufferOptions } from "../segment_buffers";
|
|
59
|
+
import { IAudioTrackSwitchingMode } from "../stream";
|
|
59
60
|
import openMediaSource from "./create_media_source";
|
|
60
61
|
import EVENTS from "./events_generators";
|
|
61
62
|
import getInitialTime, {
|
|
@@ -105,7 +106,7 @@ export interface IInitializeArguments {
|
|
|
105
106
|
*/
|
|
106
107
|
enableFastSwitching : boolean;
|
|
107
108
|
/** Strategy when switching of audio track. */
|
|
108
|
-
audioTrackSwitchingMode :
|
|
109
|
+
audioTrackSwitchingMode : IAudioTrackSwitchingMode;
|
|
109
110
|
/** Behavior when a new video and/or audio codec is encountered. */
|
|
110
111
|
onCodecSwitch : "continue" | "reload";
|
|
111
112
|
};
|
package/src/core/stream/index.ts
CHANGED