拍摄照片出现的问题
Completed您好,我在github上的官方demo中的Media Manager功能实现demo(github地址:GitHub - DJI-Mobile-SDK-Tutorials/Android-MediaManagerDemo.)里的mainactivity中添加了拍照功能的代码,然后出现报错:照相机当前忙或者是在当前状态不能拍摄照片,具体的界面如下
添加的代码如下:两个按键photomode和takephoto,对应的代码分别为
photomode按键;
if (isMavicAir2() || isM300()) {
switchCameraFlatMode(SettingsDefinitions.FlatCameraMode.PHOTO_SINGLE);
}else {
switchCameraMode(SettingsDefinitions.CameraMode.SHOOT_PHOTO);
}
private void switchCameraFlatMode(SettingsDefinitions.FlatCameraMode flatCameraMode){
Camera camera = DemoApplication.getCameraInstance();
if (camera != null) {
camera.setFlatMode(flatCameraMode, error -> {
if (error == null) {
showToast("Switch Camera Flat Mode Succeeded");
} else {
showToast(error.getDescription());
}
});
}
}
private void switchCameraMode(SettingsDefinitions.CameraMode cameraMode){
Camera camera = DemoApplication.getCameraInstance();
if (camera != null) {
camera.setMode(cameraMode, error -> {
if (error == null) {
showToast("Switch Camera Mode Succeeded");
} else {
showToast(error.getDescription());
}
});
}
}
takephoto按键对应的代码
private void captureAction(){
final Camera camera = DemoApplication.getCameraInstance();
if (camera != null) {
if (isMavicAir2() || isM300()) {
camera.setFlatMode(SettingsDefinitions.FlatCameraMode.PHOTO_SINGLE, djiError -> {
if (null == djiError) {
takePhoto();
}
});
}else {
camera.setShootPhotoMode(SettingsDefinitions.ShootPhotoMode.SINGLE, djiError -> {
if (null == djiError) {
takePhoto();
}
});
}
}
}
private void takePhoto(){
final Camera camera = DemoApplication.getCameraInstance();
if (camera == null){
return;
}
handler.postDelayed(new Runnable() {
@Override
public void run() {
camera.startShootPhoto(djiError -> {
if (djiError == null) {
showToast("take photo: success");
} else {
showToast(djiError.getDescription());
}
});
}
}, 2000);
}
然后出现图中的错误,您能帮我看看是哪里出现问题了么
Please sign in to leave a comment.
Comments
1 comment