ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESvideoVideoIntercomViewController.m
@@ -14,7 +14,7 @@
#import "AudioSessionHelper.h"
#import <Photos/Photos.h>
#import <AudioToolbox/AudioToolbox.h>
#import "ESVideo.h"
@@ -81,6 +81,7 @@
    NSString * answerStr;
    NSString * unlockSuccessfullyStr;
    NSString * callingStr;
    NSString * hangUpStr;
    //    int openDoorTimeout;
    //全局变量
    SystemSoundID sound;
@@ -113,6 +114,7 @@
        operationFailedStr = @"操作失败";
        refuseStr = @"拒绝";
        answerStr = @"接听";
        hangUpStr = @"挂断";
        unlockSuccessfullyStr = @"开锁成功";
        callingStr = @"来电中...";
    }else{
@@ -122,6 +124,7 @@
        operationFailedStr = @"Operation failed.";
        refuseStr = @"Refuse";
        answerStr = @"Answer";
        hangUpStr = @"Hang up";
        unlockSuccessfullyStr = @"Unlock successfully";
        callingStr = @"Incoming call";
        
@@ -388,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];
@@ -579,7 +582,10 @@
#pragma SDK可视对讲 功能部分
-(void)initESVideo{
    _es = ESVideo.shareInstance.es;
    //初始化中断,进入后台的tag
    _playing = NO;
    _isSpeaking = NO;
    self.isInterrupt = NO;
@@ -597,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 初始化失败");
@@ -689,6 +697,16 @@
    
}
-(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];
}
#pragma viewDidAppear
-(void)viewDidAppear:(BOOL)animated{
@@ -715,11 +733,11 @@
        [_es stopTalk];
        
        _es.delegate = nil;
        ESVideo.shareInstance.snapImageCallback = nil;
        
        
    }
    [_es freeSubClass];
//    [_es freeSubClass];
}
-(void)dealloc{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
@@ -748,6 +766,7 @@
    NSString *phoneEventStr = eventArray.lastObject;
    
    if([phoneEventStr isEqual:@"EVT_Ringing"]){
        _es.showView.hidden = NO;
        //反呼成功 允许接听  看需求是否需要播放铃声和震动
        [self setAnswerBtnEnable:YES];
        
@@ -757,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