Skip to content

Commit

Permalink
@remotion/media-parser: Recognize 206 response as indicator that se…
Browse files Browse the repository at this point in the history
…rver supports byte ranges
  • Loading branch information
JonnyBurger committed Sep 18, 2024
1 parent 718fc3b commit 2d4306e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/media-parser/src/readers/from-fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ export function parseContentRange(input: string): ParsedContentRange | null {
const validateContentRangeAndDetectIfSupported = (
actualRange: number | [number, number],
parsedContentRange: ParsedContentRange | null,
statusCode: number,
): {supportsContentRange: boolean} => {
if (statusCode === 206) {
return {supportsContentRange: true};
}

if (
typeof actualRange === 'number' &&
parsedContentRange?.start !== actualRange
Expand Down Expand Up @@ -118,6 +123,7 @@ export const fetchReader: ReaderInterface = {
const {supportsContentRange} = validateContentRangeAndDetectIfSupported(
actualRange,
parsedContentRange,
res.status,
);

signal?.addEventListener(
Expand Down

0 comments on commit 2d4306e

Please sign in to comment.