Screenshots via Java applet

I am looking for an add-on for our livestream and podcast solution that uses a camera to record speeches in our home.

Asked to view our speaker slides directly as an image in a web browser instead of a video stream. We do not want / cannot install software on a laptop with speakers, so I thought of a Java applet that the speaker can simply launch with a web browser.

So what I need technically is this:

[speaker laptop] → [Screencapture every N seconds via applet on web page] → [Display speaker screen on another web page for external viewers]

I know there are Java applications that record the screen but save a local file. I need something that does the same thing, but sends the image to the server. On the server side, I thought about what websocket.js accepts and displays an image (other suggestions are appreciated).

It would be great if someone could help me here. By the way, I have never programmed in Java, so telling me what framework I need it really won't help me.



source to share

1 answer

I was recently asked to evaluate the possibilities of broadcasting a live screen using an applet. Most video APIs do not support codecs with a high enough compression rate (such as JMF). Some APIs can do extended formats (JFFMPEG, Xuggle) but also use natives. Whereas the natives usually do not present a problem for the application. (free float) using Java Web Start or Plug-In 2 applet, the creators of Xuggle identify "native load order" as an issue (eg t) for JWS and applets.

It's a shame that for over a decade in its development, Java hasn't had a sane video capture / processing API that can be deployed for general use (Java / JWS based GUI - for general access).

Perhaps you can find a solution using Flash.

Update 1

In fact, I don't need the screen to be recorded as video.

In fact, you mentioned a lot of this in your original question, but I focused on a few keywords before preparing the answer. Guilty: P


  • Image acquisition is relatively simple. Appler would have to be trusted to get the screenshot, but after trusting, only a few lines of code got the image.
  • You can also encode a JPEG image with a specific quality / compression setting (in memory).
  • Uploading the image to the server will depend on byte size and connection speed, but one high compression image every 10 seconds should be done. The server will need to implement functionality to receive the image.

As far as displaying the image on the client, it seems you already have some JS based ideas. If you can make this work optimal as it will be viewable in browsers without Java.

I would also recommend that you deploy the application. for the "speaker" using Java Web Start instead of embedding the applet. JWS application. will give you less hassle in deployment and maintenance, and running JWS is .. nicer. In addition, a free floating frame launched using JWS can minimize (or, in later JREs, become transparent) while the image is on the screen, thereby capturing everything on the screen except itself.

Update 2

I actually found this code here.

That's ... right. Not a code, a website. When I visited it, I got a message that the popup was suppressed (fair enough). Then there was an annoying "vibrating dialogue" in the middle of the page (and after the scroll). You click the small x

one to see - another tab is open with another floating dialog that says "you won ..." - with sound loud enough to drown out my loud trance / dance playlist.

Then, after closing that dash from my FF, I go back to the original page, close the damn dialog, scroll down and see ... the red background of the code (shudder). This is as far as I could handle. I closed the page with code.

Try this code instead of one screenshot.

Can I use this client side.


.. and get it using server side javascript?

Not really. Unless you mean an IIS based server with Microsoft JScript. JavaScript is a client side technology.

For security reasons, servers need to protect themselves. EG. From:

  • Someone creates a slavebot that uploads all 1000s of documents on the slave computer to the site - so it crashes.
  • People jack high server for storing and serving bestiality porn (or worse).

Because of these things (bad people have a lot of imagination), while servers can easily accept uploads, they are usually not configured by default to allow them.

.. (I don't want Java on my server ;-)

This can be done with PHP, ASP, CGI, etc. It doesn't need Java specifically, but it does require active participation from the server, at least to check the download size and abort if it's too big!

..Let's take a look at the link you posted, but as I said, I cannot program in Java, although I can understand part of it. Thank you!

It looks like you need some help to get the server side ready. For someone who knows how (not me) this is trivial, but a potential security nightmare for the inexperienced.

Update 3

where can I add a function to send the image?

Unfortunately. I haven't tried to implement this - you want to encode it to JPEG before submitting to reduce the size. See this code on how to provide adjustable compression / quality when the user can see the effect.


There are various ways to get the image on the server. EG. sockets, HTTP, FTP .. AFAIU will depend on how the server accepts it. I am not familiar with the specific term "websocket" or node.js script. Can you refer to what you mean?

.. the old code is added to pastebin so it reads

Smart thinking. I notice that it uses sockets, but I figured sockets would be better for this as they have low overhead and short latency.



All Articles