From 728ceead4ea3f18abcb6f70772e64e4549f9dcac Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期五, 02 四月 2021 17:06:31 +0800 Subject: [PATCH] 2021-04-02 1.ZigBee 丰林同样更新SDK。 --- xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideoMonitorViewController.m | 125 +++++++++++++++++++++++------------------ 1 files changed, 71 insertions(+), 54 deletions(-) diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideoMonitorViewController.m b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideoMonitorViewController.m index 07eed88..ea34833 100644 --- a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideoMonitorViewController.m +++ b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideoMonitorViewController.m @@ -13,13 +13,13 @@ #import <ESVideoPhoneSDk/ESError.h> #import "ESvideoVideoIntercomViewController.h" #import <Photos/Photos.h> -#import "AudioSessionHelper.h" +//#import "AudioSessionHelper.h" #import "CBToast.h" #import "ESVideo.h" @interface ESVideoMonitorViewController ()<ESVideoPhoneDelegate> -@property (nonatomic,strong) AudioSessionHelper *sessionHelper; +//@property (nonatomic,strong) AudioSessionHelper *sessionHelper; @property (nonatomic,strong) ESVideoPhone *es; @property (nonatomic,assign) BOOL playing; @property (nonatomic,assign) BOOL isInterrupt; @@ -120,7 +120,7 @@ UIView *TopView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, APP_TOP_BAR_HEIGHT)]; TopView.backgroundColor = HEXCOLORA(0xF9F9F9,1.0); [TopView addSubview:self.backButton]; - [TopView addSubview:self.moreButton]; +// [TopView addSubview:self.moreButton]; [self.view addSubview:TopView]; TopView.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.25].CGColor; TopView.layer.shadowOffset = CGSizeMake(0,0.5); @@ -179,7 +179,7 @@ _centerView.backgroundColor = UIColor.whiteColor; [self setRadiusWithView:_centerView]; - _topUILabel= [[UILabel alloc] initWithFrame:CGRectMake(80, 20, APP_SCREEN_WIDTH-160, 24)]; + _topUILabel= [[UILabel alloc] initWithFrame:CGRectMake(80, GetRealHeight(20), APP_SCREEN_WIDTH-160, GetRealHeight(24))]; _topUILabel.font = [UIFont fontWithName:APP_UIFont_BOLD size:15.0]; _topUILabel.textColor = HEXCOLORA(0x333333, 1.0); // _topUILabel.text = @"浜屾纭鏈�"; @@ -230,9 +230,9 @@ - (UIView *)homeView{ if (_homeView == nil) { - _homeView = [[UIView alloc] initWithFrame:CGRectMake(0, 268, APP_SCREEN_WIDTH, 36)]; + _homeView = [[UIView alloc] initWithFrame:CGRectMake(0, GetRealHeight(268), APP_SCREEN_WIDTH, GetRealHeight(36))]; _homeView.backgroundColor = HEXCOLORA(0x232323, 1.0); - UIImageView *mUIImageView= [[UIImageView alloc] initWithFrame:CGRectMake(20, 4, 28, 28)]; + UIImageView *mUIImageView= [[UIImageView alloc] initWithFrame:CGRectMake(GetRealWidth(20), GetRealHeight(4), GetRealHeight(28), GetRealHeight(28))]; mUIImageView.image = [UIImage imageNamed:@"ic_esvideo_home"]; [mUIImageView setContentMode:UIViewContentModeScaleAspectFit]; [_homeView addSubview:mUIImageView]; @@ -244,7 +244,7 @@ - (UILabel *)homeUILabel{ if (_homeUILabel == nil) { - _homeUILabel = [[UILabel alloc] initWithFrame:CGRectMake(52, 8, APP_SCREEN_WIDTH - 100, 20)]; + _homeUILabel = [[UILabel alloc] initWithFrame:CGRectMake(GetRealWidth(52), 0, APP_SCREEN_WIDTH - GetRealWidth(100), _homeView.frame.size.height)]; _homeUILabel.font = [UIFont fontWithName:APP_UIFont size:12.0]; _homeUILabel.textColor = [UIColor whiteColor]; // _homeUILabel.text = @"1鏍�203"; @@ -256,7 +256,7 @@ - (UIButton *)screenshotImgBtn{ if (_screenshotImgBtn == nil) { - _screenshotImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(80, 404, 58, 58)]; + _screenshotImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(GetRealWidth(80), GetRealHeight(404), GetRealHeight(58), GetRealHeight(58))]; [_screenshotImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_takephoto_unselect"] forState:UIControlStateNormal]; // [_screenshotImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_takephoto_select"] forState:UIControlStateSelected]; [_screenshotImgBtn.imageView setContentMode:UIViewContentModeScaleAspectFit]; @@ -285,7 +285,7 @@ - (UIButton *)screenshotTextBtn{ if (_screenshotTextBtn == nil) { - _screenshotTextBtn = [[UIButton alloc] initWithFrame:CGRectMake(59, 470, 100, 21)]; + _screenshotTextBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, GetRealHeight(470), GetRealWidth(100), GetRealHeight(21))]; [_screenshotTextBtn setTitle:@"鎴浘" forState:UIControlStateNormal]; _screenshotTextBtn.titleLabel.textAlignment = NSTextAlignmentCenter; _screenshotTextBtn.titleLabel.font = [UIFont fontWithName:APP_UIFont size:15.0]; @@ -294,13 +294,14 @@ [_screenshotTextBtn addTarget:self action:@selector(screenshotAction) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; [_screenshotTextBtn addTarget:self action:@selector(screenshotDownAction) forControlEvents:UIControlEventTouchDown]; _screenshotTextBtn.adjustsImageWhenHighlighted = NO; + _screenshotTextBtn.center = CGPointMake(_screenshotImgBtn.center.x, GetRealHeight(484)); } return _screenshotTextBtn; } - (UIButton *)unlockImgBtn{ if (_unlockImgBtn == nil) { - _unlockImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(APP_SCREEN_WIDTH-138, 404, 58, 58)]; + _unlockImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(APP_SCREEN_WIDTH-GetRealWidth(80)- GetRealHeight(58), GetRealHeight(404), GetRealHeight(58), GetRealHeight(58))]; [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_unlock_unselect"] forState:UIControlStateNormal]; // [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_unlock_select"] forState:UIControlStateSelected]; [_unlockImgBtn.imageView setContentMode:UIViewContentModeScaleAspectFit]; @@ -328,7 +329,7 @@ - (UIButton *)unlockTextBtn{ if (_unlockTextBtn == nil) { - _unlockTextBtn = [[UIButton alloc] initWithFrame:CGRectMake(216, 470, 100, 21)]; + _unlockTextBtn = [[UIButton alloc] initWithFrame:CGRectMake(216, GetRealHeight(470), GetRealWidth(100), GetRealHeight(21))]; [_unlockTextBtn setTitle:@"寮�閿�" forState:UIControlStateNormal]; _unlockTextBtn.titleLabel.font = [UIFont fontWithName:APP_UIFont size:15.0]; _unlockTextBtn.titleLabel.textAlignment = NSTextAlignmentCenter; @@ -338,6 +339,8 @@ // [_unlockTextBtn setTitleColor:TextSelectColor forState:UIControlStateSelected]; [_unlockTextBtn addTarget:self action:@selector(unlockAction) forControlEvents:UIControlEventTouchUpInside]; [_unlockTextBtn addTarget:self action:@selector(unlockDownAction) forControlEvents:UIControlEventTouchDown]; + _unlockTextBtn.adjustsImageWhenHighlighted = NO; + _unlockTextBtn.center = CGPointMake(_unlockImgBtn.center.x, GetRealHeight(484)); } return _unlockTextBtn; } @@ -415,14 +418,14 @@ }); }; //闂ㄥ彛鏈轰細鏈夎棰戠殑闀垮楂橈紝鏄浐瀹氱殑锛堟殏鏃惰繕涓嶇‘瀹氾級 -// _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]; -// } + // for(UIView *view in [_es.showView subviews]) + // { + // [view removeFromSuperview]; + // } _es.delegate = self; ESVideo.shareInstance.snapImageCallback = snapImageCallback; _es.showView.backgroundColor = [UIColor whiteColor]; @@ -442,15 +445,15 @@ return; } //鍒濆鍖栬棰戦噰闆咰apture - [self requestAccessForAVMediaType:AVMediaTypeVideo]; - if (isAccessVideo) { - if(![_es initVideoCaptureSession]){ - NSLog(@"VideoCaptureSession 鍒濆鍖栧け璐�"); - } - } - //鍒濆鍖朅udioSession - _sessionHelper = [[AudioSessionHelper alloc]init]; - [_sessionHelper setAudioSession]; +// [self requestAccessForAVMediaType:AVMediaTypeVideo]; +// if (isAccessVideo) { +// if(![_es initVideoCaptureSession]){ +// NSLog(@"VideoCaptureSession 鍒濆鍖栧け璐�"); +// } +// } +// //鍒濆鍖朅udioSession +// _sessionHelper = [[AudioSessionHelper alloc]init]; +// [_sessionHelper setAudioSession]; //娣诲姞杩涘叆鍚庡彴锛屼腑鏂瓑閫氱煡 [self addObservers]; @@ -509,7 +512,12 @@ //鍦╲iewDidLoad涓� 璋冪敤requestAccessForAVMediaType: 鏄负浜嗚妭绾﹀垵濮嬪寲鐨勬椂闂� //鍦╲iewDidAppear涓皟鐢╮equestAccessForAVMediaType: 鏄负浜嗗脊鍑烘彁绀烘墦寮�鏉冮檺鐨凙lert //娴嬭瘯鐨勬椂鍊欏彂鐜板涓嬫儏鍐碉細濡傛灉鍙妸鎺堟潈鏂规硶鏀惧埌ViewDidAppear鏂规硶涓鐞嗭紝濡傛灉娌℃湁鎺堟潈鍦ㄥ垵濮嬪寲閲囬泦鍣ㄦ椂浼氬け璐ャ�傚悓鏍稟lertView浼氬洜涓篤iew娌℃湁didLoad鑰屽鑷磒resent涓嶅嚭鏉� - if (!isAccessVideo || !isAccessAudio) { + +// if (!isAccessVideo || !isAccessAudio) { +// [self requestAccessForAVMedia]; +// } + + if (!isAccessAudio) { [self requestAccessForAVMedia]; } } @@ -530,11 +538,11 @@ _es.delegate = nil; ESVideo.shareInstance.snapImageCallback = nil; -// _es.showView.removeFromSuperview; + // _es.showView.removeFromSuperview; } - -// [_es freeSubClass]; + + // [_es freeSubClass]; } -(void)dealloc{ @@ -645,7 +653,7 @@ // If media services were reset, and the last start succeeded, restart the session. if (error.code == AVErrorMediaServicesWereReset) { [_es onStopCapture]; - [_es startTalk]; + [_es stopTalk]; } } @@ -776,10 +784,12 @@ // } if(!_isSpeaking){ - result = [_sessionHelper speaker:YES]; +// result = [_sessionHelper speaker:YES]; + [_es resetAudioCaptureIsSpeak:YES]; _isSpeaking = YES; }else{ - result = [_sessionHelper speaker:NO]; +// result = [_sessionHelper speaker:NO]; + [_es resetAudioCaptureIsSpeak:NO]; _isSpeaking = NO; } if (result) { @@ -828,30 +838,37 @@ // 杩欓噷鏄�冭檻鍒扮敤鎴锋病鏈夋巿鏉冿紝涔嬪悗閫氳繃AlertAction璺宠浆鍒拌缃〉闈㈡巿鏉冨悗鍐嶅洖鍒癆PP鏃跺仛鐨勯噸鏂版娴� //璺宠浆鍒拌缃〉闈紝鎺堟潈鍚庤繑鍥為〉闈紝缁х画鍒濆鍖栭噰闆嗗櫒 - if (isAccessAudio && isAccessVideo) { - return; - } - if (isAccessVideo && !isAccessAudio) { + if(!isAccessAudio){ [self requestAccessForAVMediaType:AVMediaTypeAudio]; if (isAccessAudio) { [_es initAudioCaptureSession]; } - }else if (!isAccessVideo && isAccessAudio){ - [self requestAccessForAVMediaType:AVMediaTypeVideo]; - if (isAccessVideo) { - [_es initVideoCaptureSession]; - } - - }else if (!isAccessVideo && !isAccessAudio){ - [self requestAccessForAVMediaType:AVMediaTypeAudio]; - [self requestAccessForAVMediaType:AVMediaTypeVideo]; - if (isAccessAudio) { - [_es initAudioCaptureSession]; - } - if (isAccessVideo) { - [_es initVideoCaptureSession]; - } } + +// if (isAccessAudio && isAccessVideo) { +// return; +// } +// if (isAccessVideo && !isAccessAudio) { +// [self requestAccessForAVMediaType:AVMediaTypeAudio]; +// if (isAccessAudio) { +// [_es initAudioCaptureSession]; +// } +// }else if (!isAccessVideo && isAccessAudio){ +//// [self requestAccessForAVMediaType:AVMediaTypeVideo]; +//// if (isAccessVideo) { +//// [_es initVideoCaptureSession]; +//// } +// +// }else if (!isAccessVideo && !isAccessAudio){ +// [self requestAccessForAVMediaType:AVMediaTypeAudio]; +//// [self requestAccessForAVMediaType:AVMediaTypeVideo]; +// if (isAccessAudio) { +// [_es initAudioCaptureSession]; +// } +//// if (isAccessVideo) { +//// [_es initVideoCaptureSession]; +//// } +// } } - (void)willEnterBackground:(NSNotification *)notification { isBackGround = YES; @@ -862,9 +879,9 @@ if (!isAccessAudio) { [self requestAccessForAVMediaType:AVMediaTypeAudio]; } - if (!isAccessVideo) { - [self requestAccessForAVMediaType:AVMediaTypeVideo]; - } +// if (!isAccessVideo) { +//// [self requestAccessForAVMediaType:AVMediaTypeVideo]; +// } if (!iSAudioNotDetermined && iSVideoNotDetermined){ [self creatAlertViewWith:@"鎺堟潈璇锋眰" message:@"楹﹀厠椋庢病鏈夋巿鏉�,璇峰湪璁剧疆涓紑鍚潈闄�,鍚﹀垯灏嗗奖鍝嶉�氳鍔熻兘銆�" cancel:@"纭畾"]; }else if(iSAudioNotDetermined && !iSVideoNotDetermined){ -- Gitblit v1.8.0