Я пытаюсь добавить еще один поверх слоя AVCaptureVideoPreviewLayer.Я попытался добавить его над слоем предварительного просмотра, в viewdidload и некоторых других вещах.все еще нет радостиУ кого-нибудь есть идеи?
func configureCaptureSession() {
captureSession.sessionPreset = AVCaptureSession.Preset.photo
let deviceDiscoverySession =
AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInDualCamera],
mediaType: AVMediaType.video, position: .unspecified)
for device in deviceDiscoverySession.devices {
if device.position == .back {
rearCam = device
} else if device.position == .front {
frontCam = device
}
}
currentDevice = rearCam
guard let captureDeviceInput = try? AVCaptureDeviceInput(device:
currentDevice) else {
return
}
wheelOverlay.image = UIImage(named: "wheel")
wheelOverlayLayer.contents = wheelOverlay
stillPhotoOutput = AVCapturePhotoOutput()
captureSession.addInput(captureDeviceInput)
captureSession.addOutput(stillPhotoOutput)
view.layer.addSublayer(wheelOverlayLayer)
cameraPreviewLayer = AVCaptureVideoPreviewLayer(session:
captureSession)
view.layer.insertSublayer(cameraPreviewLayer!, below:
wheelOverlayLayer)
cameraPreviewLayer?.videoGravity =
AVLayerVideoGravity.resizeAspectFill
cameraPreviewLayer?.frame = view.layer.frame
print("Capture session setup")
// view.layer.addSublayer(wheelOverlayLayer)
// view.layer.insertSublayer(wheelOverlayLayer, above:
cameraPreviewLayer)
captureSession.startRunning()
}