awslabs / aws-lex-browser-audio-capture

An example web application using the Lex JavaScript SDK to send and receive audio from the Lex PostContent API. Demonstrates how to capture an audio device, record audio, and convert the audio into a format that Lex will recognize, and play the response. All from a web browser.
MIT No Attribution
165 stars 74 forks source link

Records only 0s on Chrome (v42 or later) when hosted on http://localhost #2

Closed ryano144 closed 7 years ago

ryano144 commented 7 years ago

In using this on Google Chrome, the audioSupported check passes, but the audio buffer returned by getChannelData(0) only contains 0s. I think this may be due to the addition of CORS checks for MediaElementAudioSource in chrome: https://bugs.chromium.org/p/chromium/issues/detail?id=477364.

palafranchise commented 7 years ago

Thanks for reporting the issue! I just tried it out with my laptop running locally (http://localhost:8000/example/) on Mac/Chrome (Version 61.0.3163.100 (Official Build) (64-bit)) and I'm not seeing the issue. Can you provide more information about the version of Chrome you are using and your OS? I assume you have allowed access to the microphone for localhost or you would not be getting this far but can you confirm that too?

ryano144 commented 7 years ago

I was running in Chrome 60.0.3112.113. I did allow access to the microphone for localhost. I've since attempted to host the platform on the web under https and got the same results (all 0s returned by audioProcessingEvent.inputBuffer.getChannelData).

palafranchise commented 7 years ago

Hmm, okay. Which operating system are you using? I'll try to reproduce.

One other thing to try, and I know this sounds silly, can you shut down and restart Chrome (or confirm that you have already done that)?

ryano144 commented 7 years ago

Sorry to have wasted your time. It looks like I inserted an extra call to worker.clear which was breaking the recording function.

palafranchise commented 7 years ago

No worries, happy to help out. Thanks for following up!