in ChatbotUI/src/app/components/main/main.component.ts [179:192]
startStream() {
if (this.stream) return; // Stream already running
this.isRecording = true;
navigator.mediaDevices.getUserMedia({ audio: true })
.then(stream => {
this.stream = stream;
console.log('Microphone stream started:', this.stream);
// ... any other actions with stream ...
})
.catch(err => {
console.error('Error starting stream:', err);
this.hasPermission = false; // Ensure to update permission status
});
}