Skip to content

Commit

Permalink
Merge branch 'release/2.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
heart committed Nov 7, 2020
2 parents 6acea72 + e49d832 commit e3d65bd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
Binary file not shown.
Binary file not shown.
23 changes: 13 additions & 10 deletions Sources/CarBode/CameraPreview.swift
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,21 @@ public class CameraPreview: UIView {
}

previewLayer?.removeFromSuperlayer()
let previewLayer = AVCaptureVideoPreviewLayer(session: session)

self.backgroundColor = UIColor.gray
previewLayer.videoGravity = .resizeAspectFill
self.layer.addSublayer(previewLayer)
self.previewLayer = previewLayer

session.startRunning()

self.session = session
self.previewLayer = previewLayer
self.selectedCamera = selectedCamera
self.backgroundColor = UIColor.gray

DispatchQueue.global().async {
session.startRunning()
DispatchQueue.main.async {
let previewLayer = AVCaptureVideoPreviewLayer(session: session)
previewLayer.videoGravity = .resizeAspectFill
self.layer.addSublayer(previewLayer)

self.previewLayer = previewLayer
}
}

}
}
}
Expand Down

0 comments on commit e3d65bd

Please sign in to comment.