mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-15 05:45:19 +00:00
fix: voice recording not stopping
This commit is contained in:
parent
426de76690
commit
cb81dfe4ba
1 changed files with 9 additions and 1 deletions
|
|
@ -44,6 +44,7 @@
|
||||||
return `${minutes}:${formattedSeconds}`;
|
return `${minutes}:${formattedSeconds}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let stream;
|
||||||
let speechRecognition;
|
let speechRecognition;
|
||||||
|
|
||||||
let mediaRecorder;
|
let mediaRecorder;
|
||||||
|
|
@ -159,7 +160,7 @@
|
||||||
const startRecording = async () => {
|
const startRecording = async () => {
|
||||||
startDurationCounter();
|
startDurationCounter();
|
||||||
|
|
||||||
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
||||||
mediaRecorder = new MediaRecorder(stream);
|
mediaRecorder = new MediaRecorder(stream);
|
||||||
mediaRecorder.onstart = () => {
|
mediaRecorder.onstart = () => {
|
||||||
console.log('Recording started');
|
console.log('Recording started');
|
||||||
|
|
@ -251,6 +252,13 @@
|
||||||
}
|
}
|
||||||
stopDurationCounter();
|
stopDurationCounter();
|
||||||
audioChunks = [];
|
audioChunks = [];
|
||||||
|
|
||||||
|
if (stream) {
|
||||||
|
const tracks = stream.getTracks();
|
||||||
|
tracks.forEach((track) => track.stop());
|
||||||
|
}
|
||||||
|
|
||||||
|
stream = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const confirmRecording = async () => {
|
const confirmRecording = async () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue