我試圖使AVCaptureDevice的automaticallyEnablesLowLightBoostWhenAvailable在iOS的相機應用假的,但我已經完全不能讓AVCaptureDevice的isLowLightBoostSupported返回true。AVCaptureDevice的isLowLightBoostSupported總是返回的5S iOS7.1(用於automaticallyEnablesLowLightBoostWhenAvailable)
問:是否有任何需要完成的工作來啓用弱光提升api而不是鎖定配置? isLowLightBoostSupported是否有任何已知的原因會在完全更新的現代系統上始終返回false(對於所有設備)?
我在使用iOS 7.1的5S上進行測試。
爲了簡化這個問題,我將更改移植到Apple的AVCam測試應用程序中。在AVCam的差異是這樣的:
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];
+ }
+ }
});
}
我已經把that code in the context of AVCam online at github爲了進一步澄清。
我瀏覽過文檔並試圖找到答案。這裏有一些事情是不吝我當前的代碼:
- 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
我也嘗試了AVCaptureSession實例的sessionPreset設置爲所有AVCaptureSessionPresetHigh,AVCaptureSessionPresetPhoto的,和AVCaptureSessionPresetLow,對isLowLightBoostSupported的狀態沒有可觀察的影響。
感謝您閱讀本文 - 併爲您提供任何幫助! :)
更新:做了一些測試飛行和iOS7.1上的四個設備,兩個5S設備repro這個問題和兩個5設備沒有。 是否存在已知的5S問題? – zethraeus