Skip to content

Camera Stream

TJ Horner edited this page Sep 6, 2017 · 3 revisions

THIS FEATURE IS EXPERIMENTAL. Things may break if you use this. It's not production ready.

Starting with v1.0.0, you can receive the real time camera stream from the printer.

Example

printer.on("camera-frame", frame => {
  printer.endCameraStream()
  fs.writeFile("frame.jpg", frame)
})

printer.startCameraStream()

Requesting the stream

To start receiving camera data, you must request the printer to start streaming it. You can do this with startCameraStream().

Handling camera frames

Once a camera frame is received from the printer, the event camera-frame will be emitted with binary JPEG data.

Ending the stream

Once you don't need camera data anymore, it's a good idea to end the stream to save bandwidth and prevent any further breaking that may have been caused by using this feature. You can do this with endCameraStream().

Clone this wiki locally