YOUPAIBBVideoRequestVC.m 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //
  2. // YOUPAIBBVideoRequestVC.m
  3. // VQU
  4. //
  5. // Created by Elaine on 2021/10/28.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAIBBVideoRequestVC.h"
  9. #import "YOUPAIBBVideoRequestView.h"
  10. #import "YOUPAIBBCustomSystomNotification.h"
  11. @interface YOUPAIBBVideoRequestVC ()<BBResquestViewDelegate>
  12. @property(nonatomic,strong)YOUPAIBBVideoRequestView* youpaiprequestView;
  13. @end
  14. @implementation YOUPAIBBVideoRequestVC
  15. - (void)dealloc{
  16. [[NSNotificationCenter defaultCenter] removeObserver:self];
  17. }
  18. - (void)youpaifrefuseCallVideoNotification{
  19. [self youpaifvideoEnd:BBCustomSystomNotificationTypeWithRefuseCallVideo];
  20. }
  21. - (void)youpaifanswerCallVideoNotification{
  22. [self youpaifvideoStart];
  23. }
  24. - (void)viewDidLoad{
  25. [super viewDidLoad];
  26. [self youpaifsetupResquestView];
  27. /// 对方拒绝接听视频,接听通知
  28. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youpaifrefuseCallVideoNotification) name:@"RefuseCallVideo" object:nil];
  29. //同意接听视频,接听通知
  30. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youpaifanswerCallVideoNotification) name:@"AnswerCallVideo" object:nil];
  31. [self youpaifrequestSuccess];
  32. }
  33. - (void)youpaifsetupResquestView{
  34. self.youpaiprequestView = [[YOUPAIBBVideoRequestView alloc] initWithModel:self.youpaipvideoModel];
  35. self.youpaiprequestView.delegate = self;
  36. [self.view addSubview:self.youpaiprequestView];
  37. }
  38. - (void)youpaifcancelBtnClick{ //点击了取消按钮
  39. [self youpaifvideoEnd:1];
  40. [YOUPAIBBCustomSystomNotification youpaifcustomSystomNotificationWithModel:self.youpaipvideoModel type:BBCustomSystomNotificationTypeWithCancelVideo block:^(NSError * _Nonnull error) {
  41. }];
  42. }
  43. - (void)youpaifrequestSuccess{ //主叫连接成功
  44. [YOUPAIBBCustomSystomNotification youpaifcustomSystomNotificationWithModel:self.youpaipvideoModel type:BBCustomSystomNotificationTypeWithCallVideo block:^(NSError * _Nonnull error) {
  45. }];
  46. }
  47. - (void)youpaifvideoStart{ //视频开始
  48. [super youpaifvideoStart];
  49. [self.youpaiprequestView removeFromSuperview];
  50. }
  51. //1主动取消 2。拒绝 3.超时 4.被叫者挂断 5.主叫者挂断 6.费用不足
  52. - (void)youpaifvideoEnd:(NSInteger)type{
  53. [super youpaifvideoEnd:type];
  54. if (type==1) {
  55. [ZCHUDHelper showTitle:@"已取消"];
  56. }else if (type==2){
  57. [ZCHUDHelper showTitle:@"对方已拒绝"];
  58. }else if (type==3){
  59. [ZCHUDHelper showTitle:@"超时无应答"];
  60. }else if (type==4){
  61. [ZCHUDHelper showTitle:@"对方已挂断"];
  62. }else if (type==5){
  63. [ZCHUDHelper showTitle:@"通话已结束"];
  64. }else if (type==10){
  65. [ZCHUDHelper showTitle:@"检测到本次视频违规,请遵守平台相关规则" showtime:5];
  66. }else if (type==11){
  67. [ZCHUDHelper showTitle:@"检测到本次视频违规,请遵守平台相关规则" showtime:5];
  68. }else if (type == BBCustomSystomNotificationTypeWithRefuseCallVideo){
  69. [ZCHUDHelper showTitle:[YOUPAIBBCustomSystomNotification youpaifnotificationTitleWithType:BBCustomSystomNotificationTypeWithRefuseCallVideo]];
  70. }
  71. }
  72. @end