48 lines
1.4 KiB
C
48 lines
1.4 KiB
C
|
|
//
|
|||
|
|
// KBVoiceRecordManager.h
|
|||
|
|
// keyBoard
|
|||
|
|
//
|
|||
|
|
// Created by Mac on 2026/1/26.
|
|||
|
|
//
|
|||
|
|
|
|||
|
|
#import <Foundation/Foundation.h>
|
|||
|
|
|
|||
|
|
NS_ASSUME_NONNULL_BEGIN
|
|||
|
|
|
|||
|
|
typedef NS_ENUM(NSInteger, KBVoiceRecordManagerErrorCode) {
|
|||
|
|
KBVoiceRecordManagerErrorPermissionDenied = 1,
|
|||
|
|
KBVoiceRecordManagerErrorSessionFailed = 2,
|
|||
|
|
KBVoiceRecordManagerErrorRecorderFailed = 3,
|
|||
|
|
KBVoiceRecordManagerErrorTooShort = 4,
|
|||
|
|
KBVoiceRecordManagerErrorInterrupted = 5,
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
@class KBVoiceRecordManager;
|
|||
|
|
|
|||
|
|
@protocol KBVoiceRecordManagerDelegate <NSObject>
|
|||
|
|
@optional
|
|||
|
|
- (void)voiceRecordManagerDidStartRecording:(KBVoiceRecordManager *)manager;
|
|||
|
|
- (void)voiceRecordManager:(KBVoiceRecordManager *)manager
|
|||
|
|
didFinishRecordingAtURL:(NSURL *)fileURL
|
|||
|
|
duration:(NSTimeInterval)duration;
|
|||
|
|
- (void)voiceRecordManagerDidCancelRecording:(KBVoiceRecordManager *)manager;
|
|||
|
|
- (void)voiceRecordManagerDidRecordTooShort:(KBVoiceRecordManager *)manager;
|
|||
|
|
- (void)voiceRecordManager:(KBVoiceRecordManager *)manager
|
|||
|
|
didFailWithError:(NSError *)error;
|
|||
|
|
@end
|
|||
|
|
|
|||
|
|
/// 录音管理器(AAC/M4A,16k,mono)
|
|||
|
|
@interface KBVoiceRecordManager : NSObject
|
|||
|
|
|
|||
|
|
@property(nonatomic, weak) id<KBVoiceRecordManagerDelegate> delegate;
|
|||
|
|
@property(nonatomic, assign) NSTimeInterval minRecordDuration;
|
|||
|
|
@property(nonatomic, assign, readonly, getter=isRecording) BOOL recording;
|
|||
|
|
|
|||
|
|
- (void)startRecording;
|
|||
|
|
- (void)stopRecording;
|
|||
|
|
- (void)cancelRecording;
|
|||
|
|
|
|||
|
|
@end
|
|||
|
|
|
|||
|
|
NS_ASSUME_NONNULL_END
|