rx-player 4.4.0-dev.2025092200 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -2
- package/VERSION +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_dash_wasm.d.ts.map +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_dash_wasm.js +1 -1
- package/dist/commonjs/compat/is_codec_supported.d.ts +3 -1
- package/dist/commonjs/compat/is_codec_supported.d.ts.map +1 -1
- package/dist/commonjs/compat/is_codec_supported.js +7 -1
- package/dist/commonjs/main_thread/api/public_api.js +2 -2
- package/dist/commonjs/main_thread/init/media_source_content_initializer.d.ts.map +1 -1
- package/dist/commonjs/main_thread/init/media_source_content_initializer.js +8 -8
- package/dist/commonjs/main_thread/init/multi_thread_content_initializer.d.ts.map +1 -1
- package/dist/commonjs/main_thread/init/multi_thread_content_initializer.js +5 -5
- package/dist/commonjs/main_thread/init/utils/update_manifest_codec_support.d.ts +2 -1
- package/dist/commonjs/main_thread/init/utils/update_manifest_codec_support.d.ts.map +1 -1
- package/dist/commonjs/main_thread/init/utils/update_manifest_codec_support.js +2 -2
- package/dist/es2017/__GENERATED_CODE/embedded_dash_wasm.d.ts.map +1 -1
- package/dist/es2017/__GENERATED_CODE/embedded_dash_wasm.js +1 -1
- package/dist/es2017/compat/is_codec_supported.d.ts +3 -1
- package/dist/es2017/compat/is_codec_supported.d.ts.map +1 -1
- package/dist/es2017/compat/is_codec_supported.js +7 -1
- package/dist/es2017/main_thread/api/public_api.js +2 -2
- package/dist/es2017/main_thread/init/media_source_content_initializer.d.ts.map +1 -1
- package/dist/es2017/main_thread/init/media_source_content_initializer.js +8 -8
- package/dist/es2017/main_thread/init/multi_thread_content_initializer.d.ts.map +1 -1
- package/dist/es2017/main_thread/init/multi_thread_content_initializer.js +5 -5
- package/dist/es2017/main_thread/init/utils/update_manifest_codec_support.d.ts +2 -1
- package/dist/es2017/main_thread/init/utils/update_manifest_codec_support.d.ts.map +1 -1
- package/dist/es2017/main_thread/init/utils/update_manifest_codec_support.js +2 -2
- package/dist/mpd-parser.wasm +0 -0
- package/dist/rx-player.js +16 -11
- package/dist/rx-player.min.js +3 -3
- package/package.json +1 -1
- package/src/__GENERATED_CODE/embedded_dash_wasm.ts +1 -1
- package/src/compat/__tests__/is_codec_supported.test.ts +8 -8
- package/src/compat/is_codec_supported.ts +14 -1
- package/src/main_thread/api/public_api.ts +2 -2
- package/src/main_thread/init/media_source_content_initializer.ts +11 -7
- package/src/main_thread/init/multi_thread_content_initializer.ts +5 -4
- package/src/main_thread/init/utils/__tests__/update_manifest_codec_support.test.ts +18 -3
- package/src/main_thread/init/utils/update_manifest_codec_support.ts +3 -1
|
@@ -14,8 +14,8 @@ describe("Compat - isCodecSupported", () => {
|
|
|
14
14
|
});
|
|
15
15
|
const isCodecSupported = (await vi.importActual("../is_codec_supported"))
|
|
16
16
|
.default as typeof IIsCodecSupported;
|
|
17
|
-
expect(isCodecSupported("foo")).toEqual(false);
|
|
18
|
-
expect(isCodecSupported("")).toEqual(false);
|
|
17
|
+
expect(isCodecSupported(document.createElement("video"), "foo")).toEqual(false);
|
|
18
|
+
expect(isCodecSupported(document.createElement("video"), "")).toEqual(false);
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
it("should return true in any case if the MediaSource does not have the right function", async () => {
|
|
@@ -26,8 +26,8 @@ describe("Compat - isCodecSupported", () => {
|
|
|
26
26
|
});
|
|
27
27
|
const isCodecSupported = (await vi.importActual("../is_codec_supported"))
|
|
28
28
|
.default as typeof IIsCodecSupported;
|
|
29
|
-
expect(isCodecSupported("foo")).toEqual(true);
|
|
30
|
-
expect(isCodecSupported("")).toEqual(true);
|
|
29
|
+
expect(isCodecSupported(document.createElement("video"), "foo")).toEqual(true);
|
|
30
|
+
expect(isCodecSupported(document.createElement("video"), "")).toEqual(true);
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
it("should return true if MediaSource.isTypeSupported returns true", async () => {
|
|
@@ -42,8 +42,8 @@ describe("Compat - isCodecSupported", () => {
|
|
|
42
42
|
});
|
|
43
43
|
const isCodecSupported = (await vi.importActual("../is_codec_supported"))
|
|
44
44
|
.default as typeof IIsCodecSupported;
|
|
45
|
-
expect(isCodecSupported("foo")).toEqual(true);
|
|
46
|
-
expect(isCodecSupported("")).toEqual(true);
|
|
45
|
+
expect(isCodecSupported(document.createElement("video"), "foo")).toEqual(true);
|
|
46
|
+
expect(isCodecSupported(document.createElement("video"), "")).toEqual(true);
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
it("should return false if MediaSource.isTypeSupported returns false", async () => {
|
|
@@ -58,7 +58,7 @@ describe("Compat - isCodecSupported", () => {
|
|
|
58
58
|
});
|
|
59
59
|
const isCodecSupported = (await vi.importActual("../is_codec_supported"))
|
|
60
60
|
.default as typeof IIsCodecSupported;
|
|
61
|
-
expect(isCodecSupported("foo")).toEqual(false);
|
|
62
|
-
expect(isCodecSupported("")).toEqual(false);
|
|
61
|
+
expect(isCodecSupported(document.createElement("video"), "foo")).toEqual(false);
|
|
62
|
+
expect(isCodecSupported(document.createElement("video"), "")).toEqual(false);
|
|
63
63
|
});
|
|
64
64
|
});
|
|
@@ -14,10 +14,12 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import type DummyMediaElement from "../experimental/tools/DummyMediaElement";
|
|
17
18
|
import log from "../log";
|
|
18
19
|
import isNullOrUndefined from "../utils/is_null_or_undefined";
|
|
19
20
|
import isWorker from "../utils/is_worker";
|
|
20
21
|
import { MediaSource_ } from "./browser_compatibility_types";
|
|
22
|
+
import type { IMediaElement } from "./browser_compatibility_types";
|
|
21
23
|
|
|
22
24
|
/**
|
|
23
25
|
* Setting this value limit the number of entries in the support map
|
|
@@ -33,13 +35,24 @@ const supportMap: Map<string, boolean> = new Map();
|
|
|
33
35
|
/**
|
|
34
36
|
* Returns true if the given codec is supported by the browser's MediaSource
|
|
35
37
|
* implementation.
|
|
38
|
+
* @param {HTMLMediaElement} mediaElement
|
|
36
39
|
* @param {string} mimeType - The MIME media type that you want to test support
|
|
37
40
|
* for in the current browser.
|
|
38
41
|
* This may include the codecs parameter to provide added details about the
|
|
39
42
|
* codecs used within the file.
|
|
40
43
|
* @returns {Boolean}
|
|
41
44
|
*/
|
|
42
|
-
export default function isCodecSupported(
|
|
45
|
+
export default function isCodecSupported(
|
|
46
|
+
mediaElement: IMediaElement,
|
|
47
|
+
mimeType: string,
|
|
48
|
+
): boolean {
|
|
49
|
+
// TODO: We only added that as a hotfix for now, to allow support of the right codecs
|
|
50
|
+
// on a dummy media element
|
|
51
|
+
if ((mediaElement as DummyMediaElement).isDummy) {
|
|
52
|
+
return (mediaElement as DummyMediaElement).FORCED_MEDIA_SOURCE.isTypeSupported(
|
|
53
|
+
mimeType,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
43
56
|
if (isNullOrUndefined(MediaSource_)) {
|
|
44
57
|
if (isWorker) {
|
|
45
58
|
log.error("mse", "Cannot request codec support in a worker without MSE.");
|
|
@@ -445,7 +445,7 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
445
445
|
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
|
|
446
446
|
videoElement.preload = "auto";
|
|
447
447
|
|
|
448
|
-
this.version = /* PLAYER_VERSION */ "4.4.0
|
|
448
|
+
this.version = /* PLAYER_VERSION */ "4.4.0";
|
|
449
449
|
this.log = log;
|
|
450
450
|
this.state = "STOPPED";
|
|
451
451
|
this.videoElement = videoElement;
|
|
@@ -3576,7 +3576,7 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
3576
3576
|
}
|
|
3577
3577
|
}
|
|
3578
3578
|
}
|
|
3579
|
-
Player.version = /* PLAYER_VERSION */ "4.4.0
|
|
3579
|
+
Player.version = /* PLAYER_VERSION */ "4.4.0";
|
|
3580
3580
|
|
|
3581
3581
|
/** Every events sent by the RxPlayer's public API. */
|
|
3582
3582
|
interface IPublicAPIEvent {
|
|
@@ -317,10 +317,10 @@ export default class MediaSourceContentInitializer extends ContentInitializer {
|
|
|
317
317
|
if (this._initCanceller.isUsed()) {
|
|
318
318
|
return;
|
|
319
319
|
}
|
|
320
|
-
this._refreshManifestCodecSupport(loadedManifest);
|
|
320
|
+
this._refreshManifestCodecSupport(loadedManifest, mediaElement);
|
|
321
321
|
}, noop);
|
|
322
322
|
} else {
|
|
323
|
-
this._refreshManifestCodecSupport(syncManifest);
|
|
323
|
+
this._refreshManifestCodecSupport(syncManifest, mediaElement);
|
|
324
324
|
}
|
|
325
325
|
},
|
|
326
326
|
},
|
|
@@ -419,7 +419,7 @@ export default class MediaSourceContentInitializer extends ContentInitializer {
|
|
|
419
419
|
"manifestUpdate",
|
|
420
420
|
(updates) => {
|
|
421
421
|
this.trigger("manifestUpdate", updates);
|
|
422
|
-
this._refreshManifestCodecSupport(manifest);
|
|
422
|
+
this._refreshManifestCodecSupport(manifest, mediaElement);
|
|
423
423
|
},
|
|
424
424
|
initCanceller.signal,
|
|
425
425
|
);
|
|
@@ -459,7 +459,7 @@ export default class MediaSourceContentInitializer extends ContentInitializer {
|
|
|
459
459
|
segmentRequestOptions,
|
|
460
460
|
);
|
|
461
461
|
|
|
462
|
-
this._refreshManifestCodecSupport(manifest);
|
|
462
|
+
this._refreshManifestCodecSupport(manifest, mediaElement);
|
|
463
463
|
this.trigger("manifestReady", manifest);
|
|
464
464
|
if (initCanceller.isUsed()) {
|
|
465
465
|
return;
|
|
@@ -1094,10 +1094,11 @@ export default class MediaSourceContentInitializer extends ContentInitializer {
|
|
|
1094
1094
|
*/
|
|
1095
1095
|
private getCodecsSupportInfo(
|
|
1096
1096
|
codecsToCheck: Array<{ mimeType: string; codec: string }>,
|
|
1097
|
+
mediaElement: IMediaElement,
|
|
1097
1098
|
): ICodecSupportInfo[] {
|
|
1098
1099
|
const codecsSupportInfo: ICodecSupportInfo[] = codecsToCheck.map((codecToCheck) => {
|
|
1099
1100
|
const inputCodec = `${codecToCheck.mimeType};codecs="${codecToCheck.codec}"`;
|
|
1100
|
-
const isSupported = isCodecSupported(inputCodec);
|
|
1101
|
+
const isSupported = isCodecSupported(mediaElement, inputCodec);
|
|
1101
1102
|
if (!isSupported) {
|
|
1102
1103
|
return {
|
|
1103
1104
|
mimeType: codecToCheck.mimeType,
|
|
@@ -1146,9 +1147,12 @@ export default class MediaSourceContentInitializer extends ContentInitializer {
|
|
|
1146
1147
|
* to test for codec support are available.
|
|
1147
1148
|
* @param {Object} manifest
|
|
1148
1149
|
*/
|
|
1149
|
-
private _refreshManifestCodecSupport(
|
|
1150
|
+
private _refreshManifestCodecSupport(
|
|
1151
|
+
manifest: IManifest,
|
|
1152
|
+
mediaElement: IMediaElement,
|
|
1153
|
+
): void {
|
|
1150
1154
|
const codecsToTest = manifest.getCodecsWithUnknownSupport();
|
|
1151
|
-
const codecsSupportInfo = this.getCodecsSupportInfo(codecsToTest);
|
|
1155
|
+
const codecsSupportInfo = this.getCodecsSupportInfo(codecsToTest, mediaElement);
|
|
1152
1156
|
if (codecsSupportInfo.length > 0) {
|
|
1153
1157
|
try {
|
|
1154
1158
|
manifest.updateCodecSupport(codecsSupportInfo);
|
|
@@ -910,7 +910,7 @@ export default class MultiThreadContentInitializer extends ContentInitializer {
|
|
|
910
910
|
}
|
|
911
911
|
const manifest = msgData.value.manifest;
|
|
912
912
|
this._currentContentInfo.manifest = manifest;
|
|
913
|
-
this._updateCodecSupport(manifest);
|
|
913
|
+
this._updateCodecSupport(manifest, mediaElement);
|
|
914
914
|
this._startPlaybackIfReady(playbackStartParams);
|
|
915
915
|
break;
|
|
916
916
|
}
|
|
@@ -932,7 +932,7 @@ export default class MultiThreadContentInitializer extends ContentInitializer {
|
|
|
932
932
|
);
|
|
933
933
|
this._currentContentInfo?.streamEventsEmitter?.onManifestUpdate(manifest);
|
|
934
934
|
|
|
935
|
-
this._updateCodecSupport(manifest);
|
|
935
|
+
this._updateCodecSupport(manifest, mediaElement);
|
|
936
936
|
this.trigger("manifestUpdate", msgData.value.updates);
|
|
937
937
|
break;
|
|
938
938
|
}
|
|
@@ -1381,7 +1381,7 @@ export default class MultiThreadContentInitializer extends ContentInitializer {
|
|
|
1381
1381
|
if (isNullOrUndefined(manifest)) {
|
|
1382
1382
|
return;
|
|
1383
1383
|
}
|
|
1384
|
-
this._updateCodecSupport(manifest);
|
|
1384
|
+
this._updateCodecSupport(manifest, mediaElement);
|
|
1385
1385
|
contentDecryptor.removeEventListener(
|
|
1386
1386
|
"stateChange",
|
|
1387
1387
|
updateCodecSupportOnStateChange,
|
|
@@ -1500,11 +1500,12 @@ export default class MultiThreadContentInitializer extends ContentInitializer {
|
|
|
1500
1500
|
* status of these codecs, and forwards the list of supported codecs to the web worker.
|
|
1501
1501
|
* @param manifest
|
|
1502
1502
|
*/
|
|
1503
|
-
private _updateCodecSupport(manifest: IManifestMetadata) {
|
|
1503
|
+
private _updateCodecSupport(manifest: IManifestMetadata, mediaElement: IMediaElement) {
|
|
1504
1504
|
try {
|
|
1505
1505
|
const updatedCodecs = updateManifestCodecSupport(
|
|
1506
1506
|
manifest,
|
|
1507
1507
|
this._currentContentInfo?.contentDecryptor ?? null,
|
|
1508
|
+
mediaElement,
|
|
1508
1509
|
this._currentContentInfo?.useMseInWorker ?? false,
|
|
1509
1510
|
);
|
|
1510
1511
|
if (updatedCodecs.length > 0) {
|
|
@@ -196,7 +196,12 @@ describe("init - utils - updateManifestCodecSupport", () => {
|
|
|
196
196
|
const emeImplem = getEmeApiImplementation("auto");
|
|
197
197
|
assert(emeImplem !== null);
|
|
198
198
|
const contentDecryptor = new ContentDecryptor(emeImplem, video, [keySystem1]);
|
|
199
|
-
updateManifestCodecSupport(
|
|
199
|
+
updateManifestCodecSupport(
|
|
200
|
+
manifest,
|
|
201
|
+
contentDecryptor,
|
|
202
|
+
document.createElement("video"),
|
|
203
|
+
true,
|
|
204
|
+
);
|
|
200
205
|
expect(representationAVC.isSupported).toBe(true);
|
|
201
206
|
expect(representationHEVC.isSupported).toBe(true);
|
|
202
207
|
expect(representationVP9.isSupported).toBe(false); // Not Supported by MSE
|
|
@@ -280,7 +285,12 @@ describe("init - utils - updateManifestCodecSupport", () => {
|
|
|
280
285
|
const contentDecryptor = new ContentDecryptor(emeImplem, video, [keySystem1]);
|
|
281
286
|
await sleep(100);
|
|
282
287
|
contentDecryptor.attach();
|
|
283
|
-
updateManifestCodecSupport(
|
|
288
|
+
updateManifestCodecSupport(
|
|
289
|
+
manifest,
|
|
290
|
+
contentDecryptor,
|
|
291
|
+
document.createElement("video"),
|
|
292
|
+
true,
|
|
293
|
+
);
|
|
284
294
|
expect(encryptedRepresentationAVC.isSupported).toBe(true);
|
|
285
295
|
expect(encryptedRepresentationHEVC.isSupported).toBe(false); // Not supported by EME
|
|
286
296
|
expect(encryptedRepresentationVP9.isSupported).toBe(false); // Not supported by MSE
|
|
@@ -327,7 +337,12 @@ describe("init - utils - updateManifestCodecSupport", () => {
|
|
|
327
337
|
const emeImplem = getEmeApiImplementation("auto");
|
|
328
338
|
assert(emeImplem !== null);
|
|
329
339
|
const contentDecryptor = new ContentDecryptor(emeImplem, video, []);
|
|
330
|
-
updateManifestCodecSupport(
|
|
340
|
+
updateManifestCodecSupport(
|
|
341
|
+
manifest,
|
|
342
|
+
contentDecryptor,
|
|
343
|
+
document.createElement("video"),
|
|
344
|
+
true,
|
|
345
|
+
);
|
|
331
346
|
expect(representationAVC.isSupported).toBe(true);
|
|
332
347
|
expect(representationHEVC.isSupported).toBe(false); // not supported with MSE in worker
|
|
333
348
|
expect(representationMP4A.isSupported).toBe(true);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IMediaElement } from "../../../compat/browser_compatibility_types";
|
|
1
2
|
import isCodecSupported from "../../../compat/is_codec_supported";
|
|
2
3
|
import type { IManifestMetadata } from "../../../manifest";
|
|
3
4
|
import type Manifest from "../../../manifest/classes";
|
|
@@ -62,6 +63,7 @@ export function getCodecsWithUnknownSupport(
|
|
|
62
63
|
export function updateManifestCodecSupport(
|
|
63
64
|
manifest: IManifestMetadata,
|
|
64
65
|
contentDecryptor: ContentDecryptor | null,
|
|
66
|
+
mediaElement: IMediaElement,
|
|
65
67
|
isPlayingWithMSEinWorker: boolean,
|
|
66
68
|
): ICodecSupportInfo[] {
|
|
67
69
|
const codecSupportMap: Map<
|
|
@@ -87,7 +89,7 @@ export function updateManifestCodecSupport(
|
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
let newData;
|
|
90
|
-
const isSupported = isCodecSupported(inputCodec);
|
|
92
|
+
const isSupported = isCodecSupported(mediaElement, inputCodec);
|
|
91
93
|
if (!isSupported) {
|
|
92
94
|
newData = {
|
|
93
95
|
isSupportedClear: false,
|