添加语音websocket等,还没测试
This commit is contained in:
56
keyBoard/Class/AiTalk/V/KBAiRecordButton.h
Normal file
56
keyBoard/Class/AiTalk/V/KBAiRecordButton.h
Normal file
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// KBAiRecordButton.h
|
||||
// keyBoard
|
||||
//
|
||||
// Created by Mac on 2026/1/15.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// 录音按钮状态
|
||||
typedef NS_ENUM(NSInteger, KBAiRecordButtonState) {
|
||||
KBAiRecordButtonStateNormal, // 正常状态
|
||||
KBAiRecordButtonStateRecording, // 录音中
|
||||
KBAiRecordButtonStateDisabled // 禁用
|
||||
};
|
||||
|
||||
@class KBAiRecordButton;
|
||||
|
||||
/// 录音按钮代理
|
||||
@protocol KBAiRecordButtonDelegate <NSObject>
|
||||
@optional
|
||||
/// 开始按下
|
||||
- (void)recordButtonDidBeginPress:(KBAiRecordButton *)button;
|
||||
/// 结束按下
|
||||
- (void)recordButtonDidEndPress:(KBAiRecordButton *)button;
|
||||
/// 按下被取消(如手指滑出)
|
||||
- (void)recordButtonDidCancelPress:(KBAiRecordButton *)button;
|
||||
@end
|
||||
|
||||
/// 按住说话按钮
|
||||
/// 支持长按手势和波形动画
|
||||
@interface KBAiRecordButton : UIView
|
||||
|
||||
@property(nonatomic, weak) id<KBAiRecordButtonDelegate> delegate;
|
||||
|
||||
/// 当前状态
|
||||
@property(nonatomic, assign) KBAiRecordButtonState state;
|
||||
|
||||
/// 按钮标题(正常状态)
|
||||
@property(nonatomic, copy) NSString *normalTitle;
|
||||
|
||||
/// 按钮标题(录音状态)
|
||||
@property(nonatomic, copy) NSString *recordingTitle;
|
||||
|
||||
/// 主色调
|
||||
@property(nonatomic, strong) UIColor *tintColor;
|
||||
|
||||
/// 更新音量(用于波形动画)
|
||||
/// @param rms 音量 RMS 值 (0.0 - 1.0)
|
||||
- (void)updateVolumeRMS:(float)rms;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Reference in New Issue
Block a user