MGLiveBaseDetectViewController.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. //
  2. // MGLiveBaseDetectViewController.h
  3. // MGLivenessDetection
  4. //
  5. // Created by megvii on 16/8/5.
  6. // Copyright © 2016Year megvii. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import <MGBaseKit/MGBaseKit.h>
  10. #import "MGLiveConfig.h"
  11. #import "MGLiveBundle.h"
  12. #import "MGLiveDetectionManager.h"
  13. @interface MGLiveBaseDetectViewController : UIViewController <MGLiveDetectionDelegate, MGVideoDelegate>
  14. /**
  15. * 默认设置的初始化方法
  16. *
  17. * @return 实例化对象
  18. */
  19. - (instancetype)initWithDefauleSetting;
  20. /**
  21. * 视频预览layer, 通过 videoManager 来获取
  22. */
  23. @property (nonatomic, strong) AVCaptureVideoPreviewLayer *previewLayer;
  24. /**
  25. * 视频流管理器 不使用默认配置设置的时候,必须设置该对象
  26. */
  27. @property (nonatomic, strong) MGVideoManager *videoManager;
  28. /**
  29. * 活体检测管理器 不使用默认配置设置的时候,必须设置该对象
  30. */
  31. @property (nonatomic, strong) MGLiveDetectionManager *liveManager;
  32. /**
  33. * 质量检测阶段,抛出错误。
  34. * 在质量检测时,出现错误,会调用该方法,子类重写即可。
  35. * @param error 错误信息
  36. */
  37. - (void)qualitayErrorMessage:(NSString *)error;
  38. /**
  39. * 播放动作提示动画
  40. * 在活体动作改变的时候会被调用,子类需要重写
  41. * @param type 动作类型
  42. * @param step 当前第几个动作
  43. * @param timeOut 剩余超时时间
  44. */
  45. - (void)starAnimation:(MGLivenessDetectionType)type
  46. step:(NSInteger)step
  47. timeOut:(NSUInteger)timeOut;
  48. /**
  49. * 活体检测结束处理
  50. * 在活体检测成功或者失败时候被调用,子类需要重写
  51. * @param type 失败类型
  52. * @param check 活体检测是否成功,如果为 YES,则 type 参数无效
  53. * @param detectionType 活体检测模式
  54. */
  55. - (void)liveDetectionFinish:(MGLivenessDetectionFailedType)type
  56. checkOK:(BOOL)check
  57. liveDetectionType:(MGLiveDetectionType)detectionType;
  58. /**
  59. * 即将启动活体检测
  60. */
  61. - (void)willStatLiveness;
  62. /** 开启活体检测流程 */
  63. - (void)liveFaceDetection;
  64. /**
  65. * 停止视频检测
  66. */
  67. - (void)stopVideoWriter;
  68. /**
  69. * 取消活体检测
  70. */
  71. - (void)cancelDetect;
  72. /**
  73. * 活体检测过程中出现人脸过大情况
  74. */
  75. - (void)detectionFaceToLarge;
  76. /**
  77. * 活体检测过程中人脸过大情况恢复
  78. */
  79. - (void)detectionFaceRecover;
  80. @end