@@ -29,10 +29,18 @@ public class Capture extends VideoBase implements CameraHandlerCallback {
29
29
private CameraHandler mCameraHandler ;
30
30
31
31
public Capture (PApplet parent ) {
32
- this (parent , -1 , -1 );
32
+ this (parent , -1 , -1 , null );
33
33
}
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
+ }
34
42
35
- public Capture (final PApplet parent , int width , int height ) {
43
+ public Capture (PApplet parent , int width , int height , String cameraName ) {
36
44
super (parent );
37
45
if (width == -1 || height == -1 ) {
38
46
width = 720 ;
@@ -47,9 +55,10 @@ public void run() {
47
55
mCameraHandler = new CameraHandler (Capture .this );
48
56
}
49
57
});
58
+ setCamera (cameraName );
50
59
}
51
60
52
- public void setCamera (String camera ) {
61
+ private void setCamera (String camera ) {
53
62
if (camera == null || camera .equals ("" )) {
54
63
selectedCamera = 0 ;
55
64
} else {
@@ -58,7 +67,7 @@ public void setCamera(String camera) {
58
67
log ("Selected camera = " + selectedCamera );
59
68
while (mCameraHandler == null ) {
60
69
//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
62
71
try {
63
72
Thread .sleep (100 );
64
73
} catch (InterruptedException e ) {
0 commit comments