I am trying to figure out how to record a video using AVFoundation in Swift. I have got as far as creating a custom camera but I only figured out how to take still pictures with
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)