Commit c17d42a5 authored by Nguyễn Văn An's avatar Nguyễn Văn An

update camera iphone x

parent 4d2eb396
......@@ -43,7 +43,7 @@ open class SBKRecordFaceView: UIView, AVCaptureVideoDataOutputSampleBufferDelega
var timer = Timer()
var timeRecord: Int = 0
var checkStatusRecord: Bool = false
private var screenHeight: CGFloat = 0
var idFront: String = ""
var idBack: String = ""
var URLToken: String = ""
......@@ -53,7 +53,7 @@ open class SBKRecordFaceView: UIView, AVCaptureVideoDataOutputSampleBufferDelega
public var zoom: CGFloat = 1.0
public var imageStartRecord: UIImage?
public var checkStep: Int = 0
private var startusCheck : Bool = false
public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
commonInit()
......@@ -72,6 +72,7 @@ open class SBKRecordFaceView: UIView, AVCaptureVideoDataOutputSampleBufferDelega
if AVCaptureDevice.authorizationStatus(for: .video) == .denied {
return
}
self.checkScreen()
self.loadCamera()
}
......@@ -91,6 +92,10 @@ open class SBKRecordFaceView: UIView, AVCaptureVideoDataOutputSampleBufferDelega
}
}
public func setCameraChecker(){
self.startusCheck = true
}
public func statusSubView(statusHide: Bool) {
viewSubIcon.isHidden = statusHide
}
......@@ -307,14 +312,31 @@ open class SBKRecordFaceView: UIView, AVCaptureVideoDataOutputSampleBufferDelega
debugPrint("unable to get image from sample buffer")
return
}
if self.startusCheck {
if #available(iOS 11.0, *) {
if self.screenHeight == 2436 {
self.detectFace(in: self.resizeImageFace(pixelBuffer: frame.resized(to: CGSize(width: 360, height: 480))!))
} else {
self.detectFace(in: self.resizeImageFace(pixelBuffer: frame))
}
}
}
}
func checkScreen(){
if UIDevice().userInterfaceIdiom == .phone {
self.screenHeight = UIScreen.main.nativeBounds.height
}
}
private func addCameraInput() {
if self.screenHeight == 2436 {
self.captureSession.sessionPreset = .high
} else {
self.captureSession.sessionPreset = .medium
}
if #available(iOS 11.1, *) {
guard let device = AVCaptureDevice.DiscoverySession(
deviceTypes: [.builtInWideAngleCamera, .builtInDualCamera, .builtInTrueDepthCamera],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment