Ich arbeite mit AVFoundation und mache eine Fullscreen-Kameraansicht. Ich kann nicht in der Lage sein, die fps zu ändern und die Statusleiste auszublenden. Ich möchte, dass die fps auf 140 fps gesetzt werden (für das iPhone 7) und ich möchte auch, dass die Statusleiste ausgeblendet wird (ich habe das in meinen Storyboard-Dateien und auf der Registerkarte Allgemein der Xcode-App-Einstellungen geändert dies erreiche ich Vielen Dank im Voraus (ich bin mit Swift 3.0 und würde eine Antwort in Swift 3 (wenn möglich) bevorzugen)Wie man fps ändert und die Statusleiste mit AVFoundation und einer Kameraansicht ausblendet
Code of Viewcontroller:?! `Klasse Viewcontroller: UIViewController {
@IBOutlet var cameraView: UIImageView!
let captureSession = AVCaptureSession()
let stillImageOutput = AVCaptureStillImageOutput()
var previewLayer : AVCaptureVideoPreviewLayer?
var captureDevice : AVCaptureDevice?
func beginSession() {
do {
try captureSession.addInput(AVCaptureDeviceInput(device: captureDevice))
stillImageOutput.outputSettings = [AVVideoCodecKey:AVVideoCodecJPEG]
if captureSession.canAddOutput(stillImageOutput) {
captureSession.addOutput(stillImageOutput)
}
}
catch {
print("error: \(error.localizedDescription)")
}
guard let previewLayer = AVCaptureVideoPreviewLayer(session: captureSession) else {
print("no preview layer")
return
}
self.view.layer.addSublayer(previewLayer)
previewLayer.frame = self.view.layer.frame
captureSession.startRunning()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
captureSession.sessionPreset = AVCaptureSessionPresetHigh
if let devices = AVCaptureDevice.devices() as? [AVCaptureDevice] {
// Loop through all the capture devices on this phone
for device in devices {
// Make sure this particular device supports video
if (device.hasMediaType(AVMediaTypeVideo)) {
// Finally check the position and confirm we've got the back camera
if(device.position == AVCaptureDevicePosition.back) {
captureDevice = device
if captureDevice != nil {
print("Capture device found")
beginSession()
}
}
}
}
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
`