dangdang 1 mês atrás
pai
commit
6095ca0be5
1 arquivos alterados com 20 adições e 20 exclusões
  1. 20 20
      src/views/ChatTts.vue

+ 20 - 20
src/views/ChatTts.vue

@@ -526,32 +526,32 @@ const handleTaskStatus = async () => {
   }
 }
 
-async function requestMicrophonePermission() {
-  try {
-    const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
-    hasPermission.value = true;
-    // console.log("🎤 录音权限已授予");
-    return stream;
-  } catch (error) {
-    // console.warn("⛔ 录音权限被拒绝", error);
-    retryPermissionRequest();
-  }
-}
+// async function requestMicrophonePermission() {
+//   try {
+//     const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
+//     hasPermission.value = true;
+//     // console.log("🎤 录音权限已授予");
+//     return stream;
+//   } catch (error) {
+//     // console.warn("⛔ 录音权限被拒绝", error);
+//     retryPermissionRequest();
+//   }
+// }
 
-async function retryPermissionRequest() {
-  const permissionStatus = await navigator.permissions.query({ name: "microphone" });
+// async function retryPermissionRequest() {
+//   const permissionStatus = await navigator.permissions.query({ name: "microphone" });
 
-  if (permissionStatus.state === "denied") {
-    Toast("您已拒绝录音权限,请前往浏览器或系统设置手动开启权限。");
-  } else {
-    requestMicrophonePermission();
-  }
-}
+//   if (permissionStatus.state === "denied") {
+//     Toast("您已拒绝录音权限,请前往浏览器或系统设置手动开启权限。");
+//   } else {
+//     requestMicrophonePermission();
+//   }
+// }
 
 // 在组件挂载时调用
 onMounted(() => {
   loadChatHistory();
-  requestMicrophonePermission();
+  // requestMicrophonePermission();
   setTimeout(() => {
     loading.value = false;
   }, 2000);