简体   繁体   中英

How to stream server webcam to servlet

I want to show in my servlet the webcam connected to the server, I read in many sites that I may use getUserMedia(); but that only gets the video webcam on the user, and not on the server.

How can I do that? My servlet is programmed in Javascript

First, I heavily doubt that your servlet is written in JavaScript. Are you sure we aren't talking of Java?

What you describe sound like you want to do a live stream of your webcam. Compared to video on demand, this is a demanding task and needs quite some knowledge and experience.

We are not talking of streaming from one point to the other ("unicast streaming"), but a multicast stream where somebody would open a web site and connect to the stream. In order to do that, you have to send the video stream of your webcam to a multicaster, encoded in a way suitable for the intended audience. So what basically happens ist that you capture the video data of your webcam, encode it to a format capable of being streamed, send it to a multicaster which copies the stream to every client that connects to that multicaster. This client can either be a stand alone media player such as Quicktime, VLC or WMP or a player embedded into a website.

So in short and a bit more specific, you have to do the following:

  1. Capture the output of the webcam and encode it according to your intended audience. VLC is a good tool for that.
  2. Set up a multicaster such as the excellent Darwin Streaming Server to which you send the stream to. This server has to be publicly accessible.
  3. Create a link to the stream's description file (rdp file) usually generated by the Darwin Streaming Server. This will connect the client to the stream. An alternative may be a player embedded to your website, which basically is your choice.

Doing this right is not only programmers work, but a lot of sysadmin work, too. You have to do some bandwidth and capacity planning, optimizing the encoder, choosing the right codec and much, much more. All those choices are heavily influenced by the type and size of your intended audience, the purpose of the stream and a lot more.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM