Exemple #1
0
 @Override
 public void openCamera() {
   mCameraManager.acquireCamera();
   // now, we have available sizes -> keep suitable presets
   List<Size> sizes = mCameraManager.getSuitableSizes();
   for (Size s : sizes) {
     for (Params bestPreset : Params.getNearestPresets(s)) {
       mPresets.add(
           new Params.Builder()
               .width(s.getWidth())
               .height(s.getHeight())
               .bitRate(bestPreset.bitrate())
               .frameRate(bestPreset.frameRate())
               .build());
     }
   }
   mCurrentParams = mPresets.get(0);
 }
Exemple #2
0
  @Override
  public void setSurfaceView(final SurfaceView surfaceView) {
    try {
      mCameraManager.setPreviewSurface(surfaceView.getHolder());
    } catch (IOException e) {
      e.printStackTrace();
    }
    /*
    surfaceView.post(new Runnable() {
        @Override
        public void run() {
            int measuredHeight = surfaceView.getMeasuredHeight();
            ViewGroup.LayoutParams lp = surfaceView.getLayoutParams();
            lp.width = measuredHeight * sRatio.getWidth() / sRatio.getHeight();
            surfaceView.setLayoutParams(lp);

        }
    });*/
  }
Exemple #3
0
 @Override
 public void closeCamera() {
   mCameraManager.releaseCamera();
 }