How to access webcam

Hi there,

I am looking to play with processing webcam data using Node. How would I go about accessing data from my computer’s webcam and process it in runkit? It seems I would need an HTML front end to capture the webcam feed and somehow send that into the runkit environment? Any direction here would be much appreciated.

Thank you

Hi @intensetree,

You are correct in that you fundamentally need two components for this: a server component that actually runs the node code, and a client component that accesses the webcam.

You can certainly write the server component in RunKit using Endpoints (https://runkit.com/docs/endpoint), and you can implement the client component using any technology you’d like, including either a RunKit notebook that displays HTML in an output, or even the same endpoint that has an HTML route.

Here is a small proof of concept (it does not use the webcam or websockets as I am optimizing for showing you how to handle the server/client split in RunKit, vs. filling it up with a bunch of webcam implementation details):

Code: https://runkit.com/tolmasky/client-and-server-example
Try It: https://runkit.io/tolmasky/client-and-server-example/1.0.0