浏览代码

Merge branch 'muzi' of http://59.110.91.129:3000/zhangmengying/AIClass into wanzi

丸子 1 月之前
父节点
当前提交
b9e6272020
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/components/ai/voice/VoiceInput2.vue

+ 2 - 1
src/components/ai/voice/VoiceInput2.vue

@@ -358,7 +358,8 @@ const toggleSpeechInput = async () => {
       mediaStream.value = stream
 
       // 使用Web Audio API捕获音频并转换为PCM格式
-      audioContext.value = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: 16000 })
+      // 不指定采样率,使用默认值,确保与媒体流兼容
+      audioContext.value = new (window.AudioContext || window.webkitAudioContext)()
       mediaStreamSource.value = audioContext.value.createMediaStreamSource(stream)
       
       // 尝试使用AudioWorkletNode(现代浏览器推荐),如果不支持则回退到ScriptProcessorNode