From fac61655d3d255468491d0829c8814c0cf0a62dd Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期四, 02 七月 2020 13:50:41 +0800 Subject: [PATCH] 2020-07-02 1.更新最新SDK。 2.参试封装工具类,只初始化一次SDK方案,暂时解决SDK无法释放问题。 --- xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESvideoVideoIntercomViewController.m | 63 ++++++++++++++++++++++++++----- 1 files changed, 53 insertions(+), 10 deletions(-) diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESvideoVideoIntercomViewController.m b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESvideoVideoIntercomViewController.m index 6d8b1d5..bf1c7be 100644 --- a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESvideoVideoIntercomViewController.m +++ b/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,10 +94,11 @@ [self initTopBarView]; [self initCentetView]; [self initData]; - [self setAnswerBtnEnable:NO]; + // [self setAnswerBtnEnable:NO]; [self initESVideo]; //寮�濮嬪弽鍛� [self StartReverseCall]; + [self ShowCalltimeBtn:callingStr]; // Do any additional setup after loading the view. } @@ -111,7 +114,9 @@ operationFailedStr = @"鎿嶄綔澶辫触"; refuseStr = @"鎷掔粷"; answerStr = @"鎺ュ惉"; + hangUpStr = @"鎸傛柇"; unlockSuccessfullyStr = @"寮�閿佹垚鍔�"; + callingStr = @"鏉ョ數涓�..."; }else{ tipStr = @"Prompt"; okStr = @"OK"; @@ -119,7 +124,10 @@ operationFailedStr = @"Operation failed."; refuseStr = @"Refuse"; answerStr = @"Answer"; + hangUpStr = @"Hang up"; unlockSuccessfullyStr = @"Unlock successfully"; + callingStr = @"Incoming call"; + } } @@ -152,6 +160,7 @@ -(void)backAction{ [self.navigationController popViewControllerAnimated:true]; // [self dismissViewControllerAnimated:YES completion:NULL]; + } - (UIButton *)moreButton{ @@ -172,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]; @@ -382,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]; @@ -424,18 +433,34 @@ return _calltimeBtn; } + + + -(void)ShowTime:(int)nowTime { if(_calltimeBtn.hidden) _calltimeBtn.hidden = NO; NSString *timeStr = [self timeFormatted:nowTime]; - [self setCalltimeButtonText:timeStr]; + [self setCalltimeButtonText:timeStr isTime:YES]; +} + +-(void)ShowCalltimeBtn:(NSString*) mesStr { + if(_calltimeBtn.hidden) _calltimeBtn.hidden = NO; + + [self setCalltimeButtonText:mesStr isTime:NO]; + + } /* 鏍规嵁鏂囧瓧璋冩暣鎸夐挳瀹� */ --(void)setCalltimeButtonText:(NSString*) mesStr { +-(void)setCalltimeButtonText:(NSString*) mesStr isTime:(BOOL)isTime +{ [_calltimeBtn setTitle:mesStr forState:UIControlStateNormal]; - _calltimeBtn.frame = CGRectMake(0, 0, 100, 30); + if(isTime){ + _calltimeBtn.frame = CGRectMake(0, 0, 80, 30); + }else{ + _calltimeBtn.frame = CGRectMake(0, 0, 115, 30); + } _calltimeBtn.center = CGPointMake(APP_SCREEN_WIDTH/2, 397); } @@ -557,7 +582,10 @@ #pragma SDK鍙瀵硅 鍔熻兘閮ㄥ垎 -(void)initESVideo{ + _es = ESVideo.shareInstance.es; //鍒濆鍖栦腑鏂紝杩涘叆鍚庡彴鐨則ag + + _playing = NO; _isSpeaking = NO; self.isInterrupt = NO; @@ -575,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 鍒濆鍖栧け璐�"); @@ -667,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{ @@ -693,11 +733,11 @@ [_es stopTalk]; _es.delegate = nil; - + ESVideo.shareInstance.snapImageCallback = nil; } - [_es freeSubClass]; +// [_es freeSubClass]; } -(void)dealloc{ [[NSNotificationCenter defaultCenter] removeObserver:self]; @@ -726,6 +766,7 @@ NSString *phoneEventStr = eventArray.lastObject; if([phoneEventStr isEqual:@"EVT_Ringing"]){ + _es.showView.hidden = NO; //鍙嶅懠鎴愬姛 鍏佽鎺ュ惉 鐪嬮渶姹傛槸鍚﹂渶瑕佹挱鏀鹃搩澹板拰闇囧姩 [self setAnswerBtnEnable:YES]; @@ -735,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鍒濆鍖朞K锛屽彲浠ヨ繛鎺�),EVT_P2POnlineStatusChangedonline=1 -- Gitblit v1.8.0