feat: move call sound to server

This commit is contained in:
2026-03-07 17:04:55 +01:00
parent 952373bbee
commit dd7e7e59e6
3 changed files with 18 additions and 2 deletions

View File

@@ -94,6 +94,12 @@ Bun.serve({
}
} else if (data.type == "rooms") {
ws.send(JSON.stringify({ type: "rooms", rooms: ROOMS }));
} else if (data.type == "call-audio") {
// Send the call.wav file as data URI
const file = await Bun.file("./call.wav").arrayBuffer();
const base64 = Buffer.from(file).toString("base64");
const dataUri = `data:audio/wav;base64,${base64}`;
ws.send(JSON.stringify({ type: "call-audio", dataUri }));
}
}, // a message is received
open(ws) {