Commit fa7c97b44916b8d32618c345b3b27f2ffb081c34
1 parent
eac22a84
提交0.1.21_添加直接根据路径上传
Showing
3 changed files
with
42 additions
and
1 deletions
CNLiveUploadManager.podspec
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | 8 | ||
| 9 | Pod::Spec.new do |s| | 9 | Pod::Spec.new do |s| |
| 10 | s.name = 'CNLiveUploadManager' | 10 | s.name = 'CNLiveUploadManager' |
| 11 | - s.version = '0.1.20' | 11 | + s.version = '0.1.21' |
| 12 | s.summary = '压缩上传,组件化中加入新参数加入outPath,不在直接取' | 12 | s.summary = '压缩上传,组件化中加入新参数加入outPath,不在直接取' |
| 13 | 13 | ||
| 14 | # This description is used to generate tags and improve search results. | 14 | # This description is used to generate tags and improve search results. |
CNLiveUploadManager/Classes/CNLiveUploadManager.h
| @@ -137,6 +137,12 @@ typedef void (^progressHandlerBlock)(float progress);//进度 | @@ -137,6 +137,12 @@ typedef void (^progressHandlerBlock)(float progress);//进度 | ||
| 137 | /// 请求token 单个视频上传 (video - 七牛短视频压缩 - 限制 - 筛选) | 137 | /// 请求token 单个视频上传 (video - 七牛短视频压缩 - 限制 - 筛选) |
| 138 | + (void)uploadRequestWhithPLShortVideoType:(CNLiveUploadType)type outputPath:(NSString *)outputPath url:(NSString *)url dic:(NSDictionary *)dic asset:(id)asset limitType:(AppPhototLimitType)limitType transcode:(transcodeHandlerBlock) transcode progress:(progressHandlerBlock)progress success:(successModelBlock)success failure:(failureModelBlock)failure; | 138 | + (void)uploadRequestWhithPLShortVideoType:(CNLiveUploadType)type outputPath:(NSString *)outputPath url:(NSString *)url dic:(NSDictionary *)dic asset:(id)asset limitType:(AppPhototLimitType)limitType transcode:(transcodeHandlerBlock) transcode progress:(progressHandlerBlock)progress success:(successModelBlock)success failure:(failureModelBlock)failure; |
| 139 | 139 | ||
| 140 | +/// 请求token 单个视频上传 (直接根据路径上传) | ||
| 141 | ++ (void)uploadShootVideoType:(CNLiveUploadType)type outputPath:(NSString *)outputPath url:(NSString *)url dic:(NSDictionary *)dic progress:(progressHandlerBlock)progress success:(successModelBlock)success failure:(failureModelBlock)failure; | ||
| 142 | + | ||
| 143 | + | ||
| 144 | +#pragma mark - 压缩+设置方法 | ||
| 145 | + | ||
| 140 | /// 短视频分辨率转码导出 | 146 | /// 短视频分辨率转码导出 |
| 141 | + (void )zipVideoWithAsset:(id) asset outputPath:(NSString *)outputPath limitType:(AppPhototLimitType)limitType progressCount:(void(^)(float progress)) progressCount success:(void(^)(NSURL * url))success failure:(void(^)(void))failure; | 147 | + (void )zipVideoWithAsset:(id) asset outputPath:(NSString *)outputPath limitType:(AppPhototLimitType)limitType progressCount:(void(^)(float progress)) progressCount success:(void(^)(NSURL * url))success failure:(void(^)(void))failure; |
| 142 | 148 |
CNLiveUploadManager/Classes/CNLiveUploadManager.m
| @@ -1918,6 +1918,41 @@ static CNLiveUploadManager *_uploadManager; | @@ -1918,6 +1918,41 @@ static CNLiveUploadManager *_uploadManager; | ||
| 1918 | 1918 | ||
| 1919 | } | 1919 | } |
| 1920 | 1920 | ||
| 1921 | +/// 请求token 单个视频上传 (直接根据路径上传) | ||
| 1922 | ++ (void)uploadShootVideoType:(CNLiveUploadType)type outputPath:(NSString *)outputPath url:(NSString *)url dic:(NSDictionary *)dic progress:(progressHandlerBlock)progress success:(successModelBlock)success failure:(failureModelBlock)failure { | ||
| 1923 | + | ||
| 1924 | + if (type == CNLiveUploadTypeQN) { //七牛上传 | ||
| 1925 | + [[HttpService service] sendRequestWithHttpMethod:E_HTTP_REQUEST_METHOD_POST URLPath:url parameters:dic isCache:NO CheckParam:nil completionHandler:^(id data, NSError *error) { | ||
| 1926 | + | ||
| 1927 | + NSDictionary *dic = (NSDictionary *)data; | ||
| 1928 | + if (!error && [dic containsObjectForKey:@"token"]) { | ||
| 1929 | + NSString *token = dic[@"token"]; | ||
| 1930 | + [[CNLiveUploadManager shareInsance] qnUploadVideoWithToken:token file:outputPath progress:progress success:success failure:failure]; | ||
| 1931 | + | ||
| 1932 | + } else {//请求token失败 | ||
| 1933 | + NSInteger code = error.code; | ||
| 1934 | + NSString * errorStr = error.localizedDescription; | ||
| 1935 | + NSError *error; | ||
| 1936 | + if (code == - 1001 || code == -1009) { | ||
| 1937 | + error = [NSError errorWithDomain:@"网络连接错误,请检查您的网络" code:code userInfo:@{NSLocalizedDescriptionKey:@"网络连接错误,请检查您的网络"}]; | ||
| 1938 | + }else { | ||
| 1939 | + error = [NSError errorWithDomain:errorStr code:code userInfo:@{NSLocalizedDescriptionKey:errorStr}]; | ||
| 1940 | + } | ||
| 1941 | + !failure ? : failure(nil,error); | ||
| 1942 | + return; | ||
| 1943 | + } | ||
| 1944 | + | ||
| 1945 | + }]; | ||
| 1946 | + | ||
| 1947 | + }else if (type == CNLiveUploadTypeKS) { | ||
| 1948 | + | ||
| 1949 | + }else{ | ||
| 1950 | + | ||
| 1951 | + } | ||
| 1952 | + | ||
| 1953 | + | ||
| 1954 | +} | ||
| 1955 | + | ||
| 1921 | 1956 | ||
| 1922 | #pragma mark - 私有方法 | 1957 | #pragma mark - 私有方法 |
| 1923 | ///筛选 是否视频在限制内 | 1958 | ///筛选 是否视频在限制内 |