2013-07-18 60 views
0

我正在玩getUserMedia以訪問Chrome中的用戶麥克風(版本28.0.1500.72米)。當他們使用帶內置揚聲器的內置麥克風時,我可以錄製和播放用戶輸入的內容。HTML5音頻錄製不工作外部麥克風

只要我插入USB麥克風耳機,我不再能夠記錄用戶輸入。我已在私密性和內容設置下在Chrome設置中切換設備。所以鉻不會看到新插入的麥克風。我重新啓動了Chrome並在插入麥克風後再次嘗試。仍然沒有用戶輸入。

在此先感謝。

下面是我正在使用的當前代碼。

window.AudioContext = window.AudioContext||window.webkitAudioContext; 
    var html5Recorder; 
    var audioContext = new AudioContext(); 
    navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia || navigator.oGetUserMedia; 
    if(navigator.getUserMedia){ 
     navigator.getUserMedia({audio:true},handleAudioStream, audioError) 
    }else{ 
     console.log('Use Flash') 
    } 

    function handleAudioStream(stream){ 
     var mediaStream = audioContext.createMediaStreamSource(stream); 
     mediaStream.connect(audioContext.destination); 
     html5Recorder = new HTML5Recorder(mediaStream); 
     html5Recorder.stop(); 
     html5Recorder.clear(); 
    } 

    function audioError(error){ 
     console.log(error); 
    } 

    function record(){ 
     html5Recorder.record(); 
    } 

    function stopRecording(){ 
     html5Recorder.stop(); 
     html5Recorder.exportWAV(function(e){ 
      console.log(e); 
      console.log(window.URL.createObjectURL(e)); 
      document.getElementById('audio1').src = window.URL.createObjectURL(e); 
      HTML5Recorder.forceDownload(e); 
     }); 
    } 

回答

1

這是我使用的當前chrome版本中的一個錯誤(28)。鉻金絲雀工作正常。

0

你能檢查兩個音頻設備的採樣率嗎?

如果採樣率與默認麥克風的採樣率相同,則存在非默認麥克風可用的現有缺陷:https://code.google.com/p/chromium/issues/detail?id=164058

另外,你在OSX或Linux?錯誤中的註釋使它看起來應該在Windows上修復。

0

嘗試選擇USB麥克風作爲默認的麥克風。 Chrome不會管理音頻設備,並且它始終使用默認麥克風。