import * as React from "react"; import {useContext, useState} from "react"; import {Registry} from "tc-shared/events"; import {EchoTestEvents, TestState, VoiceConnectionState} from "./Definitions"; import {Translatable, VariadicTranslatable} from "tc-shared/ui/react-elements/i18n"; import {ClientIcon} from "svg-sprites/client-icons"; import {ClientIconRenderer} from "tc-shared/ui/react-elements/Icons"; import {Checkbox} from "tc-shared/ui/react-elements/Checkbox"; import {Button} from "tc-shared/ui/react-elements/Button"; import {LoadingDots} from "tc-shared/ui/react-elements/LoadingDots"; const cssStyle = require("./Renderer.scss"); export const EchoTestEventRegistry = React.createContext>(undefined); const VoiceStateOverlay = () => { const events = useContext(EchoTestEventRegistry); const [state, setState] = useState<"loading" | VoiceConnectionState>(() => { events.fire("query_voice_connection_state"); return "loading"; }); events.reactUse("notify_voice_connection_state", event => setState(event.state)); let inner, shown = true; switch (state) { case "disconnected": inner = Voice connection has been disconnected.; break; case "unsupported-server": inner = Voice connection isn't supported by the server.; break; case "unsupported-client": inner = Voice connection isn't supported by your browser.
Please use another browser.
; break; case "connecting": inner = establishing voice connection ; break; case "loading": inner = loading ; break; case "connected": shown = false; break; default: shown = false; } return (
{inner}
); } const TestStateOverlay = () => { const events = useContext(EchoTestEventRegistry); const [state, setState] = useState<{ state: "loading" } | TestState>(() => { events.fire("query_test_state"); return {state: "loading"}; }); const [voiceConnected, setVoiceConnected] = useState<"loading" | boolean>(() => { return "loading"; }); events.reactUse("notify_voice_connection_state", event => setVoiceConnected(event.state === "connected")); events.reactUse("notify_test_state", event => setState(event.state)); let inner; switch (state.state) { case "loading": case "initializing": inner = initializing ; break; case "start-failed": inner = {state.error}
; break; case "unsupported": inner = Echo testing hasn't been supported by the server.; break; } return (
{inner}
); } const TroubleshootingSoundOverlay = () => { const events = useContext(EchoTestEventRegistry); const [visible, setVisible] = useState(false); events.reactUse("notify_test_phase", event => setVisible(event.phase === "troubleshooting")); return (

Troubleshooting guide

  1. Correct microphone selected?

    Check within the settings, if the right microphone has been selected. The indicators will show you any voice activity.

  2. Are any addons blocking the microphone access?

    Some addons might block the access to your microphone. Try to disable all addons and reload the site.

  3. Has WebRTC been enabled?

    here

  4. Reload the site

    In some cases, reloading the site will already solve the issue for you.

  5. Nothing worked? Submit an issue

    forum here

) } export const TestToggle = () => { const events = useContext(EchoTestEventRegistry); const [state, setState] = useState<"loading" | boolean>(() => { events.fire("query_test_state"); return "loading"; }); events.reactUse("notify_tests_toggle", event => setState(event.enabled)); return ( events.fire("action_toggle_tests", {enabled: state === false})} label={Show this on the next connect} /> ) } export const EchoTestModal = () => { const events = useContext(EchoTestEventRegistry); return (

Welcome to the private echo test. Can you hear yourself speaking?

events.fire("action_test_result", {status: "success"})}>
Yes
events.fire("action_test_result", {status: "fail"})}>
No
); };