SamuelScheit / puppeteer-stream

A Library for puppeteer to retrieve audio and/or video streams
MIT License
335 stars 105 forks source link

[Question] Piping audio stream to express #20

Closed cirroskais closed 2 years ago

cirroskais commented 2 years ago

snip

SamuelScheit commented 2 years ago

Chromes media recorder sadly only supports webm. So you either would have to pass it to ffmpeg to convert it or pipe the webm audio stream as a response.

SamuelScheit commented 2 years ago

Try this:

let stream = await puppeteer.getStream(page, { audio: true, video: false, mimeType: "audio/webm" })

app.get("/stream.webm", async (request, response) => {
    response.writeHead(200, { "Content-Type": "audio/webm" })
    stream.pipe(response)
})
SamuelScheit commented 2 years ago

Great 👍 The module is now updated:

npm install puppeteer-stream@2.0.7