diff --git a/src/main.tsx b/src/main.tsx index 2a64364..50aa6cd 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -36,6 +36,14 @@ initRageshake(); console.info(`matrix-video-chat ${import.meta.env.VITE_APP_VERSION || "dev"}`); +if (!window.isSecureContext) { + throw new Error( + "This app cannot run in an insecure context. To fix this, access the app " + + "via a local loopback address, or serve it over HTTPS.\n" + + "https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts" + ); +} + if (import.meta.env.VITE_CUSTOM_THEME) { const style = document.documentElement.style; style.setProperty("--accent", import.meta.env.VITE_THEME_ACCENT as string); diff --git a/src/room/InCallView.jsx b/src/room/InCallView.jsx index 4a4c1cb..43a71a8 100644 --- a/src/room/InCallView.jsx +++ b/src/room/InCallView.jsx @@ -44,7 +44,7 @@ import { useShowInspector } from "../settings/useSetting"; import { useModalTriggerState } from "../Modal"; import { useAudioContext } from "../video-grid/useMediaStream"; -const canScreenshare = "getDisplayMedia" in navigator.mediaDevices; +const canScreenshare = "getDisplayMedia" in (navigator.mediaDevices ?? {}); // There is currently a bug in Safari our our code with cloning and sending MediaStreams // or with getUsermedia and getDisplaymedia being used within the same session. // For now we can disable screensharing in Safari.