1

Hi i have to implement save movie file into custom folder, for this i am using NSSavepanel. I am new in NSSavepanel so i am not getting idea that how i add AVCaptureMovieFileOutput object to NSSavePanel

My code is

-(void)doSaveDocument
{

    NSSavePanel *savePanel = [NSSavePanel savePanel];

    [savePanel setTitle:@"Save image"];
    [savePanel setNameFieldStringValue:@"AnnotatedImage.mov"];
    if([savePanel runModal] == NSFileHandlingPanelOKButton)
    {
        [self takeScreenRecording:rect saveAtPath:[savePanel URL]];
        [[NSWorkspace sharedWorkspace] openURL:[savePanel URL]];

        [mMovieFileOutput startRecordingToOutputFileURL:[savePanel URL] recordingDelegate:self];
    }


}
Piyush Dubey
  • 2,416
  • 1
  • 24
  • 39
Gauri rawat
  • 109
  • 1
  • 10
  • How is this related to `xcode` or `osx`? – Popeye Dec 12 '13 at 11:38
  • this is create on Xcode tool n for cocoa application.if you know answer please post i am waiting for accepting it – Gauri rawat Dec 12 '13 at 11:42
  • Just because you are using `xcode` doesn't mean you should be using the `xcode` tag. The `xcode` tag is reserved for issues relating to the `xcode IDE` itself - such as http://stackoverflow.com/questions/6646052/how-can-i-disable-arc-for-a-single-file-in-a-project just because you are using `xcode` doesn't mean you should use this tag. The same is for the `osx` tag it is reserved for issues to do with `osx` - such as http://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x Please don't use these tags for this question as it is not related to ever. – Popeye Dec 12 '13 at 12:04
  • Tagging your questions correctly will benefit you it will show you have an actual understanding of what is going on and tagging correctly will get you the best answer possible - some users will ignore the question if it isn't tagged correctly or will close due to **Minimal understanding** as you clearly don't understand what `xcode` is or what it is used for. Also if this is a `cocoa touch` question include that tag. – Popeye Dec 12 '13 at 12:07

1 Answers1

0
NSArray *paths1 = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        NSString *documentsDirectory1 = [paths1 objectAtIndex:0]; // Get documents folder
        NSString *dataPath = [documentsDirectory1 stringByAppendingPathComponent:@"MyVideo"];
        NSError *error;
        if (![[NSFileManager defaultManager] fileExistsAtPath:dataPath])
            [[NSFileManager defaultManager] createDirectoryAtPath:dataPath withIntermediateDirectories:NO attributes:nil error:&error];

    NSString *stryourfilename=@"Video1";

    dataPath=[NSString stringWithFormat:@"%@/%@.mp4",dataPath,stryourfilename];
    NSData *dat=[NSData dataWithContentsOfURL:videoURL];

    BOOL ok = [[NSFileManager defaultManager] createFileAtPath:dataPath
                                                      contents:nil attributes:nil];

    if (!ok) {

    } else {
        NSFileHandle* myFileHandle = [NSFileHandle fileHandleForWritingAtPath:dataPath];

        [myFileHandle writeData:dat];

        [myFileHandle closeFile];


    }
Senthilkumar
  • 2,471
  • 4
  • 30
  • 50