【问题标题】:How to move video from application documents directory to camera roll?如何将视频从应用程序文档目录移动到相机胶卷?
【发布时间】:2011-04-20 14:33:50
【问题描述】:

你好,

我找到了一些 iphone-camera-video-saving avfoundation 代码示例 通过网络(我也在尝试编写自己的代码但尚未完成)

此类示例处理并保存视频(通过 AVAssetWriter) 从相机捕获输入到位于文档目录中的文件 (我认为这是唯一的选择?)

但是现在 - 我什至看不到要检查的目录中的文件 如果我的视频在那里;我想我应该把这样的视频文件移到 '相机胶卷',怎么做??

tnx

【问题讨论】:

    标签: iphone ios camera avfoundation


    【解决方案1】:

    转移到相机胶卷 - 这里有一个 link 应该会有所帮助。

    要查看 Documents 目录中的内容,请使用代码 sn-p:

     -(void) dump {
    
        NSString *docsDir = [NSHomeDirectory() stringByAppendingPathComponent:  @"Documents"];
        NSFileManager *localFileManager = [NSFileManager defaultManager];
        NSDirectoryEnumerator *dirEnum =
            [localFileManager enumeratorAtPath:docsDir];
        NSError *error=nil;
    
        NSLog(@" Documents Directory: %@", docsDir);
        NSString *file;
        while (file = [dirEnum nextObject]) {
            NSString *fullPath = [NSString stringWithFormat:@"%@/%@", docsDir,file];
            NSDictionary *attrs = [localFileManager attributesOfItemAtPath:fullPath error:&error];
            if ( error ) {
                NSLog(@" error - %@", error);
            } else {
              //NSLog(@" file : %@", file);
              NSInteger fsiz = [attrs fileSize];
              NSString *ftyp = [attrs fileType];
              NSDate   *fmod = [attrs fileModificationDate];
              NSLog(@"  %9d : %@ : %@ : %@",  fsiz, file, ftyp, fmod );
             }
         }
        NSLog(@" ======  End Documents Directory ========");
       }
    

    【讨论】:

    • tnx tu 你,特别是对于 sn-p - 它会很有帮助 - 在链接中它是关于图像而不是视频,[但现在我确实有 UISaveVideoAtPathToSavedPhotosAlbum - 如果它有效,那就是什么我需要:)]
    • (由于引用了纳博科夫,我是('我自己是')'高级'纳博科夫学者)
    • 我对纳博科夫几乎一无所知,除了那句话,这对我来说很有意义。
    猜你喜欢
    • 2013-03-21
    • 1970-01-01
    • 2015-05-12
    • 1970-01-01
    • 2015-06-11
    • 1970-01-01
    • 2016-05-01
    • 2015-01-06
    • 2018-05-09
    相关资源
    最近更新 更多