Added low light boost

This commit is contained in:
Andrew Walz 2017-01-06 15:41:14 -07:00
parent faca18d345
commit a78e112597
6 changed files with 71 additions and 27 deletions

View file

@ -1,5 +1,10 @@
# CHANGELOG
## Version 1.2.2
- Added support for low light boost in supported models
- Minor bug fixes
- Updated documentation
## Version 1.2.1
- Minor bug fixes
- Updated Documentation

View file

@ -28,6 +28,7 @@ class ViewController: SwiftyCamViewController, SwiftyCamViewControllerDelegate {
kMaximumVideoDuration = 10.0
tapToFocus = true
pinchToZoom = true
lowLightBoost = true
}
override func viewDidAppear(_ animated: Bool) {

View file

@ -26,6 +26,7 @@ Configuring a Camera View Controller in AVFoundation can be tedious and time con
:flashlight: | Torch/flash settings
:mag_right: | Supports manual zoom
:lock: | Supports manual focus
:last_quarter_moon_with_face: | low light setting
## Requirements
@ -196,6 +197,12 @@ SwiftyCam, by default, support tap to focus on the video preview. SwiftyCam will
By default, **tapToFocus** is enabled. If you wish to show a on screen animation when a tap to focus is initiated, you can use the **SwiftyCamDidFocusAtPoint(focusPoint:)** to get the coordinates of tap and provide your own tap animation
## Low Light Boost
For supported models (iPhone 5 and 5C), AVCaptureDevice supports a low light boost when it is detected that the capture session is in a low light area. By default, this is set to true. It can be modified with the **lowLightBoost** variable:
lowLightBoost = false
## Privacy
When a user firsts launch SwiftyCamViewController, they will be prompted for permission for access to the cameras and microphones. By default, if a user declines access to the hardware, SwiftyCam will provide a prompt to the App privacy settings inside the iOS settings application. If you wish to change this behaviour, the **promptToAppPrivacySettings** property can be modified:

View file

@ -58,11 +58,16 @@ open class SwiftyCamButton: UIButton {
fileprivate var timer : Timer?
/// Initialization Declaration
override public init(frame: CGRect) {
super.init(frame: frame)
createGestureRecognizers()
}
/// Initialization Declaration
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
createGestureRecognizers()
@ -86,11 +91,15 @@ open class SwiftyCamButton: UIButton {
}
}
/// Timer Finished
@objc fileprivate func timerFinished() {
invalidateTimer()
self.delegate?.longPressDidReachMaximumDuration()
}
/// Start Maximum Duration Timer
fileprivate func startTimer() {
if let duration = delegate?.setMaxiumVideoDuration() {
//Check if duration is set, and greater than zero

View file

@ -25,46 +25,50 @@ open class SwiftyCamViewController: UIViewController {
// MARK: Enumeration Declaration
/**
Enumeration for Camera Selection
- rear: Camera on the back of the device.
- front: Camera on the front of the device.
*/
/// Enumeration for Camera Selection
public enum CameraSelection {
/// Camera on the back of the device
case rear
/// Camera on the front of the device
case front
}
/**
Enumeration for video quality of the capture session. Corresponds to a AVCaptureSessionPreset
- high: AVCaptureSessionPresetHigh
- medium: AVCaptureSessionPresetMedium
- low: AVCaptureSessionPresetLow
- resolution352x288: AVCaptureSessionPreset352x288
- resolution640x480: AVCaptureSessionPreset640x480
- resolution1280x720: AVCaptureSessionPreset1280x720
- resolution1920x1080: AVCaptureSessionPreset1920x1080
- resolution3840x2160: AVCaptureSessionPreset3840x2160
- iframe960x540: AVCaptureSessionPresetiFrame960x540
- iframe1280x720: AVCaptureSessionPresetiFrame1280x720
*/
/// Enumeration for video quality of the capture session. Corresponds to a AVCaptureSessionPreset
public enum VideoQuality {
/// AVCaptureSessionPresetHigh
case high
/// AVCaptureSessionPresetMedium
case medium
/// AVCaptureSessionPresetLow
case low
/// AVCaptureSessionPreset352x288
case resolution352x288
/// AVCaptureSessionPreset640x480
case resolution640x480
/// AVCaptureSessionPreset1280x720
case resolution1280x720
/// AVCaptureSessionPreset1920x1080
case resolution1920x1080
/// AVCaptureSessionPreset3840x2160
case resolution3840x2160
/// AVCaptureSessionPresetiFrame960x540
case iframe960x540
/// AVCaptureSessionPresetiFrame1280x720
case iframe1280x720
}
@ -101,14 +105,20 @@ open class SwiftyCamViewController: UIViewController {
public var flashEnabled = false
/// Sets whether Pinch to Zoom is supported for the capture session
/// Sets whether Pinch to Zoom is enabled for the capture session
public var pinchToZoom = true
/// Sets whether Tap to Focus is supported for the capture session
/// Sets whether Tap to Focus is enabled for the capture session
public var tapToFocus = true
/// Sets whether the capture session should adjust to low light conditions automatically
///
/// Only supported on iPhone 5 and 5C
public var lowLightBoost = true
/// Sets whether SwiftyCam will prompt a user to the App Settings Screen if Camera or Microphone access is not authorized
public var promptToAppPrivacySettings = true
@ -182,11 +192,13 @@ open class SwiftyCamViewController: UIViewController {
/// Disable view autorotation for forced portrait recorindg
open override var shouldAutorotate: Bool {
override open var shouldAutorotate: Bool {
return false
}
// MARK: ViewDidLoad
/// ViewDidLoad Implementation
override open func viewDidLoad() {
super.viewDidLoad()
@ -228,6 +240,9 @@ open class SwiftyCamViewController: UIViewController {
// MARK: ViewDidAppear
/// ViewDidAppear(_ animated:) Implementation
override open func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
@ -254,6 +269,9 @@ open class SwiftyCamViewController: UIViewController {
// MARK: ViewDidDisappear
/// ViewDidDisappear(_ animated:) Implementation
override open func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
@ -515,6 +533,10 @@ open class SwiftyCamViewController: UIViewController {
device.whiteBalanceMode = .continuousAutoWhiteBalance
}
if device.isLowLightBoostSupported && lowLightBoost == true {
device.automaticallyEnablesLowLightBoostWhenAvailable = true
}
device.unlockForConfiguration()
} catch {
print("[SwiftyCam]: Error locking configuration")

View file

@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = 'SwiftyCam'
s.version = '1.2.1'
s.version = '1.2.2'
s.summary = 'A Simple, Snapchat-style camera Framework written in Swift'
s.ios.deployment_target = '8.0'