zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    1004. Counting Leaves (30)
    51Nod 1272 最大距离 (栈或贪心)
    D
    M
    N
    F
    E
    L
    A. Office Keys ( Codeforces Round #424 (Div. 1, rated, based on VK Cup Finals) )
    K
  • 原文地址:https://www.cnblogs.com/Percy/p/6209174.html
Copyright © 2011-2022 走看看