Skip to content

Commit f3e45b4

Browse files
fix(studio-server): proxy MPEG-4 Part 2 and MJPEG video the browser cannot decode (heygen-com#7310)
* fix(studio-server): proxy MPEG-4 Part 2 and MJPEG video the browser cannot decode * fix(studio-server): drop the codec comment the comment gate counts
1 parent 9e2510b commit f3e45b4

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎packages/studio-server/src/helpers/mediaCodecMap.test.ts‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,17 +231,20 @@ describe("BROWSER_HOSTILE_CODECS representative mimes", () => {
231231
expect(typeof BROWSER_HOSTILE_CODECS[codecName]?.representativeMime).toBe("string");
232232
});
233233

234-
it("has no representative mime for prores, which is never decodable", () => {
235-
expect(BROWSER_HOSTILE_CODECS.prores?.representativeMime).toBeNull();
236-
});
234+
it.each(["prores", "mpeg4", "mjpeg"])(
235+
"has no representative mime for %s, which is never decodable",
236+
(codecName) => {
237+
expect(BROWSER_HOSTILE_CODECS[codecName]?.representativeMime).toBeNull();
238+
},
239+
);
237240
});
238241

239242
describe("shouldPrewarmProxy", () => {
240243
function facts(codecName: string): AssetCodecFacts {
241244
return { codecName, browserHostile: true, representativeMime: null, hasAlpha: false };
242245
}
243246

244-
it.each(["hevc", "prores", "theora"])(
247+
it.each(["hevc", "prores", "theora", "mpeg4", "mjpeg"])(
245248
"pre-warms %s, which has no cross-platform browser decode",
246249
(codecName) => {
247250
expect(shouldPrewarmProxy(facts(codecName))).toBe(true);

‎packages/studio-server/src/helpers/mediaCodecMap.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ export const BROWSER_HOSTILE_CODECS: Record<string, BrowserHostileCodec> = {
6868
hevc: { representativeMime: 'video/mp4; codecs="hvc1.1.6.L120.B0"', prewarm: true },
6969
prores: { representativeMime: null, prewarm: true },
7070
theora: { representativeMime: 'video/ogg; codecs="theora"', prewarm: true },
71+
mpeg4: { representativeMime: null, prewarm: true },
72+
mjpeg: { representativeMime: null, prewarm: true },
7173
// Every mainstream engine decodes AV1 and VP9, so canPlayType keeps the
7274
// original and only the rare browser that cannot pays for a transcode.
7375
av1: { representativeMime: 'video/mp4; codecs="av01.0.08M.08"', prewarm: false },

0 commit comments

Comments
 (0)