fix(voice): add clear error message for HTTP mediaDevices restriction

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
congsh
2026-04-19 22:42:29 +08:00
parent c01aef48bd
commit 6b9fef1d69
+5
View File
@@ -32,6 +32,11 @@ export function useVoiceRoom() {
async function connect(sessionId: string) {
try {
error.value = null
if (!navigator.mediaDevices?.getUserMedia) {
throw new Error('浏览器不允许在 HTTP 下使用麦克风。请在 Chrome 地址栏输入 chrome://flags/#unsafely-treat-insecure-origin-as-secure,启用后将 http://192.168.1.14:7033 加入白名单,然后重启浏览器。')
}
const token = await fetchVoiceToken(sessionId)
const livekitUrl = getLiveKitUrl()