Files
keyboard/keyBoard/Class/AiTalk/VM/KBVoiceRecordManager.h
2026-01-27 13:57:32 +08:00

48 lines
1.4 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// 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/M4A16kmono
@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