当前位置: 首页>>代码示例>>Java>>正文


Java CameraInfo.CAMERA_FACING_BACK属性代码示例

本文整理汇总了Java中android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK属性的典型用法代码示例。如果您正苦于以下问题:Java CameraInfo.CAMERA_FACING_BACK属性的具体用法?Java CameraInfo.CAMERA_FACING_BACK怎么用?Java CameraInfo.CAMERA_FACING_BACK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.hardware.Camera.CameraInfo的用法示例。


在下文中一共展示了CameraInfo.CAMERA_FACING_BACK属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findBackFacingCamera

private int findBackFacingCamera() 
{
		int cameraId = -1;
	int numberOfCameras = Camera.getNumberOfCameras();
	for (int i = 0; i < numberOfCameras; i++) 
	{
		CameraInfo info = new CameraInfo();
		Camera.getCameraInfo(i, info);
		if (info.facing == CameraInfo.CAMERA_FACING_BACK)
		{
			Log.d(TAG_NAME, "Camera found");
			cameraId = i;
			break;
		}
	}
	return cameraId;
}
 
开发者ID:VIQET,项目名称:VIQET-Android,代码行数:17,代码来源:CameraActivity.java

示例2: onCreate

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Create a container that will hold a SurfaceView for camera previews
    mPreview = new Preview(this.getActivity());

    // Find the total number of cameras available
    mNumberOfCameras = Camera.getNumberOfCameras();

    // Find the ID of the rear-facing ("default") camera
    CameraInfo cameraInfo = new CameraInfo();
    for (int i = 0; i < mNumberOfCameras; i++) {
        Camera.getCameraInfo(i, cameraInfo);
        if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
            mCurrentCamera = mDefaultCameraId = i;
        }
    }
    setHasOptionsMenu(mNumberOfCameras > 1);
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:20,代码来源:CameraFragment.java

示例3: flipCamera

public void flipCamera() {
  if (Camera.getNumberOfCameras() > 1) {
    cameraId = cameraId == CameraInfo.CAMERA_FACING_BACK
               ? CameraInfo.CAMERA_FACING_FRONT
               : CameraInfo.CAMERA_FACING_BACK;
    onPause();
    onResume();
    TextSecurePreferences.setDirectCaptureCameraId(getContext(), cameraId);
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:10,代码来源:CameraView.java

示例4: findBackFacingCamera

private int findBackFacingCamera() {
    cameraId = -1;
    // Search for the back facing camera
    // get the number of cameras
    int numberOfCameras = Camera.getNumberOfCameras();
    // for every camera check
    for (int i = 0; i < numberOfCameras; i++) {
        CameraInfo info = new CameraInfo();
        Camera.getCameraInfo(i, info);
        if (info.facing == CameraInfo.CAMERA_FACING_BACK) {
            cameraId = i;
            cameraFront = false;
            break;
        }
    }
    return cameraId;
}
 
开发者ID:umesh-kushwaha,项目名称:Android_Video_Recording_portrait,代码行数:17,代码来源:VideoCaptureActivity.java

示例5: getCameraId

private int getCameraId() {
  CameraInfo ci = new CameraInfo();
  for (int i = 0; i < Camera.getNumberOfCameras(); i++) {
    Camera.getCameraInfo(i, ci);
    if (ci.facing == CameraInfo.CAMERA_FACING_BACK)
      return i;
  }
  return -1; // No camera found
}
 
开发者ID:Nilhcem,项目名称:tensorflow-classifier-android,代码行数:9,代码来源:LegacyCameraConnectionFragment.java

示例6: CameraTrans

private void CameraTrans(SurfaceHolder mholder) {
    // 切换前后摄像头
    int cameraCount = 0;
    CameraInfo cameraInfo = new CameraInfo();
    cameraCount = Camera.getNumberOfCameras();// 得到摄像头的个数

    for (int i = 0; i < cameraCount; i++) {
        Camera.getCameraInfo(i, cameraInfo);// 得到每一个摄像头的信息
        if (startFontCamera) {
            // 现在是后置,变更为前置
            if (cameraInfo.facing == CameraInfo.CAMERA_FACING_FRONT) {
                /**
                 * 记得释放camera,方便其他应用调用
                 */
                releaseCamera();
                // 打开当前选中的摄像头
                mcamera = Camera.open(i);
                startFontCamera = false;
                setStartPreview(mcamera, mholder);
                break;
            }
        } else {
            // 现在是前置, 变更为后置
            if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
                /**
                 * 记得释放camera,方便其他应用调用
                 */
                releaseCamera();
                mcamera = Camera.open(i);
                startFontCamera = true;
                setStartPreview(mcamera, mholder);
                break;
            }
        }

    }
}
 
开发者ID:Liuzhiyang94,项目名称:ComponentProjectDemo,代码行数:37,代码来源:CameraActivity.java

示例7: hasCamera

@Override
public boolean hasCamera(final int facing) {
    if (facing == CameraInfo.CAMERA_FACING_BACK) {
        return hasCameraSupport();
    }
    return false;
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:7,代码来源:CameraHelperBase.java

示例8: openCameraFacing

@Override
public Camera openCameraFacing(final int facing) {
    if (facing == CameraInfo.CAMERA_FACING_BACK) {
        return Camera.open();
    }
    return null;
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:7,代码来源:CameraHelperBase.java

示例9: getDefaultCameraID

public static int getDefaultCameraID() {
    int camerasCnt = getAvailableCamerasCount();
    int defaultCameraID = 0;
    CameraInfo cameraInfo = new CameraInfo();
    for (int i = 0; i < camerasCnt; i++) {
        Camera.getCameraInfo(i, cameraInfo);
        if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
            defaultCameraID = i;
        }
    }
    return defaultCameraID;
}
 
开发者ID:AndroidKnife,项目名称:RecordHelper,代码行数:12,代码来源:CameraHelper.java

示例10: switchCamera

/**	Switch between the front facing and the back facing camera of the phone. 
 * If {@link #startPreview()} has been called, the preview will be  briefly interrupted. 
 * If {@link #start()} has been called, the stream will be  briefly interrupted.
 * You should not call this method from the main thread if you are already streaming. 
 * @throws IOException 
 * @throws RuntimeException 
 **/
public void switchCamera() throws RuntimeException, IOException {
	if (Camera.getNumberOfCameras() == 1) throw new IllegalStateException("Phone only has one camera !");
	boolean streaming = mStreaming;
	boolean previewing = mCamera!=null && mCameraOpenedManually; 
	mCameraId = (mCameraId == CameraInfo.CAMERA_FACING_BACK) ? CameraInfo.CAMERA_FACING_FRONT : CameraInfo.CAMERA_FACING_BACK; 
	setCamera(mCameraId);
	stopPreview();
	mFlashEnabled = false;
	if (previewing) startPreview();
	if (streaming) start(); 
}
 
开发者ID:galme,项目名称:ROLF-EV3,代码行数:18,代码来源:VideoStream.java

示例11: getDefaultCameraID

public static int getDefaultCameraID() {
	int camerasCnt = getAvailableCamerasCount();
	int defaultCameraID = 0;
	CameraInfo cameraInfo = new CameraInfo();
       for (int i=0; i <camerasCnt; i++) {
           Camera.getCameraInfo(i, cameraInfo);
           if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
           	defaultCameraID = i;
           }
       }
       return defaultCameraID;
}
 
开发者ID:lukamarin,项目名称:Rocket.Chat-android,代码行数:12,代码来源:CameraHelper.java

示例12: hasCamera

@Override
public boolean hasCamera(final int facing) {
  if (facing == CameraInfo.CAMERA_FACING_BACK) {
    return hasCameraSupport();
  }
  return false;
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:7,代码来源:CameraHelperBase.java

示例13: isRearCamera

public boolean isRearCamera() {
  return cameraId == CameraInfo.CAMERA_FACING_BACK;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:3,代码来源:CameraView.java

示例14: onClick

@Override
public void onClick(View v) {
    //下一步
    if (v.getId() == R.id.recorder_next) {
        if (isRecordingStarted) {
            rec = false;
            saveRecording();
        } else
            initiateRecording(false);
    } else if (v.getId() == R.id.recorder_flashlight) {
        if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH)) {
            //showToast(this, "不能开启闪光灯");
            return;
        }
        //闪光灯
        if (isFlashOn) {
            isFlashOn = false;
            flashIcon.setSelected(false);
            cameraParameters.setFlashMode(Parameters.FLASH_MODE_OFF);
        } else {
            isFlashOn = true;
            flashIcon.setSelected(true);
            cameraParameters.setFlashMode(Parameters.FLASH_MODE_TORCH);
        }
        mCamera.setParameters(cameraParameters);
    } else if (v.getId() == R.id.recorder_frontcamera) {
        //转换摄像头
        cameraSelection = ((cameraSelection == CameraInfo.CAMERA_FACING_BACK) ? CameraInfo.CAMERA_FACING_FRONT : CameraInfo.CAMERA_FACING_BACK);
        initCameraLayout();

        if (cameraSelection == CameraInfo.CAMERA_FACING_FRONT)
            flashIcon.setVisibility(View.GONE);
        else {
            flashIcon.setVisibility(View.VISIBLE);
            if (isFlashOn) {
                cameraParameters.setFlashMode(Parameters.FLASH_MODE_TORCH);
                mCamera.setParameters(cameraParameters);
            }
        }
    } else if (v.getId() == R.id.recorder_cancel) {
        if (recording)
            showCancellDialog();
        else
            videoTheEnd(false);
    }
}
 
开发者ID:feigxj,项目名称:VideoRecorder-master,代码行数:46,代码来源:FFmpegRecorderActivity.java

示例15: getCameraInfo

@Override
public void getCameraInfo(final int cameraId, final CameraHelper.CameraInfo2 cameraInfo) {
    cameraInfo.facing = CameraInfo.CAMERA_FACING_BACK;
    cameraInfo.orientation = 90;
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:5,代码来源:CameraHelperBase.java


注:本文中的android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。