max-mapper / websocket-stream

websockets with the node stream API
BSD 2-Clause "Simplified" License
667 stars 114 forks source link

can this library catch up a stream created by captureStream from a canvas element? #126

Open Fuzzyma opened 7 years ago

Fuzzyma commented 7 years ago

Actually the title already says all: Is it possible to use the stream created by canvas.captureStream(fps) and relay it to a server with this library?

mcollina commented 7 years ago

I do not know, maybe @feross knows.

feross commented 7 years ago

You would need some intermediate glue code, since the stream that comes from captureStream is a media stream, a type of opaque browser object that can only be used with other APIs that support them.

You can use the browser MediaRecorder API to get the raw bytes from the stream, then turn them into a node.js stream and then pipe them to whatever node.js stream you want, including websocket-stream.