Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable "flash" button if capture device has no flash. #46

Merged
merged 5 commits into from
Oct 8, 2015

Conversation

richardtop
Copy link
Contributor

I fixed a crash when user may tap "flash" button on device which has no flash.
For example, it happened to me on iPad 3.
I didn't check for front/back camera switch as all devices that support iOS 8+ have 2 cameras.
This is how it looks on iPad:
img_0214

@@ -49,7 +50,13 @@ class CameraView: UIViewController {

let captureSession = AVCaptureSession()
let devices = AVCaptureDevice.devices()
var captureDevice: AVCaptureDevice?
var captureDevice: AVCaptureDevice? {
didSet {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You using 4 spaces?

@richardtop
Copy link
Contributor Author

I did a quick test on 4S and found few strange bugs:
The button is removed, but:
on 4S OFF/ON states are swapped, maybe it's so on other devices as well - may be buggy on master
When switching cameras from back to front and then to back again - flash button does not reappear

UPD
All bugs fixed

RamonGilabert added a commit that referenced this pull request Oct 8, 2015
Disable "flash" button if capture device has no flash.
@RamonGilabert RamonGilabert merged commit 936e55d into master Oct 8, 2015
@RamonGilabert RamonGilabert deleted the fix/flashButton-crash branch October 8, 2015 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants