I have a webserver written in Java with the Jetty framework. The computer running the server is connected to a webcam, and I want to be able to stream video from the webcam to browsers connected to the server.
I already have code that can get the pixel data from each frame of the webcam either raw or encoded as a jpeg.
I need to be able to deploy the webserver as a JAR, so pure Java solutions are ideal. I can't use libraries that depend on for example FFmpeg.
How should I go about streaming the video to a browser? Here are some possible ideas I had:
- Send jpeg data through WebSocket and decode in Javascript on the other end
- Somehow use webRTC
- I know that network cameras can stream video viewable in a browser, so maybe there is a Java library to do that