osx - Cannot record movie using AVCaptureMovieFileoutput -
i trying record video , i'm getting error
cannot record url <#file url> because not file url.
i define destination url follows:
nsstring *path = [[nsstring alloc] init]; path = @"/users/me/documents/my fols/recording_try/newmovie.mov"; nsurl *dest = [[nsurl alloc] initwithstring:[path stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]]; then after creating session, input , output objects. tried recording this.
mmoviefileoutput = [[avcapturemoviefileoutput alloc] init] ; [msession addoutput:mmoviefileoutput]; [mmoviefileoutput startrecordingtooutputfileurl:dest recordingdelegate:self]; i have started running session, tried using begin , comitconfiguration, etc. every time run error like:
[avcapturemoviefileoutput startrecordingtooutputfileurl:recordingdelegate:] - cannot record url /users/me/documents/my%20fols/recording_try/newmovie.mov because not file url. i don't know i'm going wrong... please help???
thanks in advance...
try this:
// variable names should start lower case letters // also, let's as can auto-released objects // don't have worry leaking (if we're not using arc) nsstring *path = [nsstring stringwithstring: @"/users/me/documents/my fols/recording_try"]; nsurl *dest = [nsurl urlwithstring:[path stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]]; if(dest == nil) { nslog( @"does not appear valid nsurl object" ); return; } nserror * error = nil; if([[nsfilemanager defaultmanager] createdirectoryaturl: dest withintermediatedirectories: yes attributes: nil error: &error] == yes) { dest = [dest urlbyappendingpathcomponent: @"newmovie.mov"]; // can create session plus input , output objects // within block } else { nslog( @"was not able create directory contains path %@ - error %@", path, [error localizeddescription] ); }
Comments
Post a Comment