diff --git a/CHANGELOG.md b/CHANGELOG.md index 0059b42..2c59847 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Version 1.5.0 - Added support for front-facing camera tap to adjust exposure +- Added support for double tap gesture to switch cameras +- Added doubleTapCameraSwitch property - Updated demo application with tap animation ## Version 1.4.0 diff --git a/DemoSwiftyCam/DemoSwiftyCam/ViewController.swift b/DemoSwiftyCam/DemoSwiftyCam/ViewController.swift index f496662..92059f8 100644 --- a/DemoSwiftyCam/DemoSwiftyCam/ViewController.swift +++ b/DemoSwiftyCam/DemoSwiftyCam/ViewController.swift @@ -26,6 +26,7 @@ class ViewController: SwiftyCamViewController, SwiftyCamViewControllerDelegate { super.viewDidLoad() cameraDelegate = self kMaximumVideoDuration = 10.0 + doubleTapCameraSwitch = true addButtons() } diff --git a/README.md b/README.md index ecd9ed7..8c1a367 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,12 @@ switchCamera() Tap-to-focus, pinch-to-zoom and camera flash are not supported when the front facing camera is selected. *Switching video while video is being recorded is not currently supported* +SwiftyCam also enables switching between cameras with a double tap gesture. To disable this feature, use the `doubleTapCameraSwitch` property: + +```swift +doubleTapCameraSwitch = false +``` + ##Configuration SwiftyCam has several options for configurating the functionality of the capture: diff --git a/Source/SwiftyCamViewController.swift b/Source/SwiftyCamViewController.swift index 7d10fb8..048b450 100644 --- a/Source/SwiftyCamViewController.swift +++ b/Source/SwiftyCamViewController.swift @@ -460,8 +460,8 @@ open class SwiftyCamViewController: UIViewController { currentCamera = .front } - self.session.stopRunning() - + session.stopRunning() + sessionQueue.async { [unowned self] in // remove and re-add inputs and outputs @@ -539,7 +539,7 @@ open class SwiftyCamViewController: UIViewController { } if let device = videoDevice { - do { + do { try device.lockForConfiguration() if device.isFocusModeSupported(.continuousAutoFocus) { device.focusMode = .continuousAutoFocus