当我尝试在表视图中的 cellForAtIndex 中生成缩略图时,我收到此错误:

错误域= AVFoundationErrorDomain代码= -11800“操作无法完成”UserInfo = {NSUnderlyingError = 0x170843ae0 ,NSLocalizedFailureReason =发生未知错误(-308), NSLocalizedDescription =操作无法完成}:

VideoUrl缩略图:https://google.com/abc.mp4

但如果我尝试上面给出的静态URL,它工作正常,没有任何错误 .

这是缩略图生成器代码:

/*=========================================================================
     Generate Image from Video Frame
     =========================================================================*/
    func fetchFirstFrameOf(urlString: String,completion:@escaping (_ image:UIImage?)->()) {
        var filePath = URL(string: urlString)
        print(" FETCH FRAME urlString:-",urlString )
        if urlString.hasPrefix("VID-") {
            let path = NIDbUtility.getPath(fileName:urlString, forVideo_ImageFromMainApp: true)
            print("dbPath video FETCH FRAME path:-",path )
            filePath = URL(fileURLWithPath: path)
        }

        let asset = AVURLAsset(url: filePath!)
        let imgGenerator = AVAssetImageGenerator(asset: asset)
        imgGenerator.appliesPreferredTrackTransform = true
        imgGenerator.requestedTimeToleranceAfter = kCMTimeZero
        imgGenerator.requestedTimeToleranceBefore = kCMTimeZero
        do {
            let cgImage = try imgGenerator.copyCGImage(at: CMTimeMake(0, 1), actualTime: nil)
            let thumbnail = UIImage(cgImage: cgImage)
            completion(thumbnail)
        } catch let error {
            print("*** Error generating thumbnail: \(error): \(urlString)")
            completion(nil)
        }
    }

谢谢