From b3467912e78ee33b32b3ffb9e070e894528aec55 Mon Sep 17 00:00:00 2001 From: MarconLP <13001502+MarconLP@users.noreply.github.com> Date: Wed, 3 May 2023 14:49:31 +0200 Subject: [PATCH] add alert when browser recording is not supported --- src/components/CTA.tsx | 6 ++++++ src/components/NewVideoMenu.tsx | 6 ++++++ src/pages/_app.tsx | 2 +- src/pages/index.tsx | 6 ++++++ src/pages/share/[videoId].tsx | 6 ++++++ src/pages/videos.tsx | 6 ++++++ 6 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/components/CTA.tsx b/src/components/CTA.tsx index c652381..42ebc23 100644 --- a/src/components/CTA.tsx +++ b/src/components/CTA.tsx @@ -7,6 +7,12 @@ export default function CTA() { const posthog = usePostHog(); const openRecordModal = () => { + if ( + !navigator?.mediaDevices?.getDisplayMedia && + !navigator?.mediaDevices?.getDisplayMedia + ) { + return alert("Your browser is currently NOT supported."); + } setRecordOpen(true); posthog?.capture("open record video modal", { diff --git a/src/components/NewVideoMenu.tsx b/src/components/NewVideoMenu.tsx index f574a3f..d98cc0e 100644 --- a/src/components/NewVideoMenu.tsx +++ b/src/components/NewVideoMenu.tsx @@ -15,6 +15,12 @@ export default function NewVideoMenu() { const posthog = usePostHog(); const openRecordModal = () => { + if ( + !navigator?.mediaDevices?.getDisplayMedia && + !navigator?.mediaDevices?.getDisplayMedia + ) { + return alert("Your browser is currently NOT supported."); + } setRecordOpen(true); posthog?.capture("open record video modal", { diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index c59dbf5..08313b7 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -17,7 +17,7 @@ if (typeof window !== "undefined") { api_host: env.NEXT_PUBLIC_POSTHOG_PROXY_HOST, // Enable debug mode in development loaded: (posthog) => { - if (process.env.NODE_ENV === "development") posthog.debug(); + if (process.env.NODE_ENV === "development") posthog.debug(false); }, }); } diff --git a/src/pages/index.tsx b/src/pages/index.tsx index a16f587..875c422 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -18,6 +18,12 @@ const Home: NextPage = () => { const posthog = usePostHog(); const openRecordModal = () => { + if ( + !navigator?.mediaDevices?.getDisplayMedia && + !navigator?.mediaDevices?.getDisplayMedia + ) { + return alert("Your browser is currently NOT supported."); + } setRecordOpen(true); posthog?.capture("open record video modal", { diff --git a/src/pages/share/[videoId].tsx b/src/pages/share/[videoId].tsx index 9bdd5ac..3ea2b4a 100644 --- a/src/pages/share/[videoId].tsx +++ b/src/pages/share/[videoId].tsx @@ -43,6 +43,12 @@ const VideoList: NextPage = () => { ); const openRecordModal = () => { + if ( + !navigator?.mediaDevices?.getDisplayMedia && + !navigator?.mediaDevices?.getDisplayMedia + ) { + return alert("Your browser is currently NOT supported."); + } setRecordOpen(true); posthog?.capture("open record video modal", { diff --git a/src/pages/videos.tsx b/src/pages/videos.tsx index 95d6376..42a5ec4 100644 --- a/src/pages/videos.tsx +++ b/src/pages/videos.tsx @@ -31,6 +31,12 @@ const VideoList: NextPage = () => { } const openRecordModal = () => { + if ( + !navigator?.mediaDevices?.getDisplayMedia && + !navigator?.mediaDevices?.getDisplayMedia + ) { + return alert("Your browser is currently NOT supported."); + } setRecordOpen(true); posthog?.capture("open record video modal", {