Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Youseef Al Taher
Courses Plus Student 842 PointsAVFoundation Video Recording
Hey,
So I am trying to record video in my app using AVFoundation. My code below isn't compiling. It keeps telling me:
'Cannot invoke startRecordingToOutputFileURL with an argument of list type ('NSURL, AVCaptureVideoDataOutputSampleBufferDelegate.protocol)
Here is the code:
@IBAction func recordButton(sender: AnyObject) {
let videoxDelegate = AVCaptureVideoDataOutputSampleBufferDelegate.self
let fileOutput = AVCaptureMovieFileOutput()
captureSession.addOutput(fileOutput)
let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as! NSString
let outputPath = "\(documentsPath)/output.mov"
let outputFileUrl = NSURL(fileURLWithPath: outputPath)
// ***** HERE IS THE PROBLEM
fileOutput.startRecordingToOutputFileURL(outputFileUrl, videoxDelegate )
}
Hope someone can help, i've been stuck for a while!
Thanks in advance! Yousef