(data: Uint8Array)
| 100 | } |
| 101 | |
| 102 | export function parseInitSegment(data: Uint8Array): Fmp4Index { |
| 103 | const boxes = findBoxes(data); |
| 104 | const sidxBox = boxes.find((box) => box.type === 'sidx'); |
| 105 | |
| 106 | if (!sidxBox) { |
| 107 | throw new Error('No sidx box found in init segment'); |
| 108 | } |
| 109 | |
| 110 | const { references, timescale } = parseSidx( |
| 111 | data, |
| 112 | sidxBox.offset, |
| 113 | sidxBox.size, |
| 114 | ); |
| 115 | |
| 116 | return { |
| 117 | initSegmentEnd: sidxBox.offset, |
| 118 | segments: references, |
| 119 | timescale, |
| 120 | }; |
| 121 | } |
no test coverage detected