Closed felix8888 closed 7 years ago
👍 - I made these changes and flash works on iOS 10+, very nice, approving this!
thanks @felix8888 @Kaspik 🙌
@piemonte @felix8888 One more fix please (I don't wanna fork and include this one row fix).
PBJVision.m
- row 1739, On iPhone 5, 6 etc with iOS 10 and front camera - it crashes if flashMode is not off (because these older devices don't support flash from screen).
please change whole row from:
settings.flashMode = (AVCaptureFlashMode)self.flashMode;
to
settings.flashMode = [self isFlashAvailable] ? (AVCaptureFlashMode)self.flashMode : AVCaptureFlashModeOff;
Also, method isFlashAvailable
should have one more check:
return (_currentDevice && [_currentDevice hasFlash] && [_currentDevice isFlashAvailable]);
via apple doc: The value of this property is a BOOL indicating whether the receiver's flash is currently available. The flash may become unavailable if, for example, the device overheats and needs to cool off.
@piemonte The same fix applies to your NextLevel Swift camera project (FlashModeOn for front camera on older devices). :)
Hey Sir, I found some bugs related to flash mode, so I fire this pull request to you, hope you can take a look it.
Thanks Felix