Skip to content

Commit

Permalink
Add examples for PULL/PUSH foscam demo, refs #255
Browse files Browse the repository at this point in the history
  • Loading branch information
sarxos committed Aug 29, 2014
1 parent 637b2c4 commit 132996c
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import java.net.MalformedURLException;

import javax.swing.JFrame;

import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.WebcamPanel;
import com.github.sarxos.webcam.ds.ipcam.IpCamAuth;
import com.github.sarxos.webcam.ds.ipcam.IpCamDeviceRegistry;
import com.github.sarxos.webcam.ds.ipcam.IpCamDriver;
import com.github.sarxos.webcam.ds.ipcam.IpCamMode;


public class FoscamMjpegPullExample {

static {
Webcam.setDriver(new IpCamDriver());
}

public static void main(String[] args) throws MalformedURLException {

String name = "Test #255";
String url = "http://ce3014.myfoscam.org:20054/snapshot.cgi";
IpCamMode mode = IpCamMode.PULL;
IpCamAuth auth = new IpCamAuth("user", "user");

IpCamDeviceRegistry.register(name, url, mode, auth);

WebcamPanel panel = new WebcamPanel(Webcam.getWebcams().get(0));
panel.setFPSLimit(1);

JFrame f = new JFrame("Test #255 PULL");
f.add(panel);
f.pack();
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import java.net.MalformedURLException;

import javax.swing.JFrame;

import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.WebcamPanel;
import com.github.sarxos.webcam.ds.ipcam.IpCamAuth;
import com.github.sarxos.webcam.ds.ipcam.IpCamDeviceRegistry;
import com.github.sarxos.webcam.ds.ipcam.IpCamDriver;
import com.github.sarxos.webcam.ds.ipcam.IpCamMode;


public class FoscamMjpegPushExample {

static {
Webcam.setDriver(new IpCamDriver());
}

public static void main(String[] args) throws MalformedURLException {

String name = "Test #255";
String url = "http://ce3014.myfoscam.org:20054/videostream.cgi";
IpCamMode mode = IpCamMode.PUSH;
IpCamAuth auth = new IpCamAuth("user", "user");

IpCamDeviceRegistry.register(name, url, mode, auth);

WebcamPanel panel = new WebcamPanel(Webcam.getWebcams().get(0));
panel.setFPSLimit(1);

JFrame f = new JFrame("Test #255 PUSH");
f.add(panel);
f.pack();
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

0 comments on commit 132996c

Please sign in to comment.