I've used the following code to capture the microphone input and play it in a browser page (Google Chrome Windows10) using an audio player. That works fine, but the 'automatic' Live Captioning does not. If I drag a pre-recorded mp3 file onto a browser page and play it, the Live Captioning works fine. Where am I going wrong?
<body>
<audio id="player" controls></audio>
<script>
const player = document.getElementById('player');
const handleSuccess = function (stream) {
if (window.URL) {
player.srcObject = stream;
} else {
player.src = stream;
}
};
navigator.mediaDevices
.getUserMedia({audio: true, video: false})
.then(handleSuccess);
</script>
<script>
getAudioOutput()
</script>
</body>