Skip to content

Commit

Permalink
Merge pull request #134 from hyperoslo/bug/iPad-crash
Browse files Browse the repository at this point in the history
Remove sessionPreset
  • Loading branch information
zenangst committed Apr 13, 2016
2 parents 09a9194 + cf7f9fc commit 5af59f1
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions Source/CameraView/CameraView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ class CameraView: UIViewController, CLLocationManagerDelegate {
// MARK: - Initialize camera

func initializeCamera() {
captureSession.sessionPreset = AVCaptureSessionPreset1920x1080
capturedDevices = NSMutableArray()

showNoCamera(false)
Expand Down Expand Up @@ -206,18 +205,13 @@ class CameraView: UIViewController, CLLocationManagerDelegate {
self.captureDevice = capturedDevices?.objectAtIndex(newDeviceIndex) as? AVCaptureDevice
configureDevice()

guard let currentCaptureDevice = self.captureDevice else { return }
guard let _ = self.captureDevice else { return }

UIView.animateWithDuration(0.3, animations: { [unowned self] in
self.containerView.alpha = 1
}, completion: { finished in
self.captureSession.beginConfiguration()
self.captureSession.removeInput(currentDeviceInput)

self.captureSession.sessionPreset =
currentCaptureDevice.supportsAVCaptureSessionPreset(AVCaptureSessionPreset1280x720)
? AVCaptureSessionPreset1280x720
: AVCaptureSessionPreset640x480

do { try
self.captureSession.addInput(AVCaptureDeviceInput(device: self.captureDevice))
} catch {
Expand Down

0 comments on commit 5af59f1

Please sign in to comment.