From a869383e163a18cdedcf587383c1eca043129754 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期二, 18 五月 2021 13:19:12 +0800 Subject: [PATCH] 2021-05-18 1.更新 --- iOS/Xamarin/LCSDKOnXamarin/LCSDKOnXamarin/LCOnIntercomViewController.m | 160 +++++++++++++++++++++++++++------------------------- 1 files changed, 83 insertions(+), 77 deletions(-) diff --git a/iOS/Xamarin/LCSDKOnXamarin/LCSDKOnXamarin/LCOnIntercomViewController.m b/iOS/Xamarin/LCSDKOnXamarin/LCSDKOnXamarin/LCOnIntercomViewController.m index 6ef9962..bd30ccc 100644 --- a/iOS/Xamarin/LCSDKOnXamarin/LCSDKOnXamarin/LCOnIntercomViewController.m +++ b/iOS/Xamarin/LCSDKOnXamarin/LCSDKOnXamarin/LCOnIntercomViewController.m @@ -9,7 +9,9 @@ #import <AVFoundation/AVFoundation.h> #import <Photos/Photos.h> #import <AudioToolbox/AudioToolbox.h> -#import "LCKit.h" +#import "LCUtlis.h" +#import "LCApiKit.h" +#import <LCOpenSDKDynamic/LCOpenSDKDynamic.h> @interface LCOnIntercomViewController ()<LCOpenSDK_EventListener, LCOpenSDK_TalkerListener> @@ -51,11 +53,8 @@ @implementation LCOnIntercomViewController{ - BOOL isAccessAudio; - BOOL isAccessVideo; + BOOL isBackGround; - BOOL iSVideoNotDetermined; - BOOL iSAudioNotDetermined; BOOL isAnswer;//鏄惁宸茬粡鐐瑰嚮鎺ュ惉杩囦簡 NSString * tipStr; @@ -90,8 +89,11 @@ //寮�濮嬪弽鍛� [self StartReverseCall]; [self ShowCalltimeBtn:callingStr]; - //鏆傛椂涓嶆敮鎸佸紑閿佸姛鑳� - [self setUnlock:NO]; +// //鏆傛椂涓嶆敮鎸佸紑閿佸姛鑳� +// [self setUnlock:NO]; + //娉ㄥ唽寮�閿佹垚鍔熺洃鍚� + [self addOpenSuccessAction]; + // Do any additional setup after loading the view. } @@ -282,11 +284,10 @@ -(void)unlockAction{ [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_on_unlock_unselect"] forState:UIControlStateNormal]; - // //寮�閿� - // if(_es){ - // [_es openTheDoorWithRoomid:_mESRoomID]; - // } - + //寮�閿� + if(self.mLCCallDelegate != NULL){ + [self.mLCCallDelegate onUnlockAction]; + } } #pragma 鎸傛柇鍜屽紑閿� @@ -305,13 +306,13 @@ //鎸傛柇鎸夐挳浜嬩欢 -(void)hangUpAction{ //1.鍥炶皟浜嬩欢 - if(self.mESCallDelegate != NULL){ + if(self.mLCCallDelegate != NULL){ if(isAnswer){ //濡傛灉涔嬪墠宸茬粡鎺ュ惉浜嗭紝鍥炶皟鏄寕鏂� - [self.mESCallDelegate onHangUpAction:_callTimeout]; + [self.mLCCallDelegate onHangUpAction:_callTimeout]; }else{ //濡傛灉涔嬪墠娌℃帴鍚簡锛屽洖璋冩槸鎷掓帴 - [self.mESCallDelegate onRejectCallAction]; + [self.mLCCallDelegate onRejectCallAction]; } } //2.椤甸潰鍏抽棴 @@ -350,7 +351,7 @@ [self stopPlaySystemSound]; /// 寮�鍚璁� [self startTalk]; - + _answerImgBtn.hidden = YES; _answerTextBtn.hidden = YES; @@ -364,8 +365,8 @@ [self startCountdown]; isAnswer = YES; - if(self.mESCallDelegate != NULL){ - [self.mESCallDelegate onAnswerAction]; + if(self.mLCCallDelegate != NULL){ + [self.mLCCallDelegate onAnswerAction]; } } @@ -503,10 +504,7 @@ _openDoorTimeout = 0; [self startOpenDoorCountdown]; [self showUIAlertView:unlockSuccessfullyStr]; - // 寮�閿佹垚鍔熷洖璋� - if(self.mESCallDelegate != NULL){ - [self.mESCallDelegate onUnlockAction]; - } + } -(void)setUnlock:(BOOL)ISEnable{ @@ -653,7 +651,7 @@ - (void)startTalk { if (!isAnswer) { //瀵硅寮�鍚� -// [self.playWindow stopAudio]; + // [self.playWindow stopAudio]; if(self.talker == NULL) return; @@ -701,7 +699,7 @@ - (void)onPlayerResult:(NSString*)code Type:(NSInteger)type Index:(NSInteger)index { // play WEAKSELF_AT(self); - NSLog(@"LIVE_PLAY-CODE:%@,TYPE:%ld", code, type); + NSLog(@"LIVE_PLAY-CODE:%@,TYPE:%ld", code, (long)type); //鏄惁宸茬粡寮圭獥杩� if(isShowErrorAlert) return;; @@ -726,13 +724,13 @@ if (type == 0) { if ([RTSP_Result_String(STATE_RTSP_DESCRIBE_READY) isEqualToString:code]) { -// dispatch_async(dispatch_get_main_queue(), ^{ -// }); + // dispatch_async(dispatch_get_main_queue(), ^{ + // }); return; } if ([RTSP_Result_String(STATE_RTSP_PLAY_READY) isEqualToString:code]) { -// dispatch_async(dispatch_get_main_queue(), ^{ -// }); + // dispatch_async(dispatch_get_main_queue(), ^{ + // }); return; } //鎻愮ず澶辫触 @@ -764,31 +762,31 @@ dispatch_async(dispatch_get_main_queue(), ^{ NSLog(@"寮�鍚璁插洖璋僥rror = %@, type = %ld", error, (long)type); WEAKSELF_AT(self); -// [LCProgressHUD hideAllHuds:nil]; -// if (99 == type) { //缃戠粶璇锋眰澶辫触 -//// dispatch_async(dispatch_get_main_queue(), ^{ -//// weakself.videoManager.isOpenAudioTalk = NO; -//// [LCProgressHUD showMsg:@"play_module_video_preview_talk_failed".lc_T]; -//// }); -// return; -// } -// if (nil != error && [RTSP_Result_String(STATE_RTSP_DESCRIBE_READY) isEqualToString:error]) { -// dispatch_async(dispatch_get_main_queue(), ^{ -// }); -// return; -// } -// if (nil != error && [RTSP_Result_String(STATE_RTSP_PLAY_READY) isEqualToString:error]) { -// dispatch_async(dispatch_get_main_queue(), ^{ -// //瀵硅杩炴帴鎴愬姛寤虹珛 -// self.videoManager.isOpenAudioTalk = YES; -// [LCProgressHUD showMsg:@"device_mid_open_talk_success".lc_T]; -// }); -// return; -// } -// dispatch_async(dispatch_get_main_queue(), ^{ -// [LCProgressHUD showMsg:@"play_module_video_preview_talk_failed".lc_T]; -// weakself.videoManager.isOpenAudioTalk = NO; -// }); + // [LCProgressHUD hideAllHuds:nil]; + // if (99 == type) { //缃戠粶璇锋眰澶辫触 + //// dispatch_async(dispatch_get_main_queue(), ^{ + //// weakself.videoManager.isOpenAudioTalk = NO; + //// [LCProgressHUD showMsg:@"play_module_video_preview_talk_failed".lc_T]; + //// }); + // return; + // } + // if (nil != error && [RTSP_Result_String(STATE_RTSP_DESCRIBE_READY) isEqualToString:error]) { + // dispatch_async(dispatch_get_main_queue(), ^{ + // }); + // return; + // } + // if (nil != error && [RTSP_Result_String(STATE_RTSP_PLAY_READY) isEqualToString:error]) { + // dispatch_async(dispatch_get_main_queue(), ^{ + // //瀵硅杩炴帴鎴愬姛寤虹珛 + // self.videoManager.isOpenAudioTalk = YES; + // [LCProgressHUD showMsg:@"device_mid_open_talk_success".lc_T]; + // }); + // return; + // } + // dispatch_async(dispatch_get_main_queue(), ^{ + // [LCProgressHUD showMsg:@"play_module_video_preview_talk_failed".lc_T]; + // weakself.videoManager.isOpenAudioTalk = NO; + // }); }); } @@ -858,24 +856,11 @@ [super viewWillDisappear:animated]; [self stopPlaySystemSound]; //闃叉鐢ㄦ埛涓嶆寜鎸傛柇锛屾垨鑰呬笉绛夋敹鍒板鏂圭殑鎸傛柇锛岀偣鍑昏繑鍥炴寜閽�� + //1.鏆傚仠SDK鐩稿叧鎾斁 [self stopPlay]; - - // if(_es){ - // [_es onHangup]; - // [_es onStopCapture]; - // [_es stopTalk]; - // - // _es.delegate = nil; - // ESVideo.shareInstance.snapImageCallback = nil; - // - // - // } - // [_es freeSubClass]; -} --(void)dealloc{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; - // [_es freeSubClass]; - + //2.Delegate閲婃斁 + self.mLCCallDelegate = nil; + //3.瀹氭椂鍣ㄩ噴鏀� if(_openDoorTimer){ dispatch_source_cancel(_openDoorTimer); _openDoorTimer = nil; // OK @@ -885,9 +870,13 @@ _countdownTimer = nil; // OK } - NSLog(@"==============dealloc"); - - + + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +-(void)dealloc{ + NSLog(@"==============dealloc 1"); + } //#pragma mark ESVideoPhoneDelegate @@ -1025,8 +1014,8 @@ if (!error) { message = saveToTheAlbumsStr; // 鎴浘鎴愬姛鍥炶皟 - if(self.mESCallDelegate != NULL){ - [self.mESCallDelegate onScreenshotSuccessfulAction:image]; + if(self.mLCCallDelegate != NULL){ + [self.mLCCallDelegate onScreenshotSuccessfulAction:image]; } } else @@ -1079,7 +1068,7 @@ //寮�濮嬫挱鏀剧殑鏃跺�欒皟鐢� -(void)startPlaySystemSound{ -// return; + // return; // //闇囧姩鐨勬彁绀烘枃浠跺悕鏀惧埌璧勬簮鐩綍涓� // NSString *path = [[NSBundle mainBundle] pathForResource:@"ring" ofType:@"wav"]; // AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:path], &sound); @@ -1092,7 +1081,7 @@ //鎵嬪姩鍋滄鎾斁鐨勬椂鍊欒皟鐢� - (void)stopPlaySystemSound{ -// return; + // return; NSLog(@"stop PlaySystemSound"); stopRingAndVibration(); } @@ -1119,8 +1108,25 @@ //} +/// +- (void)addOpenSuccessAction { + [[NSNotificationCenter defaultCenter] removeObserver:self + name:LCCallDelegateOpenDoorSuccess + object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(setOpenDoorSuccess) + name:LCCallDelegateOpenDoorSuccess + object:nil]; +} + +- (void)removeOpenSuccessAction { + + [[NSNotificationCenter defaultCenter] removeObserver:self + name:LCCallDelegateOpenDoorSuccess + object:nil]; +} @end -- Gitblit v1.8.0