Reputation: 662
Below given code is for recording audio from browser and play at the same moment. My problem is this code is working on desktop browser but not working on mobile browser using Chrome browser in both platform with latest version. Can any one help me with this?
<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>
Upvotes: 1
Views: 51
Reputation: 662
navigator.mediaDevices.getUserMedia
will not work without SSL in mobile browser so I have installed SSL on my localhost and now it is working.
Upvotes: 1