Currently, we have a stream that we can access on the url “10.14.44.5:8080/?action=stream”. I want to put it on the dashboard using some sort of Sendable. I’ve tried this code:
final HttpCamera camera = new HttpCamera("Camera", "http://10.14.44.5:8080/?action=stream", HttpCamera.HttpCameraKind.kMJPGStreamer);
myShuffleboardTab.add(camera);
A camera widget with the name “Camera” shows up on shuffleboard in the correct place, but the stream isn’t there. Am I using the correct class or is there another class to stream mjpg video?
You need to use the CameraServer class to host the stream. Otherwise Shuffleboard won’t know the URLs to use to connect to it. You can use CameraServer.getInstance().addCamera(camera);
to do this.
Also, port 8080 is blocked on the field - you should change the port to an open one. Consult the manual for a list of these ports.
Here’s the code that I’m using now. I couldn’t get it working either. The same thing happens, the Camera pops up on the dashboard and is blank. I just tested a USB camera and I got that working so I might still be doing something wrong. Code:
// this is in robotInit()
final HttpCamera camera = new HttpCamera("Camera", "http://10.14.44.5:5800/?action=stream", HttpCamera.HttpCameraKind.kMJPGStreamer);
CameraServer.getInstance().addCamera(camera);
myShuffleboardTab.add(camera);
I am able to access the “http://10.14.44.5:5800/?action=stream” so I don’t think it’s a problem with the stream.
If it is a problem with the stream, maybe I’m not encoding it correctly? I’m not sure. I’ll test that more tomorrow.
1 Like