File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
src/in/omerjerk/processing/video/android Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 13
13
import processing .core .PConstants ;
14
14
import processing .core .PImage ;
15
15
16
- //@SuppressWarnings("deprecation")
17
16
public class Capture extends PImage implements PConstants {
18
17
19
18
private static final boolean DEBUG = true ;
20
19
public static void log (String log ) {if (DEBUG ) System .out .println (log );}
21
20
22
21
private Context context ;
23
22
23
+ private Camera mCamera ;
24
+
24
25
private static ArrayList <String > camerasList = new ArrayList <String >();
25
26
26
27
private static final String KEY_FRONT_CAMERA = "front-camera-%d" ;
@@ -38,7 +39,16 @@ public void setCamera(String camera) {
38
39
} else {
39
40
selectedCamera = camerasList .indexOf (camera );
40
41
}
41
- log ("Selected camera = " + selectedCamera );
42
+ log ("Selected camera = " + selectedCamera );
43
+ try {
44
+ mCamera = Camera .open (selectedCamera );
45
+ CameraPreview mPreview = new CameraPreview (context , mCamera );
46
+ mCamera .setPreviewCallback (previewCallback );
47
+ } catch (Exception e ) {
48
+ System .err .println ("Camera not avaialble to use." );
49
+ e .printStackTrace ();
50
+ }
51
+
42
52
}
43
53
44
54
public String [] list () {
@@ -130,4 +140,4 @@ public void surfaceDestroyed(SurfaceHolder holder) {
130
140
// do nothing
131
141
}
132
142
}
133
- }
143
+ }
You can’t perform that action at this time.
0 commit comments