提交
This commit is contained in:
@@ -33,6 +33,9 @@ typedef NS_ENUM(NSInteger, AudioRecorderState) {
|
||||
/// 录音进度更新
|
||||
- (void)qxAudioRecorderView:(QXAudioRecorderView *)recorderView didUpdateProgress:(NSTimeInterval)progress totalDuration:(NSTimeInterval)totalDuration;
|
||||
|
||||
/// 开始认证
|
||||
-(void)didClickAuthWithFileUrl:(NSURL*)audioFileUrl;
|
||||
|
||||
@end
|
||||
|
||||
@interface QXAudioRecorderView : UIView
|
||||
|
||||
@@ -224,33 +224,24 @@
|
||||
|
||||
-(void)authAction{
|
||||
///去认证
|
||||
///去认证
|
||||
if ((int)self.totalDuration < 5) {
|
||||
showToast(@"录音时长不得小于60秒");
|
||||
NSInteger minSecond = 60;
|
||||
#if DEBUG
|
||||
minSecond = 5;
|
||||
# else
|
||||
minSecond = 60;
|
||||
#endif
|
||||
if ((int)self.totalDuration < minSecond) {
|
||||
NSString *toast = [NSString stringWithFormat:@"录音时长不得小于%ld秒",minSecond];
|
||||
showToast(toast);
|
||||
return;
|
||||
}
|
||||
if (self.originalAudioFileURL==nil) {
|
||||
showToast(@"录制文件不存在");
|
||||
return;
|
||||
}
|
||||
NSData *data = [NSData dataWithContentsOfURL:self.originalAudioFileURL];
|
||||
@weakify(self)
|
||||
showLoadingInView(self.viewController.view);
|
||||
[[QXCOSUploadManager shareManager] audioUploadFile:data withObjectKey:self.originalAudioFileURL.lastPathComponent complete:^(NSString * _Nonnull fileUrl, QXCOSUploadImageState state) {
|
||||
@strongify(self);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
hideLoadingInView(self.viewController.view);
|
||||
if ([fileUrl isExist]) {
|
||||
[QXMineNetwork singerAuthWithSong:fileUrl successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"上传成功");
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(@"上传失败");
|
||||
}];
|
||||
}else{
|
||||
showToast(@"上传失败");
|
||||
}
|
||||
});
|
||||
}];
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickAuthWithFileUrl:)]) {
|
||||
[self.delegate didClickAuthWithFileUrl:self.originalAudioFileURL];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Gesture Handlers
|
||||
|
||||
Reference in New Issue
Block a user