Skip to content

Commit

Permalink
Merge pull request remotion-dev#1658 from remotion-dev/1655-dont-use-…
Browse files Browse the repository at this point in the history
…media-fragment-uris-with-local-urls-because-they-fail-in-safari
  • Loading branch information
JonnyBurger authored Jan 9, 2023
2 parents d3e2873 + 0954f6a commit 747e08c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/core/src/video/video-fragment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ export const useAppendVideoFragment = ({
return appended;
};

// https://github.com/remotion-dev/remotion/issues/1655
const isIOSSafariCase = (actualSrc: string) => {
return (
/iP(ad|od|hone)/i.test(window.navigator.userAgent) &&
Boolean(navigator.userAgent.match(/Version\/[\d.]+.*Safari/)) &&
actualSrc.startsWith('blob:')
);
};

export const appendVideoFragment = ({
actualSrc,
actualFrom,
Expand All @@ -58,6 +67,10 @@ export const appendVideoFragment = ({
duration: number;
fps: number;
}): string => {
if (isIOSSafariCase(actualSrc)) {
return actualSrc;
}

if (actualSrc.startsWith('data:')) {
return actualSrc;
}
Expand Down

0 comments on commit 747e08c

Please sign in to comment.