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 # CHANGELOG
## Version 1.2.2
- Added support for low light boost in supported models
- Minor bug fixes
- Updated documentation
## Version 1.2.1 ## Version 1.2.1
- Minor bug fixes - Minor bug fixes
- Updated Documentation - Updated Documentation

View file

@ -28,6 +28,7 @@ class ViewController: SwiftyCamViewController, SwiftyCamViewControllerDelegate {
kMaximumVideoDuration = 10.0 kMaximumVideoDuration = 10.0
tapToFocus = true tapToFocus = true
pinchToZoom = true pinchToZoom = true
lowLightBoost = true
} }
override func viewDidAppear(_ animated: Bool) { 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 :flashlight: | Torch/flash settings
:mag_right: | Supports manual zoom :mag_right: | Supports manual zoom
:lock: | Supports manual focus :lock: | Supports manual focus
:last_quarter_moon_with_face: | low light setting
## Requirements ## 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 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 ## 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: 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? fileprivate var timer : Timer?
/// Initialization Declaration
override public init(frame: CGRect) { override public init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
createGestureRecognizers() createGestureRecognizers()
} }
/// Initialization Declaration
required public init?(coder aDecoder: NSCoder) { required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder) super.init(coder: aDecoder)
createGestureRecognizers() createGestureRecognizers()
@ -86,11 +91,15 @@ open class SwiftyCamButton: UIButton {
} }
} }
/// Timer Finished
@objc fileprivate func timerFinished() { @objc fileprivate func timerFinished() {
invalidateTimer() invalidateTimer()
self.delegate?.longPressDidReachMaximumDuration() self.delegate?.longPressDidReachMaximumDuration()
} }
/// Start Maximum Duration Timer
fileprivate func startTimer() { fileprivate func startTimer() {
if let duration = delegate?.setMaxiumVideoDuration() { if let duration = delegate?.setMaxiumVideoDuration() {
//Check if duration is set, and greater than zero //Check if duration is set, and greater than zero

View file

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

View file

@ -8,7 +8,7 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'SwiftyCam' 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.summary = 'A Simple, Snapchat-style camera Framework written in Swift'
s.ios.deployment_target = '8.0' s.ios.deployment_target = '8.0'