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/LCOnMonitorViewController.m |   75 ++++++++++++++++++-------------------
 1 files changed, 36 insertions(+), 39 deletions(-)

diff --git a/iOS/Xamarin/LCSDKOnXamarin/LCSDKOnXamarin/LCOnMonitorViewController.m b/iOS/Xamarin/LCSDKOnXamarin/LCSDKOnXamarin/LCOnMonitorViewController.m
index e0294c2..9c276f0 100644
--- a/iOS/Xamarin/LCSDKOnXamarin/LCSDKOnXamarin/LCOnMonitorViewController.m
+++ b/iOS/Xamarin/LCSDKOnXamarin/LCSDKOnXamarin/LCOnMonitorViewController.m
@@ -8,9 +8,9 @@
 #import "LCOnMonitorViewController.h"
 #import <AVFoundation/AVFoundation.h>
 #import <Photos/Photos.h>
-#import "LCKit.h"
-
-
+#import "LCUtlis.h"
+#import "LCApiKit.h"
+#import <LCOpenSDKDynamic/LCOpenSDKDynamic.h>
 
 @interface LCOnMonitorViewController ()<LCOpenSDK_EventListener>
 
@@ -41,11 +41,7 @@
 
 @implementation LCOnMonitorViewController
 {
-    BOOL isAccessAudio;
-    BOOL isAccessVideo;
     BOOL isBackGround;
-    BOOL iSVideoNotDetermined;
-    BOOL iSAudioNotDetermined;
     
     NSString * tipStr;
     NSString * okStr;
@@ -76,8 +72,10 @@
     [self initESVideo];
     [self StartMonitoring];
     
-    //鏆傛椂涓嶆敮鎸佸紑閿佸姛鑳�
-    [self setUnlock:NO];
+//    //鏆傛椂涓嶆敮鎸佸紑閿佸姛鑳�
+//    [self setUnlock:NO];
+    //娉ㄥ唽寮�閿佹垚鍔熺洃鍚�
+    [self addOpenSuccessAction];
     // Do any additional setup after loading the view.
 }
 
@@ -277,9 +275,9 @@
     [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_on_unlock_unselect"] forState:UIControlStateNormal];
     [_unlockTextBtn setTitleColor:TextColor forState:UIControlStateNormal];
     //寮�閿�
-    //    if(_es){
-    //        [_es openTheDoorWithRoomid:_mESRoomID];
-    //    }
+    if(self.mLCCallDelegate != NULL){
+        [self.mLCCallDelegate onUnlockAction];
+    }
 }
 
 - (UIButton *)unlockTextBtn{
@@ -454,7 +452,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;;
     
@@ -479,13 +477,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;
             }
             //鎻愮ず澶辫触
@@ -576,34 +574,21 @@
 -(void)viewWillDisappear:(BOOL)animated{
     [super viewWillDisappear:animated];
     
+    //1.鏆傚仠SDK鐩稿叧鎾斁
     [self stopPlay];
+    //2.Delegate閲婃斁
+    self.mLCCallDelegate = nil;
+    //3.瀹氭椂鍣ㄩ噴鏀�
+    if(_openDoorTimer){
+        dispatch_source_cancel(_openDoorTimer);
+        _openDoorTimer = nil; // OK
+    }
     
-    //闃叉鐢ㄦ埛涓嶆寜鎸傛柇锛屾垨鑰呬笉绛夋敹鍒板鏂圭殑鎸傛柇锛岀偣鍑昏繑鍥炴寜閽��
-    //    if(_es){
-    //        [_es onHangup];
-    //        [_es onStopCapture];
-    //        [_es stopTalk];
-    //
-    //        _es.delegate = nil;
-    //        ESVideo.shareInstance.snapImageCallback = nil;
-    //        //        _es.showView.removeFromSuperview;
-    //    }
-    //    [_es freeSubClass];
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
 }
 
 -(void)dealloc{
     NSLog(@"==============dealloc  1");
-    [[NSNotificationCenter defaultCenter] removeObserver:self];
-    NSLog(@"==============dealloc  2");
-    //    [_es freeSubClass];
-    //     NSLog(@"==============dealloc  3");
-    
-    if(_openDoorTimer){
-        dispatch_source_cancel(_openDoorTimer);
-        _openDoorTimer = nil; // OK
-        
-    }
-    NSLog(@"==============dealloc 3");
 }
 
 //#pragma mark ESVideoPhoneDelegate
@@ -1069,6 +1054,18 @@
     
 }
 
+- (void)addOpenSuccessAction {
+
+    [[NSNotificationCenter defaultCenter] removeObserver:self
+                                                    name:LCCallDelegateOpenDoorSuccess
+                                                  object:nil];
+
+    [[NSNotificationCenter defaultCenter] addObserver:self
+                                             selector:@selector(setOpenDoorSuccess)
+                                                 name:LCCallDelegateOpenDoorSuccess
+                                               object:nil];
+}
+
 
 @end
 

--
Gitblit v1.8.0