rx-player 4.2.0-dev.2024081301 → 4.2.0-dev.2024082600
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/.vscode/settings.json +7 -0
- package/CHANGELOG.md +29 -0
- 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/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_worker.js +1 -1
- package/dist/commonjs/compat/eme/custom_media_keys/types.d.ts +3 -0
- package/dist/commonjs/compat/eme/custom_media_keys/types.d.ts.map +1 -1
- package/dist/commonjs/compat/eme/custom_media_keys/webkit_media_keys.d.ts +1 -1
- package/dist/commonjs/compat/eme/custom_media_keys/webkit_media_keys.d.ts.map +1 -1
- package/dist/commonjs/compat/eme/eme-api-implementation.d.ts +2 -2
- package/dist/commonjs/compat/eme/eme-api-implementation.d.ts.map +1 -1
- package/dist/commonjs/compat/eme/eme-api-implementation.js +19 -2
- package/dist/commonjs/compat/eme/get_init_data.d.ts +3 -1
- package/dist/commonjs/compat/eme/get_init_data.d.ts.map +1 -1
- package/dist/commonjs/compat/eme/get_init_data.js +2 -2
- package/dist/commonjs/compat/event_listeners.d.ts +21 -19
- package/dist/commonjs/compat/event_listeners.d.ts.map +1 -1
- package/dist/commonjs/compat/event_listeners.js +0 -11
- package/dist/commonjs/core/segment_sinks/inventory/segment_inventory.js +8 -5
- package/dist/commonjs/core/segment_sinks/segment_buffers_store.d.ts.map +1 -1
- package/dist/commonjs/core/segment_sinks/segment_buffers_store.js +5 -2
- package/dist/commonjs/main_thread/api/public_api.d.ts +22 -10
- package/dist/commonjs/main_thread/api/public_api.d.ts.map +1 -1
- package/dist/commonjs/main_thread/api/public_api.js +68 -28
- package/dist/commonjs/main_thread/decrypt/content_decryptor.d.ts +8 -0
- package/dist/commonjs/main_thread/decrypt/content_decryptor.d.ts.map +1 -1
- package/dist/commonjs/main_thread/decrypt/content_decryptor.js +51 -2
- package/dist/commonjs/main_thread/decrypt/types.d.ts +5 -0
- package/dist/commonjs/main_thread/decrypt/types.d.ts.map +1 -1
- package/dist/commonjs/main_thread/init/media_source_content_initializer.js +3 -3
- package/dist/commonjs/main_thread/tracks_store/tracks_store.d.ts +12 -4
- package/dist/commonjs/main_thread/tracks_store/tracks_store.d.ts.map +1 -1
- package/dist/commonjs/main_thread/tracks_store/tracks_store.js +18 -8
- package/dist/commonjs/manifest/classes/adaptation.d.ts.map +1 -1
- package/dist/commonjs/manifest/classes/adaptation.js +1 -4
- package/dist/commonjs/manifest/classes/representation.js +8 -8
- package/dist/commonjs/manifest/utils.d.ts +4 -3
- package/dist/commonjs/manifest/utils.d.ts.map +1 -1
- package/dist/commonjs/manifest/utils.js +13 -7
- package/dist/commonjs/parsers/manifest/dash/common/content_protection_parser.js +4 -4
- package/dist/commonjs/parsers/manifest/local/parse_local_manifest.js +1 -1
- package/dist/commonjs/parsers/manifest/smooth/create_parser.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/smooth/create_parser.js +1 -4
- package/dist/commonjs/parsers/manifest/types.d.ts +1 -6
- package/dist/commonjs/parsers/manifest/types.d.ts.map +1 -1
- package/dist/commonjs/public_types.d.ts +69 -0
- package/dist/commonjs/public_types.d.ts.map +1 -1
- package/dist/commonjs/utils/are_codecs_compatible.d.ts.map +1 -1
- package/dist/commonjs/utils/are_codecs_compatible.js +5 -1
- 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/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
- package/dist/es2017/__GENERATED_CODE/embedded_worker.js +1 -1
- package/dist/es2017/compat/eme/custom_media_keys/types.d.ts +3 -0
- package/dist/es2017/compat/eme/custom_media_keys/types.d.ts.map +1 -1
- package/dist/es2017/compat/eme/custom_media_keys/webkit_media_keys.d.ts +1 -1
- package/dist/es2017/compat/eme/custom_media_keys/webkit_media_keys.d.ts.map +1 -1
- package/dist/es2017/compat/eme/eme-api-implementation.d.ts +2 -2
- package/dist/es2017/compat/eme/eme-api-implementation.d.ts.map +1 -1
- package/dist/es2017/compat/eme/eme-api-implementation.js +19 -2
- package/dist/es2017/compat/eme/get_init_data.d.ts +3 -1
- package/dist/es2017/compat/eme/get_init_data.d.ts.map +1 -1
- package/dist/es2017/compat/eme/get_init_data.js +2 -2
- package/dist/es2017/compat/event_listeners.d.ts +21 -19
- package/dist/es2017/compat/event_listeners.d.ts.map +1 -1
- package/dist/es2017/compat/event_listeners.js +0 -11
- package/dist/es2017/core/segment_sinks/inventory/segment_inventory.js +8 -5
- package/dist/es2017/core/segment_sinks/segment_buffers_store.d.ts.map +1 -1
- package/dist/es2017/core/segment_sinks/segment_buffers_store.js +5 -2
- package/dist/es2017/main_thread/api/public_api.d.ts +22 -10
- package/dist/es2017/main_thread/api/public_api.d.ts.map +1 -1
- package/dist/es2017/main_thread/api/public_api.js +64 -24
- package/dist/es2017/main_thread/decrypt/content_decryptor.d.ts +8 -0
- package/dist/es2017/main_thread/decrypt/content_decryptor.d.ts.map +1 -1
- package/dist/es2017/main_thread/decrypt/content_decryptor.js +47 -2
- package/dist/es2017/main_thread/decrypt/types.d.ts +5 -0
- package/dist/es2017/main_thread/decrypt/types.d.ts.map +1 -1
- package/dist/es2017/main_thread/init/media_source_content_initializer.js +3 -3
- package/dist/es2017/main_thread/tracks_store/tracks_store.d.ts +12 -4
- package/dist/es2017/main_thread/tracks_store/tracks_store.d.ts.map +1 -1
- package/dist/es2017/main_thread/tracks_store/tracks_store.js +18 -8
- package/dist/es2017/manifest/classes/adaptation.d.ts.map +1 -1
- package/dist/es2017/manifest/classes/adaptation.js +1 -1
- package/dist/es2017/manifest/classes/representation.js +8 -8
- package/dist/es2017/manifest/utils.d.ts +4 -3
- package/dist/es2017/manifest/utils.d.ts.map +1 -1
- package/dist/es2017/manifest/utils.js +13 -7
- package/dist/es2017/parsers/manifest/dash/common/content_protection_parser.js +4 -4
- package/dist/es2017/parsers/manifest/local/parse_local_manifest.js +1 -1
- package/dist/es2017/parsers/manifest/smooth/create_parser.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/smooth/create_parser.js +1 -4
- package/dist/es2017/parsers/manifest/types.d.ts +1 -6
- package/dist/es2017/parsers/manifest/types.d.ts.map +1 -1
- package/dist/es2017/public_types.d.ts +69 -0
- package/dist/es2017/public_types.d.ts.map +1 -1
- package/dist/es2017/utils/are_codecs_compatible.d.ts.map +1 -1
- package/dist/es2017/utils/are_codecs_compatible.js +5 -1
- package/dist/mpd-parser.wasm +0 -0
- package/dist/rx-player.js +18 -18
- package/dist/worker.js +5 -5
- package/package.json +2 -2
- package/src/__GENERATED_CODE/embedded_dash_wasm.ts +1 -1
- package/src/__GENERATED_CODE/embedded_worker.ts +1 -1
- package/src/compat/eme/custom_media_keys/types.ts +4 -0
- package/src/compat/eme/custom_media_keys/webkit_media_keys.ts +1 -1
- package/src/compat/eme/eme-api-implementation.ts +35 -4
- package/src/compat/eme/get_init_data.ts +5 -3
- package/src/compat/event_listeners.ts +30 -5
- package/src/core/segment_sinks/inventory/segment_inventory.ts +7 -4
- package/src/core/segment_sinks/segment_buffers_store.ts +5 -2
- package/src/main_thread/api/public_api.ts +96 -24
- package/src/main_thread/decrypt/content_decryptor.ts +60 -3
- package/src/main_thread/decrypt/types.ts +5 -0
- package/src/main_thread/init/media_source_content_initializer.ts +3 -3
- package/src/main_thread/tracks_store/tracks_store.ts +30 -6
- package/src/manifest/classes/adaptation.ts +1 -3
- package/src/manifest/classes/representation.ts +6 -6
- package/src/manifest/utils.ts +14 -6
- package/src/parsers/manifest/dash/common/content_protection_parser.ts +4 -4
- package/src/parsers/manifest/local/parse_local_manifest.ts +1 -1
- package/src/parsers/manifest/smooth/create_parser.ts +2 -6
- package/src/parsers/manifest/types.ts +1 -7
- package/src/public_types.ts +73 -0
- package/src/utils/are_codecs_compatible.ts +5 -1
- package/vitest.config.mjs +1 -0
|
@@ -910,10 +910,16 @@ export default class TracksStore extends EventEmitter<ITracksStoreEvents> {
|
|
|
910
910
|
* `null` if audio tracks were disabled and `undefined` if the Period is not
|
|
911
911
|
* known.
|
|
912
912
|
*/
|
|
913
|
-
public getChosenAudioTrack(
|
|
913
|
+
public getChosenAudioTrack(
|
|
914
|
+
periodObj: ITSPeriodObject,
|
|
915
|
+
filterPlayableRepresentations: boolean,
|
|
916
|
+
): IAudioTrack | null {
|
|
914
917
|
return isNullOrUndefined(periodObj.audio.storedSettings)
|
|
915
918
|
? null
|
|
916
|
-
: toAudioTrack(
|
|
919
|
+
: toAudioTrack(
|
|
920
|
+
periodObj.audio.storedSettings.adaptation,
|
|
921
|
+
filterPlayableRepresentations,
|
|
922
|
+
);
|
|
917
923
|
}
|
|
918
924
|
|
|
919
925
|
/**
|
|
@@ -942,12 +948,18 @@ export default class TracksStore extends EventEmitter<ITracksStoreEvents> {
|
|
|
942
948
|
* @param {Object} periodObj - The concerned Period's object
|
|
943
949
|
* @returns {Object|null} - The video track chosen for this Period
|
|
944
950
|
*/
|
|
945
|
-
public getChosenVideoTrack(
|
|
951
|
+
public getChosenVideoTrack(
|
|
952
|
+
periodObj: ITSPeriodObject,
|
|
953
|
+
filterPlayableRepresentations: boolean,
|
|
954
|
+
): IVideoTrack | null {
|
|
946
955
|
if (isNullOrUndefined(periodObj.video.storedSettings)) {
|
|
947
956
|
return null;
|
|
948
957
|
}
|
|
949
958
|
|
|
950
|
-
return toVideoTrack(
|
|
959
|
+
return toVideoTrack(
|
|
960
|
+
periodObj.video.storedSettings.adaptation,
|
|
961
|
+
filterPlayableRepresentations,
|
|
962
|
+
);
|
|
951
963
|
}
|
|
952
964
|
|
|
953
965
|
/**
|
|
@@ -957,10 +969,15 @@ export default class TracksStore extends EventEmitter<ITracksStoreEvents> {
|
|
|
957
969
|
* Returns `undefined` if the given Period's id is not known.
|
|
958
970
|
*
|
|
959
971
|
* @param {Object} periodObj - The concerned Period's object
|
|
972
|
+
* @param {boolean} filterPlayableRepresentations - If `true`, only
|
|
973
|
+
* representations considered to be "playable" will be included in the
|
|
974
|
+
* returned response.
|
|
975
|
+
* If `false`, the response should contain all linked representations.
|
|
960
976
|
* @returns {Array.<Object>}
|
|
961
977
|
*/
|
|
962
978
|
public getAvailableAudioTracks(
|
|
963
979
|
periodObj: ITSPeriodObject,
|
|
980
|
+
filterPlayableRepresentations: boolean,
|
|
964
981
|
): IAvailableAudioTrack[] | undefined {
|
|
965
982
|
const storedSettings = periodObj.audio.storedSettings;
|
|
966
983
|
const currentId = !isNullOrUndefined(storedSettings)
|
|
@@ -969,7 +986,9 @@ export default class TracksStore extends EventEmitter<ITracksStoreEvents> {
|
|
|
969
986
|
const adaptations = getSupportedAdaptations(periodObj.period, "audio");
|
|
970
987
|
return adaptations.map((adaptation: IAdaptationMetadata) => {
|
|
971
988
|
const active = currentId === null ? false : currentId === adaptation.id;
|
|
972
|
-
return objectAssign(toAudioTrack(adaptation,
|
|
989
|
+
return objectAssign(toAudioTrack(adaptation, filterPlayableRepresentations), {
|
|
990
|
+
active,
|
|
991
|
+
});
|
|
973
992
|
});
|
|
974
993
|
}
|
|
975
994
|
|
|
@@ -1004,10 +1023,15 @@ export default class TracksStore extends EventEmitter<ITracksStoreEvents> {
|
|
|
1004
1023
|
* Returns `undefined` if the given Period's id is not known.
|
|
1005
1024
|
*
|
|
1006
1025
|
* @param {Object} periodObj - The concerned Period's object
|
|
1026
|
+
* @param {boolean} filterPlayableRepresentations - If `true`, only
|
|
1027
|
+
* representations considered to be "playable" will be included in the
|
|
1028
|
+
* returned response.
|
|
1029
|
+
* If `false`, the response should contain all linked representations.
|
|
1007
1030
|
* @returns {Array.<Object>}
|
|
1008
1031
|
*/
|
|
1009
1032
|
public getAvailableVideoTracks(
|
|
1010
1033
|
periodObj: ITSPeriodObject,
|
|
1034
|
+
filterPlayableRepresentations: boolean,
|
|
1011
1035
|
): IAvailableVideoTrack[] | undefined {
|
|
1012
1036
|
const storedSettings = periodObj.video.storedSettings;
|
|
1013
1037
|
const currentId = isNullOrUndefined(storedSettings)
|
|
@@ -1017,7 +1041,7 @@ export default class TracksStore extends EventEmitter<ITracksStoreEvents> {
|
|
|
1017
1041
|
const adaptations = getSupportedAdaptations(periodObj.period, "video");
|
|
1018
1042
|
return adaptations.map((adaptation) => {
|
|
1019
1043
|
const active = currentId === null ? false : currentId === adaptation.id;
|
|
1020
|
-
const track = toVideoTrack(adaptation,
|
|
1044
|
+
const track = toVideoTrack(adaptation, filterPlayableRepresentations);
|
|
1021
1045
|
const trickModeTracks =
|
|
1022
1046
|
track.trickModeTracks !== undefined
|
|
1023
1047
|
? track.trickModeTracks.map((trickModeAdaptation) => {
|
|
@@ -180,9 +180,7 @@ export default class Adaptation implements IAdaptationMetadata {
|
|
|
180
180
|
if (representation.contentProtections !== undefined) {
|
|
181
181
|
reprObject.contentProtections = {};
|
|
182
182
|
if (representation.contentProtections.keyIds !== undefined) {
|
|
183
|
-
const keyIds = representation.contentProtections.keyIds
|
|
184
|
-
({ keyId }) => keyId,
|
|
185
|
-
);
|
|
183
|
+
const keyIds = representation.contentProtections.keyIds;
|
|
186
184
|
reprObject.contentProtections.keyIds = keyIds;
|
|
187
185
|
}
|
|
188
186
|
}
|
|
@@ -281,7 +281,7 @@ class Representation implements IRepresentationMetadata {
|
|
|
281
281
|
for (let j = 0; j < initData.values.length; j++) {
|
|
282
282
|
if (initData.values[j].systemId.toLowerCase() === drmSystemId.toLowerCase()) {
|
|
283
283
|
if (!createdObjForType) {
|
|
284
|
-
const keyIds = this.contentProtections?.keyIds
|
|
284
|
+
const keyIds = this.contentProtections?.keyIds;
|
|
285
285
|
filtered.push({
|
|
286
286
|
type: initData.type,
|
|
287
287
|
keyIds,
|
|
@@ -330,7 +330,7 @@ class Representation implements IRepresentationMetadata {
|
|
|
330
330
|
) {
|
|
331
331
|
return [];
|
|
332
332
|
}
|
|
333
|
-
const keyIds = this.contentProtections?.keyIds
|
|
333
|
+
const keyIds = this.contentProtections?.keyIds;
|
|
334
334
|
return this.contentProtections.initData.map((x) => {
|
|
335
335
|
return { type: x.type, keyIds, values: x.values };
|
|
336
336
|
});
|
|
@@ -363,7 +363,7 @@ class Representation implements IRepresentationMetadata {
|
|
|
363
363
|
let hasUpdatedProtectionData = false;
|
|
364
364
|
if (this.contentProtections === undefined) {
|
|
365
365
|
this.contentProtections = {
|
|
366
|
-
keyIds: keyId !== undefined ? [
|
|
366
|
+
keyIds: keyId !== undefined ? [keyId] : [],
|
|
367
367
|
initData: [{ type: initDataType, values: data }],
|
|
368
368
|
};
|
|
369
369
|
return true;
|
|
@@ -372,17 +372,17 @@ class Representation implements IRepresentationMetadata {
|
|
|
372
372
|
if (keyId !== undefined) {
|
|
373
373
|
const keyIds = this.contentProtections.keyIds;
|
|
374
374
|
if (keyIds === undefined) {
|
|
375
|
-
this.contentProtections.keyIds = [
|
|
375
|
+
this.contentProtections.keyIds = [keyId];
|
|
376
376
|
} else {
|
|
377
377
|
let foundKeyId = false;
|
|
378
378
|
for (const knownKeyId of keyIds) {
|
|
379
|
-
if (areArraysOfNumbersEqual(knownKeyId
|
|
379
|
+
if (areArraysOfNumbersEqual(knownKeyId, keyId)) {
|
|
380
380
|
foundKeyId = true;
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
if (!foundKeyId) {
|
|
384
384
|
log.warn("Manifest: found unanounced key id.");
|
|
385
|
-
keyIds.push(
|
|
385
|
+
keyIds.push(keyId);
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
}
|
package/src/manifest/utils.ts
CHANGED
|
@@ -358,6 +358,7 @@ function toVideoRepresentation(
|
|
|
358
358
|
hdrInfo,
|
|
359
359
|
isSupported,
|
|
360
360
|
decipherable,
|
|
361
|
+
contentProtections,
|
|
361
362
|
} = representation;
|
|
362
363
|
return {
|
|
363
364
|
id,
|
|
@@ -369,6 +370,12 @@ function toVideoRepresentation(
|
|
|
369
370
|
hdrInfo,
|
|
370
371
|
isCodecSupported: isSupported,
|
|
371
372
|
decipherable,
|
|
373
|
+
contentProtections:
|
|
374
|
+
contentProtections !== undefined
|
|
375
|
+
? {
|
|
376
|
+
keyIds: contentProtections.keyIds,
|
|
377
|
+
}
|
|
378
|
+
: undefined,
|
|
372
379
|
};
|
|
373
380
|
}
|
|
374
381
|
|
|
@@ -407,9 +414,10 @@ export interface IDecipherabilityStatusChangedElement {
|
|
|
407
414
|
* decipherability updated to `undefined`.
|
|
408
415
|
*
|
|
409
416
|
* @param {Object} manifest
|
|
410
|
-
* @param {
|
|
411
|
-
* @param {Array.<Uint8Array>}
|
|
412
|
-
* @param {Array.<Uint8Array>}
|
|
417
|
+
* @param {Object} updates
|
|
418
|
+
* @param {Array.<Uint8Array>} updates.whitelistedKeyIds
|
|
419
|
+
* @param {Array.<Uint8Array>} updates.blacklistedKeyIds
|
|
420
|
+
* @param {Array.<Uint8Array>} updates.delistedKeyIds
|
|
413
421
|
*/
|
|
414
422
|
export function updateDecipherabilityFromKeyIds(
|
|
415
423
|
manifest: IManifestMetadata,
|
|
@@ -428,17 +436,17 @@ export function updateDecipherabilityFromKeyIds(
|
|
|
428
436
|
if (contentKIDs !== undefined) {
|
|
429
437
|
for (const elt of contentKIDs) {
|
|
430
438
|
for (const blacklistedKeyId of blacklistedKeyIds) {
|
|
431
|
-
if (areArraysOfNumbersEqual(blacklistedKeyId, elt
|
|
439
|
+
if (areArraysOfNumbersEqual(blacklistedKeyId, elt)) {
|
|
432
440
|
return false;
|
|
433
441
|
}
|
|
434
442
|
}
|
|
435
443
|
for (const whitelistedKeyId of whitelistedKeyIds) {
|
|
436
|
-
if (areArraysOfNumbersEqual(whitelistedKeyId, elt
|
|
444
|
+
if (areArraysOfNumbersEqual(whitelistedKeyId, elt)) {
|
|
437
445
|
return true;
|
|
438
446
|
}
|
|
439
447
|
}
|
|
440
448
|
for (const delistedKeyId of delistedKeyIds) {
|
|
441
|
-
if (areArraysOfNumbersEqual(delistedKeyId, elt
|
|
449
|
+
if (areArraysOfNumbersEqual(delistedKeyId, elt)) {
|
|
442
450
|
return undefined;
|
|
443
451
|
}
|
|
444
452
|
}
|
|
@@ -214,13 +214,13 @@ function parseContentProtection(
|
|
|
214
214
|
contentProtectionIr.attributes.keyId !== undefined &&
|
|
215
215
|
contentProtectionIr.attributes.keyId.length > 0
|
|
216
216
|
) {
|
|
217
|
-
const
|
|
217
|
+
const kid = contentProtectionIr.attributes.keyId;
|
|
218
218
|
if (representation.contentProtections === undefined) {
|
|
219
|
-
representation.contentProtections = { keyIds: [
|
|
219
|
+
representation.contentProtections = { keyIds: [kid], initData: [] };
|
|
220
220
|
} else if (representation.contentProtections.keyIds === undefined) {
|
|
221
|
-
representation.contentProtections.keyIds = [
|
|
221
|
+
representation.contentProtections.keyIds = [kid];
|
|
222
222
|
} else {
|
|
223
|
-
representation.contentProtections.keyIds.push(
|
|
223
|
+
representation.contentProtections.keyIds.push(kid);
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
|
|
@@ -169,7 +169,7 @@ function parseRepresentation(
|
|
|
169
169
|
function formatContentProtections(
|
|
170
170
|
localContentProtections: ILocalContentProtections,
|
|
171
171
|
): IContentProtections {
|
|
172
|
-
const keyIds = localContentProtections.keyIds;
|
|
172
|
+
const keyIds = localContentProtections.keyIds.map((k) => k.keyId);
|
|
173
173
|
const initData: IContentProtectionInitData[] = Object.keys(
|
|
174
174
|
localContentProtections.initData,
|
|
175
175
|
).map((currType) => {
|
|
@@ -27,7 +27,6 @@ import { getFilenameIndexInUrl } from "../../../utils/resolve_url";
|
|
|
27
27
|
import { hexToBytes } from "../../../utils/string_parsing";
|
|
28
28
|
import { createBox } from "../../containers/isobmff";
|
|
29
29
|
import type {
|
|
30
|
-
IContentProtectionKID,
|
|
31
30
|
IParsedAdaptation,
|
|
32
31
|
IParsedAdaptations,
|
|
33
32
|
IParsedManifest,
|
|
@@ -371,15 +370,12 @@ function createSmoothStreamingParser(
|
|
|
371
370
|
(!isNullOrUndefined(codecs) ? codecs + "-" : "") +
|
|
372
371
|
String(qualityLevel.bitrate);
|
|
373
372
|
|
|
374
|
-
const keyIDs:
|
|
373
|
+
const keyIDs: Uint8Array[] = [];
|
|
375
374
|
let firstProtection: IContentProtectionSmooth | undefined;
|
|
376
375
|
if (protections.length > 0) {
|
|
377
376
|
firstProtection = protections[0];
|
|
378
377
|
protections.forEach((protection) => {
|
|
379
|
-
|
|
380
|
-
protection.keySystems.forEach((keySystem) => {
|
|
381
|
-
keyIDs.push({ keyId, systemId: keySystem.systemId });
|
|
382
|
-
});
|
|
378
|
+
keyIDs.push(protection.keyId);
|
|
383
379
|
});
|
|
384
380
|
}
|
|
385
381
|
|
|
@@ -39,12 +39,6 @@ export interface IParsedStreamEventData {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
/** Describes information about an encryption Key ID of a given media. */
|
|
43
|
-
export interface IContentProtectionKID {
|
|
44
|
-
keyId: Uint8Array;
|
|
45
|
-
systemId?: string | undefined;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
42
|
/**
|
|
49
43
|
* Encryption initialization data.
|
|
50
44
|
* This is the data used to initialize a license request.
|
|
@@ -85,7 +79,7 @@ export interface IContentProtections {
|
|
|
85
79
|
* `undefined` if the key id(s) associated with that content may exist but are
|
|
86
80
|
* not known.
|
|
87
81
|
*/
|
|
88
|
-
keyIds:
|
|
82
|
+
keyIds: Uint8Array[] | undefined;
|
|
89
83
|
/** The different encryption initialization data associated with that content. */
|
|
90
84
|
initData: IContentProtectionInitData[];
|
|
91
85
|
}
|
package/src/public_types.ts
CHANGED
|
@@ -803,12 +803,50 @@ export interface IRepresentationContext {
|
|
|
803
803
|
* RxPlayer.
|
|
804
804
|
*/
|
|
805
805
|
export interface IAudioRepresentation {
|
|
806
|
+
/**
|
|
807
|
+
* Identifier for that Representation.
|
|
808
|
+
* Might e.g. be used with the `lockVideoRepresentation` API.
|
|
809
|
+
*/
|
|
806
810
|
id: string | number;
|
|
811
|
+
/** Optional maximum bitrate, in bits per seconds, for this Representation. */
|
|
807
812
|
bitrate?: number | undefined;
|
|
813
|
+
/** Codec(s) relied on by the media segments of that Representation. */
|
|
808
814
|
codec?: string | undefined;
|
|
815
|
+
/**
|
|
816
|
+
* If `true`, this Representation is linked to "spatial audio" technology, such as
|
|
817
|
+
* Dolby Atmos.
|
|
818
|
+
* If `false`, it is not linked to such technology.
|
|
819
|
+
*
|
|
820
|
+
* If `undefined`, we don't if it is linked to a spatial audio technology or not.
|
|
821
|
+
*/
|
|
809
822
|
isSpatialAudio?: boolean | undefined;
|
|
823
|
+
/**
|
|
824
|
+
* If `true`, the codec is known to be supported on the current device.
|
|
825
|
+
* If `false`, it is known to be unsupported.
|
|
826
|
+
*
|
|
827
|
+
* If `undefined`, we don't know yet if it is supported or not.
|
|
828
|
+
*/
|
|
810
829
|
isCodecSupported?: boolean | undefined;
|
|
830
|
+
/**
|
|
831
|
+
* If `true`, this Representation is known to be decipherable.
|
|
832
|
+
* If `false`, it is known to be encrypted and not decipherable.
|
|
833
|
+
*
|
|
834
|
+
* If `undefined`, we don't know yet if it is decipherable or not (or if it is
|
|
835
|
+
* encrypted or not in some cases).
|
|
836
|
+
*/
|
|
811
837
|
decipherable?: boolean | undefined;
|
|
838
|
+
/**
|
|
839
|
+
* Encryption information linked to this content.
|
|
840
|
+
* If set to an Object, the Representation is known to be encrypted.
|
|
841
|
+
* If unset or set to `undefined` the Representation is either unencrypted or
|
|
842
|
+
* we don't know if it is.
|
|
843
|
+
*/
|
|
844
|
+
contentProtections?:
|
|
845
|
+
| {
|
|
846
|
+
/** Known key ids linked to that Representation. */
|
|
847
|
+
keyIds?: Uint8Array[] | undefined;
|
|
848
|
+
}
|
|
849
|
+
| undefined;
|
|
812
850
|
}
|
|
813
851
|
|
|
814
852
|
/** Audio track returned by the RxPlayer. */
|
|
@@ -847,15 +885,50 @@ export interface ITextTrack {
|
|
|
847
885
|
* RxPlayer.
|
|
848
886
|
*/
|
|
849
887
|
export interface IVideoRepresentation {
|
|
888
|
+
/**
|
|
889
|
+
* Identifier for that Representation.
|
|
890
|
+
* Might e.g. be used with the `lockVideoRepresentation` API.
|
|
891
|
+
*/
|
|
850
892
|
id: string;
|
|
893
|
+
/** Optional maximum bitrate, in bits per seconds, for this Representation. */
|
|
851
894
|
bitrate?: number | undefined;
|
|
895
|
+
/** Defines the width of the Representation in pixels. */
|
|
852
896
|
width?: number | undefined;
|
|
897
|
+
/** Defines the height of the Representation in pixels. */
|
|
853
898
|
height?: number | undefined;
|
|
899
|
+
/** Codec(s) relied on by the media segments of that Representation. */
|
|
854
900
|
codec?: string | undefined;
|
|
901
|
+
/** The frame rate for this Representation, in frame per seconds. */
|
|
855
902
|
frameRate?: number | undefined;
|
|
903
|
+
/** If the track is HDR, gives the HDR characteristics of the content */
|
|
856
904
|
hdrInfo?: IHDRInformation | undefined;
|
|
905
|
+
/**
|
|
906
|
+
* If `true`, the codec is known to be supported on the current device.
|
|
907
|
+
* If `false`, it is known to be unsupported.
|
|
908
|
+
*
|
|
909
|
+
* If `undefined`, we don't know yet if it is supported or not.
|
|
910
|
+
*/
|
|
857
911
|
isCodecSupported?: boolean | undefined;
|
|
912
|
+
/**
|
|
913
|
+
* If `true`, this Representation is known to be decipherable.
|
|
914
|
+
* If `false`, it is known to be encrypted and not decipherable.
|
|
915
|
+
*
|
|
916
|
+
* If `undefined`, we don't know yet if it is decipherable or not (or if it is
|
|
917
|
+
* encrypted or not in some cases).
|
|
918
|
+
*/
|
|
858
919
|
decipherable?: boolean | undefined;
|
|
920
|
+
/**
|
|
921
|
+
* Encryption information linked to this content.
|
|
922
|
+
* If set to an Object, the Representation is known to be encrypted.
|
|
923
|
+
* If unset or set to `undefined` the Representation is either unencrypted or
|
|
924
|
+
* we don't know if it is.
|
|
925
|
+
*/
|
|
926
|
+
contentProtections?:
|
|
927
|
+
| {
|
|
928
|
+
/** Known key ids linked to that Representation. */
|
|
929
|
+
keyIds?: Uint8Array[] | undefined;
|
|
930
|
+
}
|
|
931
|
+
| undefined;
|
|
859
932
|
}
|
|
860
933
|
|
|
861
934
|
/** Video track returned by the RxPlayer. */
|
|
@@ -35,7 +35,11 @@ function areCodecsCompatible(a: string, b: string): boolean {
|
|
|
35
35
|
if (codecsA === "" || codecsB === "") {
|
|
36
36
|
return false;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
let initialPartA = codecsA.split(".")[0];
|
|
39
|
+
initialPartA = initialPartA === "hev1" ? "hvc1" : initialPartA;
|
|
40
|
+
let initialPartB = codecsB.split(".")[0];
|
|
41
|
+
initialPartB = initialPartB === "hev1" ? "hvc1" : initialPartB;
|
|
42
|
+
if (initialPartA !== initialPartB) {
|
|
39
43
|
return false;
|
|
40
44
|
}
|
|
41
45
|
return true;
|
package/vitest.config.mjs
CHANGED
|
@@ -91,6 +91,7 @@ export default defineConfig({
|
|
|
91
91
|
globals: false,
|
|
92
92
|
reporters: "dot",
|
|
93
93
|
include: ["tests/**/*.[jt]s?(x)"],
|
|
94
|
+
exclude: ["tests/performance/**/*.[jt]s?(x)"],
|
|
94
95
|
globalSetup: "tests/contents/server.mjs",
|
|
95
96
|
browser: getBrowserConfig(process.env.BROWSER_CONFIG),
|
|
96
97
|
},
|