make audio optional

This commit is contained in:
DavidVentura
2024-01-31 12:11:32 +01:00
parent 7bdcc54bc1
commit d70bef918f
+3
View File
@@ -4,6 +4,7 @@ import http from "node:http";
import { Handlers, makeSession } from "./server.js";
const s = makeSession(Handlers, { debug: false, ansi: false });
const withAudio = false;
let BOUNDARY = "a very good boundary line";
let responses = [];
@@ -17,10 +18,12 @@ s.eventEmitter.on("frame", (frame: Buffer) => {
});
});
if (withAudio) {
const audioFd = createWriteStream(`audio.pcm`);
s.eventEmitter.on("audio", (frame: Buffer) => {
audioFd.write(frame);
});
}
const server = http.createServer((req, res) => {
if (s.ticket.every((x) => x == 0)) {