fix(input-format): recognise CMAF segments that start with sidx

Sibling case to #308: when a fragmented MP4 segment begins with a sidx
box (no ftyp/styp/moof at the file root), Mp4InputFormat._canReadInput
returned false, causing Input.getTracks() to throw
UnsupportedInputFormatError.

This shape is standard in CMAF when the DASH on-demand profile is used
or when HLS playlists are derived from one (Vimeo's vod-adaptive-ak CDN,
for example). The segment is still a valid ISOBMFF fragment — the sidx
just sits before the moof.

Adds 'sidx' alongside the existing 'moof' check so the format probe
accepts these segments, and a focused regression test that fails on
the previous behaviour.
This commit is contained in:
Theredbt
2026-05-11 04:22:46 +01:00
parent 89ee88bc7c
commit b48eb75565
2 changed files with 24 additions and 2 deletions
+2 -1
View File
@@ -120,7 +120,8 @@ export class Mp4InputFormat extends IsobmffInputFormat {
if (slice instanceof Promise) slice = await slice;
if (!slice) return false;
return readAscii(slice, 4) === 'moof'; // Seen in HLS for example
const fourCc = readAscii(slice, 4);
return fourCc === 'moof' || fourCc === 'sidx'; // Seen in HLS for example
}
get name() {