// // YOUPAIBBVideoResponseVC.m // VQU // // Created by Elaine on 2021/10/28. // Copyright © 2021 MS. All rights reserved. // #import "YOUPAIBBVideoResponseVC.h" #import "YOUPAIBBVideoResponseView.h" #import "YOUPAIBBCustomSystomNotification.h" @interface YOUPAIBBVideoResponseVC () @property(nonatomic,strong)YOUPAIBBVideoResponseView* youpaipresponseView; @end @implementation YOUPAIBBVideoResponseVC -(void)dealloc{ [[NSNotificationCenter defaultCenter] removeObserver:self]; } - (void)cancelVideoNotification{ [self youpaifvideoEnd:BBCustomSystomNotificationTypeWithCancelVideo]; } - (void)viewDidLoad { [super viewDidLoad]; [self youpaifsetupResponseView]; /// 对方已取消视频电话,接收通知 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(cancelVideoNotification) name:@"CancelVideo" object:nil]; } - (void)youpaifsetupResponseView{ self.youpaipresponseView = [[YOUPAIBBVideoResponseView alloc]initWithModel:self.youpaipvideoModel]; self.youpaipresponseView.delegate = self; [self.view addSubview:self.youpaipresponseView]; } //子类实现的代理 - (void)youpaifresponseConnent{ } - (void)youpaifcancelBtnClick{ [self youpaifvideoEnd:2]; /// 拒绝接听 [YOUPAIBBCustomSystomNotification youpaifcustomSystomNotificationWithModel:self.youpaipvideoModel type:BBCustomSystomNotificationTypeWithRefuseCallVideo block:^(NSError * _Nonnull error) { }]; } //v1.1.2 增加视频权限判断 - (void)youpaifconfirmBtnClick{ /// 接听 [YOUPAIBBCustomSystomNotification youpaifcustomSystomNotificationWithModel:self.youpaipvideoModel type:BBCustomSystomNotificationTypeWithAnswerCallVideo block:^(NSError * _Nonnull error) { if (!error) { [self youpaifvideoStart]; } }]; [UCAuthorityManager cameraAuthority:^{ }denied:^{ UIAlertController *systemAlert = [UIAlertController alertControllerWithTitle:@"请在iphone的“设置-隐私-相机”选项中,允许APP访问您的相机。" message:nil preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil]; [systemAlert addAction:action]; [self presentViewController:systemAlert animated:YES completion:nil]; }]; } - (void)youpaifvideoStart{ //视频开始 [super youpaifvideoStart]; [self.youpaipresponseView removeFromSuperview]; } //1主动取消 2。拒绝 3.超时 4.被叫者挂断 5.主叫者挂断 6.费用不足 - (void)youpaifvideoEnd:(NSInteger)type{ [super youpaifvideoEnd:type]; if (type==1) { [ZCHUDHelper showTitle:@"已取消"]; }else if (type==2){ [ZCHUDHelper showTitle:@"已拒绝"]; }else if (type==3){ [ZCHUDHelper showTitle:@"超时无应答"]; }else if (type==4){ [ZCHUDHelper showTitle:@"通话已结束"]; }else if (type==5){ [ZCHUDHelper showTitle:@"对方已挂断"]; }else if (type==10){ [ZCHUDHelper showTitle:@"检测到视频通话违规系统,请严格遵守平台相关规定" showtime:5]; }else if (type==11){ [ZCHUDHelper showTitle:@"检测到视频通话违规系统挂断,请严格遵守平台相关规定" showtime:5]; }else if (type== BBCustomSystomNotificationTypeWithCancelVideo) { [ZCHUDHelper showTitle:[YOUPAIBBCustomSystomNotification youpaifnotificationTitleWithType:type]]; } } @end