AVCaptureDevice's isLowLightBoostSupported always returns false on 5S iOS7.1 (for automaticallyEnablesLowLightBoostWhenAvailable)

独自空忆成欢 提交于 2019-12-23 12:36:59

问题


I'm attempting to enable AVCaptureDevice's automaticallyEnablesLowLightBoostWhenAvailable in an iOS camera app, but I've been utterly unable to make AVCaptureDevice's isLowLightBoostSupported return true.

Question: Is there anything that needs to be done to enable the low light boost api beyond locking for configuration? Is there any known reason that isLowLightBoostSupported would always return false (for all devices) on a fully updated, modern, system?

I'm testing on a 5S with iOS 7.1.

For the sake of simplicity in this question, I've ported the changes into Apple's AVCam test app. The diff in AVCam is as such:

diff --git a/AVCam/AVCam/AVCamViewController.m b/AVCam/AVCam/AVCamViewController.m
index 84a2c77..4e15fc4 100644
--- a/AVCam/AVCam/AVCamViewController.m
+++ b/AVCam/AVCam/AVCamViewController.m
@@ -175,6 +175,18 @@ static void * SessionRunningAndDeviceAuthorizedContext = &SessionRunningAndDevic
            [session addOutput:stillImageOutput];
            [self setStillImageOutput:stillImageOutput];
        }
+
+        if ([videoDevice respondsToSelector:@selector(isLowLightBoostSupported)]) {
+            if ([videoDevice lockForConfiguration:nil]) {
+                if (videoDevice.isLowLightBoostSupported) {
+                    videoDevice.automaticallyEnablesLowLightBoostWhenAvailable = YES;
+                    NSLog(@"was supported");
+                } else {
+                    NSLog(@"was not supported");
+                }
+                [videoDevice unlockForConfiguration];
+            }
+        }
    });
 }

I've put that code in the context of AVCam online at github for further clarity.

I've trawled through the docs and SO to try to find an answer. Here are some things that have educated my current code:

  • iPhone 5's low light boost mode
  • AVCaptureDevice Low Light Boost Does Not work
  • https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVCaptureDevice_Class/Reference/Reference.html#//apple_ref/occ/instp/AVCaptureDevice/lowLightBoostSupported

I've also attempted to set the AVCaptureSession instance's sessionPreset to all of AVCaptureSessionPresetHigh, AVCaptureSessionPresetPhoto, and AVCaptureSessionPresetLow with no observable effect on the the state of isLowLightBoostSupported.

Thanks for reading through this - and for any help you can give! :)


回答1:


From what I understand the 5S does not support low light boost mode. I don't have any insight into Apple's decision on this, but I'm guessing the improvements made to the camera/sensor on the 5S were good enough that they felt low light boost was not needed on that device.

So, what you're seeing is not an error. It's simply that some devices support that feature (the iPhone 5), and some do not (the iPhone 5S).

I'd post a list of compatible devices, but I don't have newer iPod Touches and some iPads to be able to test it. I'd guess the iPhone 5c does support it since that device is basically a reskinned iPhone 5, but again I don't have one to test.



来源:https://stackoverflow.com/questions/22487518/avcapturedevices-islowlightboostsupported-always-returns-false-on-5s-ios7-1-fo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!