Skip to content

Commit 774523f

Browse files
committed
create another constructor which takes camera as an argument
Signed-off-by: Umair Khan <[email protected]>
1 parent 76d1903 commit 774523f

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/in/omerjerk/processing/video/android/Capture.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,18 @@ public class Capture extends VideoBase implements CameraHandlerCallback {
2929
private CameraHandler mCameraHandler;
3030

3131
public Capture(PApplet parent) {
32-
this(parent, -1, -1);
32+
this(parent, -1, -1, null);
3333
}
34+
35+
public Capture(PApplet parent, int width, int height) {
36+
this(parent, width, height, null);
37+
}
38+
39+
public Capture(final PApplet parent, String cameraName) {
40+
this(parent, -1, -1, cameraName);
41+
}
3442

35-
public Capture(final PApplet parent, int width, int height) {
43+
public Capture(PApplet parent, int width, int height, String cameraName) {
3644
super(parent);
3745
if (width == -1 || height == -1) {
3846
width = 720;
@@ -47,9 +55,10 @@ public void run() {
4755
mCameraHandler = new CameraHandler(Capture.this);
4856
}
4957
});
58+
setCamera(cameraName);
5059
}
5160

52-
public void setCamera(String camera) {
61+
private void setCamera(String camera) {
5362
if (camera == null || camera.equals("")) {
5463
selectedCamera = 0;
5564
} else {
@@ -58,7 +67,7 @@ public void setCamera(String camera) {
5867
log("Selected camera = " + selectedCamera);
5968
while (mCameraHandler == null) {
6069
//mCameraHandler is instantiated in another thread and at very rare
61-
//occasion, it can be null at this stage
70+
//occasions, it can be null at this stage
6271
try {
6372
Thread.sleep(100);
6473
} catch (InterruptedException e) {

0 commit comments

Comments
 (0)