Skip to content

Commit

Permalink
test: Fix codec-switching test config (#6459)
Browse files Browse the repository at this point in the history
The tests were not testing what they were supposed to because their
configs were invalid and being ignored.

Related to #6458
  • Loading branch information
joeyparrish committed May 7, 2024
1 parent 2fa5f37 commit d89ccee
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions test/codec_switching/codec_switching_integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ describe('Codec Switching', () => {
if (!MediaSource.isTypeSupported('audio/webm; codecs="opus"')) {
pending('Codec OPUS in WEBM is not supported by the platform.');
}

// English is AAC MP4.
const preferredAudioLanguage = 'en';
player.configure({preferredAudioLanguage: preferredAudioLanguage});
player.configure('manifest.disableVideo', true);
player.configure('streaming.mediaSource.codecSwitchingStrategy',
player.configure('mediaSource.codecSwitchingStrategy',
shaka.config.CodecSwitchingStrategy.RELOAD);

await player.load('/base/test/test/assets/dash-multi-codec/dash.mpd', 9);
Expand All @@ -68,6 +70,7 @@ describe('Codec Switching', () => {
expect(variants.length).toBe(2);
expect(variants.find((v) => !!v.active).language).toBe('en');

// Spanish is Opus WebM.
player.selectAudioLanguage('es');
await waiter.waitUntilPlayheadReachesOrFailOnTimeout(video, 10, 45);

Expand All @@ -86,10 +89,12 @@ describe('Codec Switching', () => {
if (!MediaSource.isTypeSupported('audio/webm; codecs="opus"')) {
pending('Codec OPUS in WEBM is not supported by the platform.');
}

// English is AAC MP4.
const preferredAudioLanguage = 'en';
player.configure({preferredAudioLanguage: preferredAudioLanguage});
player.configure('manifest.disableVideo', true);
player.configure('streaming.mediaSource.codecSwitchingStrategy',
player.configure('mediaSource.codecSwitchingStrategy',
shaka.config.CodecSwitchingStrategy.SMOOTH);

await player.load('/base/test/test/assets/dash-multi-codec/dash.mpd', 9);
Expand All @@ -103,6 +108,7 @@ describe('Codec Switching', () => {
expect(variants.length).toBe(2);
expect(variants.find((v) => !!v.active).language).toBe('en');

// Spanish is Opus WebM.
player.selectAudioLanguage('es');
await waiter.waitUntilPlayheadReachesOrFailOnTimeout(video, 10, 45);

Expand All @@ -119,9 +125,11 @@ describe('Codec Switching', () => {
if (!MediaSource.isTypeSupported('audio/webm; codecs="opus"')) {
pending('Codec OPUS in WEBM is not supported by the platform.');
}

// English is AAC MP4.
const preferredAudioLanguage = 'en';
player.configure({preferredAudioLanguage: preferredAudioLanguage});
player.configure('streaming.mediaSource.codecSwitchingStrategy',
player.configure('mediaSource.codecSwitchingStrategy',
shaka.config.CodecSwitchingStrategy.RELOAD);

await player.load('/base/test/test/assets/dash-multi-codec/dash.mpd', 9);
Expand All @@ -135,6 +143,7 @@ describe('Codec Switching', () => {
expect(variants.length).toBe(2);
expect(variants.find((v) => !!v.active).language).toBe('en');

// Spanish is Opus WebM.
player.selectAudioLanguage('es');
await waiter.waitUntilPlayheadReachesOrFailOnTimeout(video, 10, 45);

Expand All @@ -153,9 +162,11 @@ describe('Codec Switching', () => {
if (!MediaSource.isTypeSupported('audio/webm; codecs="opus"')) {
pending('Codec OPUS in WEBM is not supported by the platform.');
}

// English is AAC MP4.
const preferredAudioLanguage = 'en';
player.configure({preferredAudioLanguage: preferredAudioLanguage});
player.configure('streaming.mediaSource.codecSwitchingStrategy',
player.configure('mediaSource.codecSwitchingStrategy',
shaka.config.CodecSwitchingStrategy.SMOOTH);

await player.load('/base/test/test/assets/dash-multi-codec/dash.mpd', 9);
Expand All @@ -169,6 +180,7 @@ describe('Codec Switching', () => {
expect(variants.length).toBe(2);
expect(variants.find((v) => !!v.active).language).toBe('en');

// Spanish is Opus WebM.
player.selectAudioLanguage('es');
await waiter.waitUntilPlayheadReachesOrFailOnTimeout(video, 10, 45);

Expand Down

0 comments on commit d89ccee

Please sign in to comment.