YOUPAIBBVideoResponseVC.m 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. //
  2. // YOUPAIBBVideoResponseVC.m
  3. // VQU
  4. //
  5. // Created by Elaine on 2021/10/28.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAIBBVideoResponseVC.h"
  9. #import "YOUPAIBBVideoResponseView.h"
  10. #import "YOUPAIBBCustomSystomNotification.h"
  11. @interface YOUPAIBBVideoResponseVC ()<BBResponseViewDelegate>
  12. @property(nonatomic,strong)YOUPAIBBVideoResponseView* youpaipresponseView;
  13. @end
  14. @implementation YOUPAIBBVideoResponseVC
  15. -(void)dealloc{
  16. [[NSNotificationCenter defaultCenter] removeObserver:self];
  17. }
  18. - (void)cancelVideoNotification{
  19. [self youpaifvideoEnd:BBCustomSystomNotificationTypeWithCancelVideo];
  20. }
  21. - (void)viewDidLoad {
  22. [super viewDidLoad];
  23. [self youpaifsetupResponseView];
  24. /// 对方已取消视频电话,接收通知
  25. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(cancelVideoNotification) name:@"CancelVideo" object:nil];
  26. }
  27. - (void)youpaifsetupResponseView{
  28. self.youpaipresponseView = [[YOUPAIBBVideoResponseView alloc]initWithModel:self.youpaipvideoModel];
  29. self.youpaipresponseView.delegate = self;
  30. [self.view addSubview:self.youpaipresponseView];
  31. }
  32. //子类实现的代理
  33. - (void)youpaifresponseConnent{
  34. }
  35. - (void)youpaifcancelBtnClick{
  36. [self youpaifvideoEnd:2];
  37. /// 拒绝接听
  38. [YOUPAIBBCustomSystomNotification youpaifcustomSystomNotificationWithModel:self.youpaipvideoModel type:BBCustomSystomNotificationTypeWithRefuseCallVideo block:^(NSError * _Nonnull error) {
  39. }];
  40. }
  41. //v1.1.2 增加视频权限判断
  42. - (void)youpaifconfirmBtnClick{
  43. /// 接听
  44. [YOUPAIBBCustomSystomNotification youpaifcustomSystomNotificationWithModel:self.youpaipvideoModel type:BBCustomSystomNotificationTypeWithAnswerCallVideo block:^(NSError * _Nonnull error) {
  45. if (!error) {
  46. [self youpaifvideoStart];
  47. }
  48. }];
  49. [UCAuthorityManager cameraAuthority:^{
  50. }denied:^{
  51. UIAlertController *systemAlert = [UIAlertController alertControllerWithTitle:@"请在iphone的“设置-隐私-相机”选项中,允许APP访问您的相机。" message:nil preferredStyle:UIAlertControllerStyleAlert];
  52. UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil];
  53. [systemAlert addAction:action];
  54. [self presentViewController:systemAlert animated:YES completion:nil];
  55. }];
  56. }
  57. - (void)youpaifvideoStart{ //视频开始
  58. [super youpaifvideoStart];
  59. [self.youpaipresponseView removeFromSuperview];
  60. }
  61. //1主动取消 2。拒绝 3.超时 4.被叫者挂断 5.主叫者挂断 6.费用不足
  62. - (void)youpaifvideoEnd:(NSInteger)type{
  63. [super youpaifvideoEnd:type];
  64. if (type==1) {
  65. [ZCHUDHelper showTitle:@"已取消"];
  66. }else if (type==2){
  67. [ZCHUDHelper showTitle:@"已拒绝"];
  68. }else if (type==3){
  69. [ZCHUDHelper showTitle:@"超时无应答"];
  70. }else if (type==4){
  71. [ZCHUDHelper showTitle:@"通话已结束"];
  72. }else if (type==5){
  73. [ZCHUDHelper showTitle:@"对方已挂断"];
  74. }else if (type==10){
  75. [ZCHUDHelper showTitle:@"检测到视频通话违规系统,请严格遵守平台相关规定" showtime:5];
  76. }else if (type==11){
  77. [ZCHUDHelper showTitle:@"检测到视频通话违规系统挂断,请严格遵守平台相关规定" showtime:5];
  78. }else if (type== BBCustomSystomNotificationTypeWithCancelVideo) {
  79. [ZCHUDHelper showTitle:[YOUPAIBBCustomSystomNotification youpaifnotificationTitleWithType:type]];
  80. }
  81. }
  82. @end