Skip to content

🎥 Make videos programmatically with React

fix(web-renderer): update Firefox AAC tests to reflect polyfill encoder

pullfrog[bot]e7e121734f25
diff --git a/packages/web-renderer/src/test/audio.test.tsx b/packages/web-renderer/src/test/audio.test.tsx
index 0d7f17c19c..5f4d256f06 100644
--- a/packages/web-renderer/src/test/audio.test.tsx
+++ b/packages/web-renderer/src/test/audio.test.tsx
@@ -1,7 +1,7 @@
import {Audio, Video} from '@remotion/media';
import {ALL_FORMATS, BlobSource, Input, type InputAudioTrack} from 'mediabunny';
import {staticFile} from 'remotion';
-import {expect, test, vi} from 'vitest';
+import {expect, test} from 'vitest';
import {renderMediaOnWeb} from '../render-media-on-web';
import '../symbol-dispose';
@@ -118,14 +118,12 @@ test('default audio codec is AAC on Chrome/WebKit for MP4', async (t) => {
expect(audioCodec).toBe('aac');
});
-test('should fallback from AAC to Opus on Firefox', async (t) => {
+test('should encode AAC on Firefox via polyfill', async (t) => {
if (t.task.file.projectName !== 'firefox') {
t.skip();
return;
}
- const warnSpy = vi.spyOn(console, 'warn');
-
const Component: React.FC = () => {
return <Audio src={staticFile('dialogue.wav')} />;
};
@@ -147,17 +145,12 @@ test('should fallback from AAC to Opus on Firefox', async (t) => {
outputTarget: 'arraybuffer',
});
- expect(warnSpy).toHaveBeenCalledWith(
- expect.stringContaining('Falling back from audio codec "aac" to "opus"'),
- );
- warnSpy.mockRestore();
-
const blob = await result.getBlob();
const audioCodec = await getAudioCodecFromBlob(blob);
- expect(audioCodec).toBe('opus');
+ expect(audioCodec).toBe('aac');
});
-test('should error when explicitly selecting AAC on Firefox', async (t) => {
+test('should encode AAC when explicitly selected on Firefox', async (t) => {
if (t.task.file.projectName !== 'firefox') {
t.skip();
return;
@@ -167,7 +160,7 @@ test('should error when explicitly selecting AAC on Firefox', async (t) => {
return <Audio src={staticFile('dialogue.wav')} />;
};
- const prom = renderMediaOnWeb({
+ const result = await renderMediaOnWeb({
licenseKey: 'free-license',
composition: {
component: Component,
@@ -184,7 +177,9 @@ test('should error when explicitly selecting AAC on Firefox', async (t) => {
outputTarget: 'arraybuffer',
});
- await expect(prom).rejects.toThrow('cannot be encoded by this browser');
+ const blob = await result.getBlob();
+ const audioCodec = await getAudioCodecFromBlob(blob);
+ expect(audioCodec).toBe('aac');
});
test('default audio codec is Opus for WebM', async () => {
@@ -242,7 +237,7 @@ test('explicit Opus selection produces Opus in MP4 output', async () => {
test('should render AAC container with web-fs (audio-only)', async (t) => {
if (t.task.file.projectName === 'firefox') {
- // Firefox cannot encode AAC
+ // Firefox OPFS support is unreliable in test environments
t.skip();
return;
}