-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add examples for PULL/PUSH foscam demo, refs #255
- Loading branch information
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
webcam-capture-drivers/driver-ipcam/src/examples/java/FoscamMjpegPullExample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
webcam-capture-drivers/driver-ipcam/src/examples/java/FoscamMjpegPushExample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |