Skip to content

Commit

Permalink
Merge branch 'video-generator-updates' into testing
Browse files Browse the repository at this point in the history
  • Loading branch information
osamasayed committed Sep 11, 2024
2 parents 0626c25 + d6658dc commit 0b6f87a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
5 changes: 2 additions & 3 deletions src/pages/media/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { getMushafId } from '@/utils/api';
import { makeChapterAudioDataUrl, makeVersesUrl } from '@/utils/apiPaths';
import { areArraysEqual } from '@/utils/array';
import { getAllChaptersData, getChapterData } from '@/utils/chapter';
import { isAppleWebKit, isSafari } from '@/utils/device-detector';
import { isChromeIOS, isSafari } from '@/utils/device-detector';
import { getLanguageAlternates, toLocalizedNumber } from '@/utils/locale';
import {
DEFAULT_API_PARAMS,
Expand Down Expand Up @@ -285,8 +285,7 @@ const MediaMaker: NextPage<MediaMaker> = ({
chapterEnglishName,
]);

const method = isAppleWebKit() ? 'base64' : 'blob-url';

const method = isChromeIOS() ? 'base64' : 'blob-url';
useEffect(() => {
setVideoFileReady(false);
// {@see https://www.remotion.dev/docs/troubleshooting/player-flicker#option-6-prefetching-as-base64-to-avoid-network-request-and-local-http-server}
Expand Down
20 changes: 8 additions & 12 deletions src/utils/device-detector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,11 @@ export const isAppleDevice = () => {
return isOSX || isMacOs();
};

export const isAppleWebKit = () => {
if (!isClient) {
return false;
}

const { userAgent } = navigator;
return /AppleWebKit/.test(userAgent) && /Mobile/.test(userAgent);
};

export const isFirefox = () => {
if (!isClient) {
return false;
}

const { userAgent } = navigator;
return userAgent.toLowerCase().includes('firefox');
return navigator.userAgent.toLowerCase().includes('firefox');
};

export const isSafari = () => {
Expand All @@ -43,3 +32,10 @@ export const isSafari = () => {
const chrome = userAgent.toLowerCase().includes('chrome');
return safari && !chrome;
};

export const isChromeIOS = () => {
if (!isClient) {
return false;
}
return navigator.userAgent.match('CriOS');
};

0 comments on commit 0b6f87a

Please sign in to comment.