閃光設定無效
augusWuDotan opened this issue · comments
Augus Wu commented
Samsun Note 10
Android Version 11
初步評估是
https://github.com/wysaid/android-gpuimage-plus/blob/master/library/src/main/java/org/wysaid/view/CameraGLSurfaceView.java
使用的是 Camera 的接口來做設定
https://developer.android.com/reference/android/hardware/Camera
public synchronized boolean setFlashLightMode(String mode) {
if (!getContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH)) {
Log.e(LOG_TAG, "No flash light is supported by current device!");
return false;
}
if (!mIsCameraBackForward) {
return false;
}
Camera.Parameters parameters = cameraInstance().getParams();
if (parameters == null)
return false;
try {
if (!parameters.getSupportedFlashModes().contains(mode)) {
Log.e(LOG_TAG, "Invalid Flash Light Mode!!!");
return false;
}
parameters.setFlashMode(mode);
cameraInstance().setParams(parameters);
} catch (Exception e) {
Log.e(LOG_TAG, "Switch flash light failed, check if you're using front camera.");
return false;
}
return true;
}
但是新版 Camera2 的相關設定使用則為
https://developer.android.com/reference/android/hardware/camera2
https://developer.android.com/reference/android/hardware/camera2/CameraMetadata
@wysaid 這部分是否有更新的空間
又或是需要重新撰寫
Wang Yang commented
有的, 这块代码有一些陈旧了, 用的比较老的API, 应该更新到新的API上来才合理。
但是因为平时比较忙, 不好给出具体调整的时间,如果开发者有实现的话欢迎给出相关实现的PR~
thanks.