Merge pull request #672 from robintown/fatal-error
Show an error when the browser does not support WebRTC
This commit is contained in:
commit
0d22ef2104
1 changed files with 10 additions and 1 deletions
11
src/main.tsx
11
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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue