public void setPreviewView(PreviewView previewView) { this.previewView = previewView; textureView = previewView.getTextureView(); if (surfaceTexture != null) { surfaceTexture.DetachFromGLContext(); textureView.SurfaceTexture = surfaceTexture; } //textureView.SurfaceTextureListener(surfaceTextureListener); }
private void setCameraType(CameraImageSource cameraImageSource) { // TODO 选择使用前置摄像头 // cameraImageSource.getCameraControl().setCameraFacing(ICameraControl.CAMERA_FACING_FRONT); // TODO 选择使用usb摄像头 cameraImageSource.getCameraControl().setCameraFacing(2); // 如果不设置,人脸框会镜像,显示不准 previewView.getTextureView().ScaleX = -1; // TODO 选择使用后置摄像头 // cameraImageSource.getCameraControl().setCameraFacing(ICameraControl.CAMERA_FACING_BACK); // previewView.getTextureView().setScaleX(-1); }
public void setPreviewView(PreviewView previewView) { this.previewView = previewView; setTextureView(previewView.getTextureView()); }