Skip to content

Commit

Permalink
fix: Fix drm.keySystemsMapping config (shaka-project#4425)
Browse files Browse the repository at this point in the history
This fixes the config by adding a missing override in the config parser.  This also adds test coverage for the feature.

Closes shaka-project#4422
  • Loading branch information
joeyparrish committed Aug 18, 2022
1 parent 8376410 commit d945084
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/util/player_configuration.js
Expand Up @@ -314,6 +314,7 @@ shaka.util.PlayerConfiguration = class {
*/
static mergeConfigObjects(destination, updates, template) {
const overrides = {
'.drm.keySystemsMapping': '',
'.drm.servers': '',
'.drm.clearKeys': '',
'.drm.advanced': {
Expand Down
29 changes: 29 additions & 0 deletions test/media/drm_engine_unit.js
Expand Up @@ -677,6 +677,35 @@ describe('DrmEngine', () => {
.toBeRejectedWith(expected);
});

it('uses key system IDs from keySystemsMapping config', async () => {
manifest = shaka.test.ManifestGenerator.generate((manifest) => {
manifest.addVariant(0, (variant) => {
variant.addVideo(1, (stream) => {
stream.encrypted = true;
stream.addDrmInfo('drm.abc');
});
});
});

setDecodingInfoSpy([]);

config.keySystemsMapping['drm.abc'] = 'drm.def';
drmEngine.configure(config);

const variants = manifest.variants;
await expectAsync(
drmEngine.initForPlayback(variants, manifest.offlineSessionIds))
.toBeRejected();

expect(drmEngine.initialized()).toBe(false);
expect(decodingInfoSpy).toHaveBeenCalledTimes(1);
expect(decodingInfoSpy).toHaveBeenCalledWith(containing({
keySystemConfiguration: containing({
keySystem: 'drm.def',
}),
}));
});

it('maps TS MIME types through the transmuxer', async () => {
const originalIsSupported = shaka.media.Transmuxer.isSupported;

Expand Down

0 comments on commit d945084

Please sign in to comment.