Skip to content

Commit

Permalink
Merge pull request #106 from fnakstad/volume-changed-bugfix
Browse files Browse the repository at this point in the history
Fix bug where pictures are repeatedly taken due to new AVCaptureSessi…
  • Loading branch information
zenangst committed Feb 10, 2016
2 parents 3c485be + 7705391 commit 8df3267
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Source/ImagePickerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ public class ImagePickerController: UIViewController {
}

func volumeChanged(notification: NSNotification) {
guard let slider = volumeView.subviews.filter({ $0 is UISlider }).first as? UISlider else { return }
guard let slider = volumeView.subviews.filter({ $0 is UISlider }).first as? UISlider,
let userInfo = notification.userInfo,
let changeReason = userInfo["AVSystemController_AudioVolumeChangeReasonNotificationParameter"] as? String
where changeReason == "ExplicitVolumeChange" else { return }

slider.setValue(volume, animated: false)
cameraController.takePicture()
}
Expand Down

0 comments on commit 8df3267

Please sign in to comment.