rFlex / SCRecorder

iOS camera engine with Vine-like tap to record, animatable filters, slow motion, segments editing
Apache License 2.0
3.06k stars 583 forks source link

ExportSession Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" #308

Open mkaya93 opened 8 years ago

mkaya93 commented 8 years ago

Hi,

I'm trying to export my video but when I try export 3rd or more video thats giving me that error.

Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSUnderlyingError=*********{Error Domain=NSOSStatusErrorDomain Code=-12983 "(null)"}, NSLocalizedFailureReason=An unknown error occurred (-12983), NSLocalizedDescription=The operation could not be completed})

Also this is my code.

let assetExportSession: SCAssetExportSession = SCAssetExportSession(asset: self.avAsset)
            assetExportSession.outputUrl = self.recordSession.outputUrl
            assetExportSession.outputFileType = AVFileTypeMPEG4
            assetExportSession.videoConfiguration.preset  = SCPresetLowQuality
            //assetExportSession.videoConfiguration.preset = AVAssetExportPresetLowQuality
            assetExportSession.exportAsynchronouslyWithCompletionHandler({ 
                if assetExportSession.error == nil {
                    objUploadVideoPath = "\(assetExportSession.outputUrl!)"
                    print(objUploadVideoPath)
                    uploadVideoFeed()
                    self.performSegueWithIdentifier("showVideopostSegue", sender: self.imgCapturedImage)
                } else {
                    print(assetExportSession.error)
                }
            })
mkaya93 commented 8 years ago

Problem is solved with self.recordSession.deinitialize()

mitchellporter commented 8 years ago

@mkaya93 Glad you figured it out. AVFoundation is very particular about how many instances of certain classes can exist in memory.

guodong000 commented 8 years ago

@mkaya93 where to use self.recordSession.deinitialize()???

mkaya93 commented 8 years ago

@guodong000 when you closing the view you have to use this.

mitchellporter commented 8 years ago

@guodong000 He's most likely calling it in viewWillDisappear