如何将视频从应用程序文档目录移动到相机胶卷?

发布于 2024-11-02 15:41:23 字数 255 浏览 4 评论 0原文

你好,

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

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

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

tnx

hallo,

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)

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一个人练习一个人 2024-11-09 15:41:23

转移到相机胶卷 - 这里的链接应该会有所帮助。

要查看文档目录中的内容,请使用以下代码片段:

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

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

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 ========");
   }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文