탭 레이아웃이 있고 첫 번째 탭에 'takePicture ()'라는 클릭 이벤트가있는 팹을 배치했습니다. 이 방법에서는 카메라 권한을 확인한 다음 카메라 미리보기 플러그인을 사용해 봅니다. 버튼을 클릭해도 카메라 미리보기가 나타나지 않습니다.
takePicture() {
this.androidPermissions.requestPermission(this.androidPermissions.PERMISSION.CAMERA).then(result => {
console.log(result.hasPermission);
if(result.hasPermission) {
const cameraPreviewOpts: CameraPreviewOptions = {
x: 10,
y: 10,
width: 100,
height: 100,
camera: 'rear',
tapPhoto: true,
previewDrag: true,
toBack: true,
alpha: 1
}
this.cameraPreview.startCamera(cameraPreviewOpts).then(
(res) => {
console.log(res)
},
(err) => {
console.log(err)
});
} else {
console.log('Could not access camera without permission');
}
});
}
산출:
true
Camera started
카메라가 시작되었다는 메시지가 표시되지만 미리보기가 표시되지 않습니다. 도움을 주시면 감사하겠습니다!
추가하여 수정
ion-content { --background: transparent !important; }
탭의 scss 파일에.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다