xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESvideoVideoIntercomViewController.m
@@ -14,7 +14,7 @@
#import "AudioSessionHelper.h"
#import <Photos/Photos.h>
#import <AudioToolbox/AudioToolbox.h>
#import "ESVideo.h"
@@ -80,6 +80,8 @@
    NSString * refuseStr;
    NSString * answerStr;
    NSString * unlockSuccessfullyStr;
    NSString * callingStr;
    NSString * hangUpStr;
    //    int openDoorTimeout;
    //全局变量
    SystemSoundID sound;
@@ -92,11 +94,11 @@
    [self initTopBarView];
    [self initCentetView];
    [self initData];
//    [self setAnswerBtnEnable:NO];
    //    [self setAnswerBtnEnable:NO];
    [self initESVideo];
    //开始反呼
    [self StartReverseCall];
    [self ShowCalltimeBtn:@"室外机来电中..."];
    [self ShowCalltimeBtn:callingStr];
    // Do any additional setup after loading the view.
}
@@ -112,7 +114,9 @@
        operationFailedStr = @"操作失败";
        refuseStr = @"拒绝";
        answerStr = @"接听";
        hangUpStr = @"挂断";
        unlockSuccessfullyStr = @"开锁成功";
        callingStr = @"来电中...";
    }else{
        tipStr = @"Prompt";
        okStr = @"OK";
@@ -120,7 +124,10 @@
        operationFailedStr = @"Operation failed.";
        refuseStr = @"Refuse";
        answerStr = @"Answer";
        hangUpStr = @"Hang up";
        unlockSuccessfullyStr = @"Unlock successfully";
        callingStr = @"Incoming call";
    }
}
@@ -152,8 +159,8 @@
-(void)backAction{
    [self.navigationController popViewControllerAnimated:true];
//    [self dismissViewControllerAnimated:YES completion:NULL];
    //    [self dismissViewControllerAnimated:YES completion:NULL];
}
- (UIButton *)moreButton{
@@ -174,7 +181,7 @@
- (void)initCentetView {
    [self.view addSubview:self.centerView];
    [self.centerView addSubview:self.collectButton];
    //    [self.centerView addSubview:self.collectButton];
    [self.centerView addSubview:self.homeView];
    [self.centerView addSubview:self.unlockView];
    [self.unlockView addSubview:self.screenshotImgBtn];
@@ -384,7 +391,7 @@
    //挂断按钮移动中间
    _hangUpImgBtn.frame = CGRectMake(159, 448, 58, 58);
    _hangUpTextBtn.frame = CGRectMake(138, 514, 100, 21);
    [_hangUpTextBtn setTitle:hangUpStr forState:UIControlStateNormal];
    //开始计时
    _callTimeout = 0;
    [self startCountdown];
@@ -437,9 +444,9 @@
-(void)ShowCalltimeBtn:(NSString*) mesStr  {
    if(_calltimeBtn.hidden) _calltimeBtn.hidden = NO;
    [self setCalltimeButtonText:mesStr isTime:NO];
    
}
@@ -450,9 +457,9 @@
{
    [_calltimeBtn setTitle:mesStr forState:UIControlStateNormal];
    if(isTime){
        _calltimeBtn.frame = CGRectMake(0, 0, 100, 30);
        _calltimeBtn.frame = CGRectMake(0, 0, 80, 30);
    }else{
        _calltimeBtn.frame = CGRectMake(0, 0, 150, 30);
        _calltimeBtn.frame = CGRectMake(0, 0, 115, 30);
    }
    _calltimeBtn.center = CGPointMake(APP_SCREEN_WIDTH/2, 397);
}
@@ -575,7 +582,10 @@
#pragma SDK可视对讲 功能部分
-(void)initESVideo{
    _es = ESVideo.shareInstance.es;
    //初始化中断,进入后台的tag
    _playing = NO;
    _isSpeaking = NO;
    self.isInterrupt = NO;
@@ -593,13 +603,15 @@
            });
        };
        //门口机会有视频的长宽高,是固定的(暂时还不确定)
        _es = [[ESVideoPhone alloc]initESVideoPhoneWithFrame:CGRectMake(0, 57, APP_SCREEN_WIDTH, 211) delegate:self imagecallBack:snapImageCallback];
//        _es = [[ESVideoPhone alloc]initESVideoPhoneWithFrame:CGRectMake(0, 57, APP_SCREEN_WIDTH, 211) delegate:self imagecallBack:snapImageCallback];
        if (_es) {
            //判断视频渲染是否初始化成功,如果失败会走ESVideoPhoneDelegate方法
            if (_es.showView) {
                ESVideo.shareInstance.snapImageCallback = snapImageCallback;
                _es.delegate = self;
                _es.showView.backgroundColor = [UIColor whiteColor];
                [self.centerView addSubview:_es.showView];
                _es.showView.hidden = YES;
            }
        }else{
            NSLog(@"ESVideoPhone 初始化失败");
@@ -680,9 +692,19 @@
    [alertController addAction:[UIAlertAction actionWithTitle:okStr style:UIAlertActionStyleCancel handler:nil]];
    [self presentViewController:alertController animated:YES completion:nil];
    
//    UIAlertView *alertView1 = [[UIAlertView alloc] initWithTitle:tipStr message:mes delegate:self cancelButtonTitle:okStr otherButtonTitles:nil, nil];
//    [alertView1 show];
    //    UIAlertView *alertView1 = [[UIAlertView alloc] initWithTitle:tipStr message:mes delegate:self cancelButtonTitle:okStr otherButtonTitles:nil, nil];
    //    [alertView1 show];
    
}
-(void)showUIAlertViewWithBack:(NSString *)mes
{
    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:tipStr message:mes preferredStyle:UIAlertControllerStyleAlert];
    [alertController addAction:[UIAlertAction actionWithTitle:okStr style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        [self backAction];
    }]];
    [self presentViewController:alertController animated:YES completion:nil];
}
@@ -711,11 +733,11 @@
        [_es stopTalk];
        
        _es.delegate = nil;
        ESVideo.shareInstance.snapImageCallback = nil;
        
        
    }
    [_es freeSubClass];
//    [_es freeSubClass];
}
-(void)dealloc{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
@@ -744,6 +766,7 @@
    NSString *phoneEventStr = eventArray.lastObject;
    
    if([phoneEventStr isEqual:@"EVT_Ringing"]){
        _es.showView.hidden = NO;
        //反呼成功 允许接听  看需求是否需要播放铃声和震动
        [self setAnswerBtnEnable:YES];
        
@@ -753,8 +776,10 @@
    } else if([phoneEventStr isEqual:@"EVT_StopStream"]){
        //           [_mCallOrAccept setTitle:@"反呼" forState:UIControlStateNormal];
    }else if([phoneEventStr isEqual:@"EVT_Connected"]){
        //           [_mCallOrAccept setTitle:@"通话中..." forState:UIControlStateNormal];
    }else if([phoneEventStr  isEqual:@"EVT_HangUp"]){
         [self showUIAlertViewWithBack:@"已挂断"];
        //           [_mCallOrAccept setTitle:@"反呼" forState:UIControlStateNormal];
    }else if([phoneEventStr  isEqual:@"EVT_P2POnlineStatusChanged"]){
        //EVT_P2PStarted(p2p初始化OK,可以连接),EVT_P2POnlineStatusChangedonline=1