-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
MjpegExample.java
38 lines (27 loc) · 973 Bytes
/
MjpegExample.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.github.sarxos.webcam.ds.ipcam;
import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.JFrame;
import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.WebcamPanel;
/**
* Example of how to stream MJPEG with Webcam Capture.
*
* @author Bartosz Firyn (SarXos)
*/
public class MjpegExample {
public static void main(String[] args) throws MalformedURLException {
String address = "http://88.37.116.138/mjpg/video.mjpg ";
IpCamDevice livecam = new IpCamDevice("Lignano Beach", new URL(address), IpCamMode.PUSH);
IpCamDriver driver = new IpCamDriver();
driver.register(livecam);
Webcam.setDriver(driver);
WebcamPanel panel = new WebcamPanel(Webcam.getWebcams().get(0));
panel.setFPS(1);
JFrame f = new JFrame("Live Views From Lignano Beach (Italy)");
f.add(panel);
f.pack();
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}