// nextSong() {}const file = await Deno.open(this.currentSong, { read: true });const fileSize = (await file.stat()).size;const throttle = bandwidthThrottleGroup.createBandwidthThrottle(fileSize);const stream = readableStreamFromReader(file).pipeThrough(throttle);for await (const chunk of stream) { this.broadcast(chunk);}file.close();throttle.destroy();
// broadcast() {}private broadcast(chunk: Uint8Array) { for (const listener of this.listeners) { listener.write(chunk); }}
// oak-routerrouter.get("/stream", ({ request, response }) => { const stream = radio.addListener(); response.headers.set("Content-Type", "audio/mpeg"); response.body = stream;});