将视频保存到自定义相册iOS [英] Save Video into Custom Album iOS

查看:188
本文介绍了将视频保存到自定义相册iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用自定义相册保存视频。
我找到了一个链接,但它不起作用自定义文件管理器

How to save video with my custom album . I found one link but it don't work Custom file manager

它给出url值为null。

It gives the url value is null.

[VideoAlbumManager addVideoWithAssetURL:outputFileUrl toAlbumWithName:@"Video Maker"];//outputfileurl is my video url from document directory

对此提出任何建议..

Give any suggestion for this..

推荐答案

您可以使用此链接保存视频..
GitHub链接

You can use this link to save the video.. GitHub Link

将这两个文件导入项目。

Import this two files into your project.


  1. ALAssetsLibrary + CustomPhotoAlbum.h

  2. ALAssetsLibrary + CustomPhotoAlbum.m

然后在您的保存IBAction方法中写下这一行..

Then in your save IBAction method write this lines..

if(UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(outputFilePath)){

    NSURL *muyrl=[NSURL fileURLWithPath:outputFilePath];
    [library saveVideo:muyrl toAlbum:albumName withCompletionBlock:^(NSError *error)
    {
        if (error!=nil) {
            NSLog(@"Big error: %@", [error description]);
        } 
    }];

哪里.. outputfilepath 是你的视频,如果你有网址则保存它与URL名称。
是在.h文件中定义的ALAssetLibrary
albumName 是您的相册名称您想要什么..我希望这对您有帮助。

Where.. outputfilepath is your videopath and if you have url then save it with URL name. library is ALAssetLibrary that define in .h file albumName is your Album name what do you want..I hope this will help you.

这篇关于将视频保存到自定义相册iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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