//
//  NXDeviceDetect.h
//  NXKit
//
//  Created by wangran on 2022/4/7.
//  Copyright © 2022 neuvision. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>

@protocol NXDeviceDetectDelegate <NSObject>
@optional

/// Volume callback during voice detection
/// @param value  volume value
- (void)voiceVolume:(float)value;

@end

NS_ASSUME_NONNULL_BEGIN

@interface NXDeviceDetect : NSObject
/// device detect delegate
@property (nonatomic, weak) id<NXDeviceDetectDelegate> delegate;

/// audio mute state on/off, default NO,
@property (nonatomic, assign) BOOL mute;
/// audio speaker state on/off, default YES.
@property (nonatomic, assign) BOOL speakerOn;

/// camera state on/off, default YES.
@property (nonatomic, assign) BOOL cameraOn;
/// camera postion, front/back.
@property (nonatomic, assign) NXVideoCameraPosition position;
/// front camera image mirror, default NO.
@property (nonatomic, assign) BOOL isMirror;
/// camera image preview.
@property (nonatomic, strong) UIView *preview;

/// record voice filepath
@property (nonatomic, copy) NSString *recordFilePath;

/// start device detect.
- (void)startDetect;
/// end device detect.
- (void)stopDetect;

/// start record audio voice.
- (void)startRecordVoice;
/// stop record audio voice.
- (void)stopRecordVoice;

/// start play voice.
/// @param path voice file path
- (void)startPlayVoice:(NSString *)path;
/// stop play voice.
- (void)stopPlayVoice;

@end

NS_ASSUME_NONNULL_END
