Show an error when the browser does not support WebRTC

This commit is contained in:
Robin Townsend 2022-10-27 08:41:24 -04:00
parent 31decc6577
commit 1a329966ba

View file

@ -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) {