新增声音卡

This commit is contained in:
liyuhua
2023-08-10 16:25:34 +08:00
parent 8bda1a7f8a
commit f44942dc72
159 changed files with 7877 additions and 2117 deletions

View File

@@ -7,7 +7,7 @@
#import "UploadFile.h"
#import <Qiniu/QiniuSDK.h>
#import <AFNetworking.h>
@implementation UploadFile
///
@@ -33,5 +33,20 @@
}
} option:nil];
}
+(void)downloadAudioWithFileName:(NSString *)fileName musicUrl:(NSString *)musicUrl mainFileName:(NSString *)mainFileName completion:(void (^) (BOOL isSuccess, NSString *editAudioPath))completion {
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:musicUrl]];
NSURLSessionDownloadTask *download = [manager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull downloadProgress) {
} destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
NSString *filePath = [[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) safeObjectAtIndex1:0] stringByAppendingPathComponent:mainFileName] stringByAppendingPathComponent:fileName];
return [NSURL fileURLWithPath:filePath];
} completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
if (!error) {
completion(YES, filePath.path);
} else {
completion(NO, nil);
}
}];
[download resume];
}
@end