Close Stream from Backend (#222)

* Close from backend

* Add code
This commit is contained in:
Freddy Boulton
2025-03-28 20:47:34 -04:00
committed by GitHub
parent 71743acb64
commit 8ed27fba78
10 changed files with 2336 additions and 2237 deletions

View File

@@ -51,12 +51,16 @@
}
});
let _on_change_cb = (msg: "change" | "tick" | "stopword") => {
let _on_change_cb = (msg: "change" | "tick" | "stopword" | any) => {
if (msg === "stopword") {
stopword_recognized = true;
setTimeout(() => {
stopword_recognized = false;
}, 3000);
} else if (msg.type === "end_stream") {
stream_state = "closed";
stop(pc);
on_change_cb(msg);
} else {
console.debug("calling on_change_cb with msg", msg);
on_change_cb(msg);