iOS保存视频到相册


保存视频:

1在工程中添加这个框架:

#import <AssetsLibrary/AssetsLibrary.h>

 

2

    NSBundle *bundle=[NSBundle mainBundle];

    NSString *videoPath=[bundle pathForResource:@"test" ofType:@"mp4"];//是本地的路径就好

    videoPath是你视频文件的路径,我这里是加载工程中的

    ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];

    [library writeVideoAtPathToSavedPhotosAlbum:[NSURL fileURLWithPath:videoPath]

                                completionBlock:^(NSURL *assetURL, NSError *error) {

                                    if (error) {

                                        NSLog(@"Save video fail:%@",error);

                                    } else {

                                        NSLog(@"Save video succeed.");

                                    }

                                }];

参考文献:http://blog.csdn.net/kaven_lv/article/details/11483239


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM