Skip to content

Commit 6004508

Browse files
fix(studio-server): MPEG-2 and DNxHD videos get a playable preview copy (#7348)
1 parent 65c62f3 commit 6004508

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

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

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

234-
it.each(["prores", "mpeg4", "mjpeg"])(
234+
it.each(["prores", "mpeg4", "mjpeg", "mpeg2video", "dnxhd"])(
235235
"has no representative mime for %s, which is never decodable",
236236
(codecName) => {
237237
expect(BROWSER_HOSTILE_CODECS[codecName]?.representativeMime).toBeNull();
@@ -244,7 +244,7 @@ describe("shouldPrewarmProxy", () => {
244244
return { codecName, browserHostile: true, representativeMime: null, hasAlpha: false };
245245
}
246246

247-
it.each(["hevc", "prores", "theora", "mpeg4", "mjpeg"])(
247+
it.each(["hevc", "prores", "theora", "mpeg4", "mjpeg", "mpeg2video", "dnxhd"])(
248248
"pre-warms %s, which has no cross-platform browser decode",
249249
(codecName) => {
250250
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
@@ -70,6 +70,8 @@ export const BROWSER_HOSTILE_CODECS: Record<string, BrowserHostileCodec> = {
7070
theora: { representativeMime: 'video/ogg; codecs="theora"', prewarm: true },
7171
mpeg4: { representativeMime: null, prewarm: true },
7272
mjpeg: { representativeMime: null, prewarm: true },
73+
mpeg2video: { representativeMime: null, prewarm: true },
74+
dnxhd: { representativeMime: null, prewarm: true },
7375
// Every mainstream engine decodes AV1 and VP9, so canPlayType keeps the
7476
// original and only the rare browser that cannot pays for a transcode.
7577
av1: { representativeMime: 'video/mp4; codecs="av01.0.08M.08"', prewarm: false },

0 commit comments

Comments
 (0)