CNC.js and web cam

Hey all,
Tried searching a bit, but I have everything running with a raspberry pi. The web cam works on the ocotprint side, but can get a picture on the cnc.js side. Its a basic EMEET SmartCam C950 that we had laying around.

I did trying following the setup instructions and have tried both options in cnc.js:

All I can get is a black screen but works on octo side:

Any advice on this?

Thanks all

It has been a long time since I messed with that. I wrote this in the doc at the time:

https://jeffeb3.github.io/v1pi/camera/

Thanks Jeff, thats the doc I followed. Excellent work btw! Sadly haven’t got it working yet. Still messing with it

The url is somewhere in the octoprint settings. You can try putting in the whole thing, instead of just the end.

Mostly guessing since I don’t have an instance running right now, but the full URL (like Jeff said) will probably work.

As an example if the IP were 192.168.0.100 then you have port 4080 for OctoPrint
192.168.0.100:4080/
And port 5080 for CNCjs
192.168.0.100:5080/
(basing the above on screen shots in the docs).

That means from the OctoPrint UI, the “webcam/?action=stream” is actually
192.168.0.100:4080/webcam/?action=stream

But when the same address is loaded from within the CNCjs UI, it will resolve to
192.168.0.100:5080/webcam/?action=stream
which doesn’t exist.

If you put the full URL (including 4080) into the CNCjs configuration then it will probably work.

Also by the way nothing prevents you from pointing to another webcam that is hosted by another computer entirely, even an ESP32-cam (I haven’t done this yet but from everything I’ve seen I am pretty confident it should work).

I think the haproxy actually forwards the 192.168.0.100/webcam/ to the webcam port. You don’t want to use the 4080 or the 5080 (FWIW, the camera is on 8080, but skip that too).

If your ip was 192.168.0.100, I would try this:

192.168.0.100/webcam/?action=stream

v1pi.local/webcam/?action=stream might also work.

Thanks guys I’ll give it another run using this after work tomorrow. I sure appreciate the info

Thanks Guys, got it to work. Figure it was something simple

You have to put in the full url includding http://

“http://youripaddress/webcam/?action=stream”

1 Like

you should be able to put a redirect in the index file so it resolves to /webcam/

although im guessing the index file contains other functions.