// // YOUPAIBBVideoRequestVC.m // VQU // // Created by Elaine on 2021/10/28. // Copyright © 2021 MS. All rights reserved. // #import "YOUPAIBBVideoRequestVC.h" #import "YOUPAIBBVideoRequestView.h" #import "YOUPAIBBCustomSystomNotification.h" @interface YOUPAIBBVideoRequestVC () @property(nonatomic,strong)YOUPAIBBVideoRequestView* youpaiprequestView; @end @implementation YOUPAIBBVideoRequestVC - (void)dealloc{ [[NSNotificationCenter defaultCenter] removeObserver:self]; } - (void)youpaifrefuseCallVideoNotification{ [self youpaifvideoEnd:BBCustomSystomNotificationTypeWithRefuseCallVideo]; } - (void)youpaifanswerCallVideoNotification{ [self youpaifvideoStart]; } - (void)viewDidLoad{ [super viewDidLoad]; [self youpaifsetupResquestView]; /// 对方拒绝接听视频,接听通知 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youpaifrefuseCallVideoNotification) name:@"RefuseCallVideo" object:nil]; //同意接听视频,接听通知 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youpaifanswerCallVideoNotification) name:@"AnswerCallVideo" object:nil]; [self youpaifrequestSuccess]; } - (void)youpaifsetupResquestView{ self.youpaiprequestView = [[YOUPAIBBVideoRequestView alloc] initWithModel:self.youpaipvideoModel]; self.youpaiprequestView.delegate = self; [self.view addSubview:self.youpaiprequestView]; } - (void)youpaifcancelBtnClick{ //点击了取消按钮 [self youpaifvideoEnd:1]; [YOUPAIBBCustomSystomNotification youpaifcustomSystomNotificationWithModel:self.youpaipvideoModel type:BBCustomSystomNotificationTypeWithCancelVideo block:^(NSError * _Nonnull error) { }]; } - (void)youpaifrequestSuccess{ //主叫连接成功 [YOUPAIBBCustomSystomNotification youpaifcustomSystomNotificationWithModel:self.youpaipvideoModel type:BBCustomSystomNotificationTypeWithCallVideo block:^(NSError * _Nonnull error) { }]; } - (void)youpaifvideoStart{ //视频开始 [super youpaifvideoStart]; [self.youpaiprequestView 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 == BBCustomSystomNotificationTypeWithRefuseCallVideo){ [ZCHUDHelper showTitle:[YOUPAIBBCustomSystomNotification youpaifnotificationTitleWithType:BBCustomSystomNotificationTypeWithRefuseCallVideo]]; } } @end