如何将视频从应用程序文档目录移动到相机胶卷? [英] How to move video from application documents directory to camera roll?

查看:140
本文介绍了如何将视频从应用程序文档目录移动到相机胶卷?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hallo,

我发现一些iphone摄像机视频保存avfoundation代码示例
在网络上(也im我自己写我自己代码,但尚未完成)

i have found some iphone-camera-video-saving avfoundation code examples over the net (and also im tryin to write my own code but not finished it yet)

这样的示例处理并保存视频(通过AVAssetWriter)
从相机捕获输入到位于documments目录中的文件
(我假设是唯一的选项?)

such examples process and do save the video (through AVAssetWriter) from the camera capture input to file located in documments directory (which i assume is the only option?)

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

but now - i do not even can see files in such directory to check if my video is there; i think i should move such video file to 'camera roll', how to do that??

tnx

推荐答案

转移到相机胶卷 - 这里是

Transfer to Camera Roll - here's a link that should help.

要查看您的Documents目录中的内容,请查看以下代码段:

To see what's in your Documents directory, here's a code snippet:

 -(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 ========");
   }

这篇关于如何将视频从应用程序文档目录移动到相机胶卷?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆