diff --git a/src/main.tsx b/src/main.tsx index 4b4f0809..b74c6cdc 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -39,12 +39,21 @@ initRageshake(); console.info(`matrix-video-chat ${import.meta.env.VITE_APP_VERSION || "dev"}`); +let fatalError: Error | null = null; + if (!window.isSecureContext) { - throw new Error( + fatalError = 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" ); +} else if (!navigator.mediaDevices) { + fatalError = new Error("Your browser does not support WebRTC."); +} + +if (fatalError !== null) { + ReactDOM.render(fatalError.message, document.getElementById("root")); + throw fatalError; // Stop the app early } if (import.meta.env.VITE_CUSTOM_THEME) {