in lib/main.js [149:167]
$("#start-conversation-button").click(function () {
$("#error").hide(); // hide any existing errors
toggleStartStopConversation(); // disable start and enable stop button
setLanguage(); // set the language and region from the dropdowns
window.navigator.mediaDevices
.getUserMedia({
// first we get the microphone input from the browser (as a promise)
video: false,
audio: true,
})
.then(streamAudioToWebSocket) // we convert the mic stream to binary event stream messages when the promise resolves
.catch(function (error) {
showError(
"There was an error streaming your audio to Amazon Transcribe. Please try again."
);
console.log(error);
toggleStartStopConversation();
});
});