4

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
Nmk
  • 1,281
  • 2
  • 14
  • 25
while1fork
  • 374
  • 4
  • 15
  • 3
    http://stackoverflow.com/questions/5574143/stream-video-in-java – Blue Dec 29 '15 at 21:34
  • @Blue Thanks, that question has answers that might be useful to me. However, I ask if there is a solution that doesn't require native dependencies, only Java libraries. – while1fork Dec 29 '15 at 21:50
  • 1
    If the libraries mentioned (xuggle, stream.m) don't work w/o built-in imports, you could always put the native stuff in the jar as well (copy-paste into your workspace). That's assuming you really need this to run w/o the native libraries present in nearly every Java installation. – Blue Dec 29 '15 at 22:36

0 Answers0