How to record a video with avfoundation in Swift?
I have tried your code. When set a meaningful filePath
, everything goes fine. Change your filePath
like this and you will get the delegate methods invoked:
let documentsURL = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] let filePath = documentsURL.URLByAppendingPathComponent("temp") // Do recording and save the output to the `filePath` videoFileOutput.startRecordingToOutputFileURL(filePath, recordingDelegate: recordingDelegate)