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/ESVideoMonitorViewController.m |   38 ++++++++++++++++++++++++++------------
 1 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideoMonitorViewController.m b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideoMonitorViewController.m
index fbddd12..07eed88 100644
--- a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideoMonitorViewController.m
+++ b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideoMonitorViewController.m
@@ -15,6 +15,7 @@
 #import <Photos/Photos.h>
 #import "AudioSessionHelper.h"
 #import "CBToast.h"
+#import "ESVideo.h"
 
 @interface ESVideoMonitorViewController ()<ESVideoPhoneDelegate>
 
@@ -140,7 +141,7 @@
 
 -(void)backAction{
     [self.navigationController popViewControllerAnimated:true];
-//    [self dismissViewControllerAnimated:YES completion:NULL];
+    //    [self dismissViewControllerAnimated:YES completion:NULL];
 }
 
 - (UIButton *)moreButton{
@@ -164,7 +165,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.screenshotImgBtn];
     [self.centerView addSubview:self.screenshotTextBtn];
@@ -397,6 +398,8 @@
 #pragma SDK鍙瀵硅 鍔熻兘閮ㄥ垎
 -(void)initESVideo{
     //鍒濆鍖栦腑鏂紝杩涘叆鍚庡彴鐨則ag
+    _es = ESVideo.shareInstance.es;
+    
     _playing = NO;
     _isSpeaking = NO;
     self.isInterrupt = NO;
@@ -412,13 +415,19 @@
             });
         };
         //闂ㄥ彛鏈轰細鏈夎棰戠殑闀垮楂橈紝鏄浐瀹氱殑锛堟殏鏃惰繕涓嶇‘瀹氾級
-        _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) {
+//                for(UIView *view in [_es.showView subviews])
+//                {
+//                    [view removeFromSuperview];
+//                }
                 _es.delegate = self;
+                ESVideo.shareInstance.snapImageCallback = snapImageCallback;
                 _es.showView.backgroundColor = [UIColor whiteColor];
                 [self.centerView addSubview:_es.showView];
+                _es.showView.hidden = YES;
             }
         }else{
             NSLog(@"ESVideoPhone 鍒濆鍖栧け璐�");
@@ -487,9 +496,9 @@
     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];
+    [self presentViewController:alertController animated:YES completion:nil];
 }
 
 
@@ -520,11 +529,12 @@
         [_es stopTalk];
         
         _es.delegate = nil;
-        
-        
+        ESVideo.shareInstance.snapImageCallback = nil;
+//        _es.showView.removeFromSuperview;
         
     }
-    [_es freeSubClass];
+ 
+//    [_es freeSubClass];
 }
 
 -(void)dealloc{
@@ -560,13 +570,17 @@
     }else if([phoneEventStr isEqual:@"EVT_Connected"]){
         [self speaker:nil];
         //           [_mCallOrAccept setTitle:@"閫氳瘽涓�..." forState:UIControlStateNormal];
+    }else if([phoneEventStr isEqual:@"EVT_MonitorConnected"]){
+        _es.showView.hidden = NO;
+        [self speaker:nil];
+        //           [_mCallOrAccept setTitle:@"閫氳瘽涓�..." forState:UIControlStateNormal];
     }else if([phoneEventStr  isEqual:@"EVT_HangUp"]){
-
         
-//        [CBToast showToastAction:endOfMonitoringStr];
+        
+        //        [CBToast showToastAction:endOfMonitoringStr];
         [self showUIAlertViewWithBack:endOfMonitoringStr];
-//        [self backAction];
-    
+        //        [self backAction];
+        
         
         
         //           [_mCallOrAccept setTitle:@"鍙嶅懠" forState:UIControlStateNormal];

--
Gitblit v1.8.0