解决了语音上传到问题,接下来要解决下载播放问题
This commit is contained in:
76
msext/Class/Utils/QiniuManager.h
Normal file
76
msext/Class/Utils/QiniuManager.h
Normal file
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// QiniuManager.h
|
||||
// msext
|
||||
//
|
||||
// Created on June 15, 2025.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* 上传完成后的回调
|
||||
* @param key 文件在七牛云中的key
|
||||
* @param error 错误信息,如果上传成功则为nil
|
||||
*/
|
||||
typedef void(^QiniuUploadCompletionHandler)(NSString * _Nullable key, NSError * _Nullable error);
|
||||
|
||||
/**
|
||||
* 下载完成后的回调
|
||||
* @param filePath 下载文件的本地路径
|
||||
* @param error 错误信息,如果下载成功则为nil
|
||||
*/
|
||||
typedef void(^QiniuDownloadCompletionHandler)(NSString * _Nullable filePath, NSError * _Nullable error);
|
||||
|
||||
/**
|
||||
* 进度回调
|
||||
* @param progress 进度值,范围0-1
|
||||
*/
|
||||
typedef void(^QiniuProgressHandler)(float progress);
|
||||
|
||||
@interface QiniuManager : NSObject
|
||||
|
||||
/**
|
||||
* 获取QiniuManager的单例
|
||||
* @return QiniuManager实例
|
||||
*/
|
||||
+ (instancetype)sharedManager;
|
||||
|
||||
/**
|
||||
* 初始化七牛云SDK
|
||||
*/
|
||||
- (void)setupQiniuSDK;
|
||||
|
||||
/**
|
||||
* 上传本地音频文件到七牛云
|
||||
* @param filePath 本地文件路径
|
||||
* @param fileName 上传后的文件名(不含路径)
|
||||
* @param progressHandler 上传进度回调
|
||||
* @param completionHandler 上传完成回调
|
||||
*/
|
||||
- (void)uploadAudioFile:(NSString *)filePath
|
||||
fileName:(NSString *)fileName
|
||||
progressHandler:(nullable QiniuProgressHandler)progressHandler
|
||||
completionHandler:(QiniuUploadCompletionHandler)completionHandler;
|
||||
|
||||
/**
|
||||
* 从七牛云下载音频文件
|
||||
* @param key 文件在七牛云中的key
|
||||
* @param progressHandler 下载进度回调
|
||||
* @param completionHandler 下载完成回调
|
||||
*/
|
||||
- (void)downloadAudioFile:(NSString *)key
|
||||
progressHandler:(nullable QiniuProgressHandler)progressHandler
|
||||
completionHandler:(QiniuDownloadCompletionHandler)completionHandler;
|
||||
|
||||
/**
|
||||
* 根据key获取七牛云文件的URL
|
||||
* @param key 文件在七牛云中的key
|
||||
* @return 完整的URL字符串
|
||||
*/
|
||||
- (NSString *)getFileUrlWithKey:(NSString *)key;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Reference in New Issue
Block a user