检索拍摄照片的时间

时间:2019-03-11 21:51:15

标签: ios swift avfoundation

我有一个应用程序,该应用程序应在一个时间间隔(例如200毫秒)内为用户拍摄3张照片。当用户点击按钮时,便会拍摄照片。

现在要确保每200毫秒拍摄一次照片,我本想考虑拍摄照片的时间,但是我在文档上苦苦挣扎。

这是我正在使用的东西:

 func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photo: AVCapturePhoto, error: Error?) {

    print("this is the call Back called when photo is done processing")
    if let error = error {
        print("error occured : \(error.localizedDescription)")
    }
    let dataProvider = CGDataProvider(data: dataImage as CFData)
    let cgImageRef: CGImage! = CGImage(jpegDataProviderSource: dataProvider!, decode: nil, shouldInterpolate: true, intent: .defaultIntent)
    let image = UIImage(cgImage: cgImageRef, scale: 1.0, orientation: UIImage.Orientation.right)

    // do any of the above stuff contain time of when image was created? or can I derive it from any of them
}

1 个答案:

答案 0 :(得分:1)

实施photoOutput(_:didCapturePhotoFor:)并检查Date()