i want to detect, is there any audio or not while showing media stream in video tag in JavaScript. what i have done to show webcam stream to video tag is below, now i want to detect whether user speaks anything? how can i detect that? can anyone help me to solve this?
var constraints = { audio: { echoCancellation: true }, video: { width: 640, height: 480 } };
navigator.mediaDevices
.getUserMedia(constraints)
.then(function (mediaStream) {
videoInput = document.querySelector("video");
videoInput.srcObject = mediaStream;
videoInput.onloadedmetadata = function (e) {
videoInput.play();
};
})
.catch(function (err) {
console.log(err.name + ": " + err.message);
});