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/Shared.IOS.ESVideoPhoneSDK/Library/libESVideoPhoneSDKXamarin.a | 0 xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideoMonitorViewController.m | 38 + ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/GDHDLUtlis.h | 20 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/ESVideo.h | 27 + xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/GDHDLUtlis.h | 20 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/OpenViewController.m | 8 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/CBToast.m | 0 xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESvideoVideoIntercomViewController.m | 57 ++- xamarin/Shared.IOS.ESVideoPhoneSDK/ApiDefinition.cs | 29 ++ ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/ESVideo.m | 75 +++++ ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideoMonitorViewController.m | 22 + xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/OpenViewController.m | 172 ++++++++++++ ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.pbxproj | 24 xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/OpenViewController.h | 17 + ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideo.m | 78 +++++ ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideo.h | 27 + ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/ViewController.mm | 20 + xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h | 2 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata | 8 xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin.xcodeproj/project.pbxproj | 6 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo.xcodeproj/project.pbxproj | 6 xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideo.h | 27 + /dev/null | 41 -- ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/CBToast.h | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESvideoVideoIntercomViewController.m | 31 + xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideo.m | 78 +++++ ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h | 2 ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h | 2 28 files changed, 720 insertions(+), 117 deletions(-) diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo.xcodeproj/project.pbxproj b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo.xcodeproj/project.pbxproj index ecfbd50..3fc228e 100644 --- a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo.xcodeproj/project.pbxproj +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + B96CCD7A24A88EAD00FCCEBF /* ESVideo.m in Sources */ = {isa = PBXBuildFile; fileRef = B96CCD7824A88EAD00FCCEBF /* ESVideo.m */; }; C3385925233DAF06006940C3 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C3385924233DAF06006940C3 /* AppDelegate.m */; }; C3385928233DAF06006940C3 /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C3385927233DAF06006940C3 /* SceneDelegate.m */; }; C338592B233DAF06006940C3 /* ViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = C338592A233DAF06006940C3 /* ViewController.mm */; }; @@ -42,6 +43,8 @@ /* Begin PBXFileReference section */ B924480E24934E5500F118F1 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + B96CCD7824A88EAD00FCCEBF /* ESVideo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESVideo.m; sourceTree = "<group>"; }; + B96CCD7924A88EAD00FCCEBF /* ESVideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESVideo.h; sourceTree = "<group>"; }; C3385920233DAF06006940C3 /* ESVideoPhoneSDKDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ESVideoPhoneSDKDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; C3385923233DAF06006940C3 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; C3385924233DAF06006940C3 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; @@ -121,6 +124,8 @@ C3385922233DAF06006940C3 /* ESVideoPhoneSDKDemo */ = { isa = PBXGroup; children = ( + B96CCD7924A88EAD00FCCEBF /* ESVideo.h */, + B96CCD7824A88EAD00FCCEBF /* ESVideo.m */, C3385923233DAF06006940C3 /* AppDelegate.h */, C3385924233DAF06006940C3 /* AppDelegate.m */, C3385926233DAF06006940C3 /* SceneDelegate.h */, @@ -299,6 +304,7 @@ buildActionMask = 2147483647; files = ( C338592B233DAF06006940C3 /* ViewController.mm in Sources */, + B96CCD7A24A88EAD00FCCEBF /* ESVideo.m in Sources */, C3385925233DAF06006940C3 /* AppDelegate.m in Sources */, C345D08B233EEE520079C82C /* AudioSessionHelper.m in Sources */, C3385936233DAF12006940C3 /* main.m in Sources */, diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/ESVideo.h b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/ESVideo.h new file mode 100644 index 0000000..5d89628 --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/ESVideo.h @@ -0,0 +1,27 @@ +// +// ESVideo.h +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/6/28. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import <Foundation/Foundation.h> +#import <ESVideoPhoneSDk/ESVideoPhone.h> +#import <ESVideoPhoneSDk/ESError.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface ESVideo : NSObject + +@property (nonatomic,strong) ESVideoPhone *es; +@property (nonatomic, copy) ImageCallback snapImageCallback; + + ++ (instancetype)shareInstance; ++ (void)haltSharedInstance; + +-(void)initSDK; + +@end +NS_ASSUME_NONNULL_END diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/ESVideo.m b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/ESVideo.m new file mode 100644 index 0000000..79c0429 --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/ESVideo.m @@ -0,0 +1,75 @@ +// +// ESVideo.m +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/6/28. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import "ESVideo.h" + + +#define WEAKSELF_AT __weak __typeof(&*self)weakSelf_AT = self; +@interface ESVideo() + + + + +@end + +static ESVideo *_sharedInstance = nil; +static dispatch_once_t _onceToken; + +@implementation ESVideo{ + ImageCallback mSnapImageCallback; +} + ++ (instancetype)shareInstance { + dispatch_once(&_onceToken, ^{ + _sharedInstance = [[ESVideo alloc] init]; + if(_sharedInstance) { + + } + NSLog(@"ESVideo ShareInstance Did Create %p",_sharedInstance); + }); + //NSLog(@"Access ESVideo %p",sharedInstance); + return _sharedInstance; +} + ++ (void)haltSharedInstance { + if (_sharedInstance) { + _sharedInstance = nil; + _onceToken = 0; + } +} + + +- (instancetype)init { + self = [super init]; + + WEAKSELF_AT + mSnapImageCallback = ^(UIImage *image){ + if(weakSelf_AT.snapImageCallback){ + weakSelf_AT.snapImageCallback(image); + } + }; + //闂ㄥ彛鏈轰細鏈夎棰戠殑闀垮楂橈紝鏄浐瀹氱殑锛堟殏鏃惰繕涓嶇‘瀹氾級 + _es = [[ESVideoPhone alloc]initESVideoPhoneWithFrame: CGRectMake(10, 100, [[UIScreen mainScreen] bounds].size.width-20, ([[UIScreen mainScreen] bounds].size.width-20)/4*3) delegate:nil imagecallBack:mSnapImageCallback]; + + + return self; +} + +- (void)dealloc { + NSLog(@"ESVideo SharedInstance Did Halted "); +} + +-(void)initSDK{ + + NSLog(@"ESVideo initSDK"); + +} + + +@end + diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/ViewController.mm b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/ViewController.mm index 8a04139..eadb201 100644 --- a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/ViewController.mm +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/ViewController.mm @@ -21,6 +21,7 @@ #import <ESVideoPhoneSDk/ESVideoPhone.h> #import <ESVideoPhoneSDk/ESError.h> #import "AudioSessionHelper.h" +#import "ESVideo.h" @interface ViewController ()<ESVideoPhoneDelegate,UITextFieldDelegate> @@ -49,18 +50,21 @@ } - (void)viewDidLoad { [super viewDidLoad]; - + [ESVideo.shareInstance initSDK]; //鍒濆鍖栦腑鏂紝杩涘叆鍚庡彴鐨則ag _playing = NO; _isSpeaking = NO; self.isInterrupt = NO; + _es = ESVideo.shareInstance.es; _es.isInterrupt = NO; isBackGround = NO; [_speakerBtn setTitle:@"鍚瓛" forState:UIControlStateNormal]; // _mCallOrAccept.enabled = NO; // _monitorBtn.enabled = NO; // _uIDTextField.text = @"JJY000016YWECG";//@"JJY000007FSEYX" 榛樿闂ㄥ彛鏈虹殑ID - _uIDTextField.text = @"JJY000003UYRBK";//@"JJY000007FSEYX" 榛樿闂ㄥ彛鏈虹殑ID +// _uIDTextField.text = @"JJY000017XLUXX";//@"JJY000007FSEYX" 榛樿闂ㄥ彛鏈虹殑ID + _uIDTextField.text = @"JJY000019VPLLF";//@"JJY000019VPLLF" 榛樿闂ㄥ彛鏈虹殑ID + // _uIDTextField.text = @"JJY000016YWECG";//@"JJY000016YWECG" 榛樿闂ㄥ彛鏈虹殑ID _uIDTextField.delegate = self; //鈿狅笍杩欓噷蹇呴』瑕佹鏌ユ槸鍚﹀凡缁忔巿鏉冨惁鍒欎細澶辫触锛屽垵濮嬪寲瑙嗛闊抽閲囬泦 @@ -74,12 +78,18 @@ }); }; //闂ㄥ彛鏈轰細鏈夎棰戠殑闀垮楂橈紝鏄浐瀹氱殑锛堟殏鏃惰繕涓嶇‘瀹氾級 - _es = [[ESVideoPhone alloc]initESVideoPhoneWithFrame:CGRectMake(10, 100, self.view.frame.size.width-20, (self.view.frame.size.width-20)/4*3) delegate:self imagecallBack:snapImageCallback]; +// _es = [[ESVideoPhone alloc]initESVideoPhoneWithFrame:CGRectMake(10, 100, self.view.frame.size.width-20, (self.view.frame.size.width-20)/4*3) delegate:self imagecallBack:snapImageCallback]; if (_es) { //鍒ゆ柇瑙嗛娓叉煋鏄惁鍒濆鍖栨垚鍔燂紝濡傛灉澶辫触浼氳蛋ESVideoPhoneDelegate鏂规硶 if (_es.showView) { +// _es.showView.frame = CGRectMake(10, 100, self.view.frame.size.width-20, (self.view.frame.size.width-20)/4*3); + ESVideo.shareInstance.snapImageCallback = snapImageCallback; + _es.showView.backgroundColor = [UIColor greenColor]; _es.delegate = self; [self.view addSubview:_es.showView]; + }else{ + NSLog(@"_es.showView null"); + } }else{ NSLog(@"ESVideoPhone 鍒濆鍖栧け璐�"); @@ -128,10 +138,12 @@ [_es stopTalk]; } -(void)dealloc{ + _es.delegate = nil; +// _es.showView NSLog(@"==============dealloc1"); [[NSNotificationCenter defaultCenter] removeObserver:self]; NSLog(@"==============dealloc2"); - [_es freeSubClass]; +// [_es freeSubClass]; NSLog(@"==============dealloc3"); } diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h index 11f1d89..5e92338 100644 --- a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h @@ -4,7 +4,7 @@ // // Created by maygion on 2019/3/26. // Copyright 漏 2019 eTouchSky. All rights reserved. -// SDK鐗堟湰鍙凤細1.0.0 娴嬭瘯鐗�1 +// SDK鐗堟湰鍙凤細1.1.0 #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.pbxproj b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.pbxproj index 8a6b087..45effcf 100644 --- a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.pbxproj +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.pbxproj @@ -11,8 +11,8 @@ B919F6612490EEA1007261A9 /* OpenViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B919F65A2490EEA1007261A9 /* OpenViewController.m */; }; B919F6622490EEA1007261A9 /* ESVideoMonitorViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B919F65E2490EEA1007261A9 /* ESVideoMonitorViewController.m */; }; B924481124934E6A00F118F1 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B924481024934E6A00F118F1 /* AudioToolbox.framework */; }; - B9D0814024912E9800EBD71F /* CBToast.m in Sources */ = {isa = PBXBuildFile; fileRef = B9D0813F24912E9800EBD71F /* CBToast.m */; }; - B9D081432491D78B00EBD71F /* ESVideoSDK.m in Sources */ = {isa = PBXBuildFile; fileRef = B9D081422491D78B00EBD71F /* ESVideoSDK.m */; }; + B924EFB324AD6B3800E402C4 /* CBToast.m in Sources */ = {isa = PBXBuildFile; fileRef = B924EFB024AD6B3700E402C4 /* CBToast.m */; }; + B924EFB424AD6B3800E402C4 /* ESVideo.m in Sources */ = {isa = PBXBuildFile; fileRef = B924EFB224AD6B3800E402C4 /* ESVideo.m */; }; C3385925233DAF06006940C3 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C3385924233DAF06006940C3 /* AppDelegate.m */; }; C3385928233DAF06006940C3 /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C3385927233DAF06006940C3 /* SceneDelegate.m */; }; C338592B233DAF06006940C3 /* ViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = C338592A233DAF06006940C3 /* ViewController.mm */; }; @@ -55,10 +55,10 @@ B919F65E2490EEA1007261A9 /* ESVideoMonitorViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ESVideoMonitorViewController.m; path = ESVideoPhoneSDKDemo/ZigBee/ESVideoMonitorViewController.m; sourceTree = SOURCE_ROOT; }; B919F65F2490EEA1007261A9 /* GDHDLUtlis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GDHDLUtlis.h; path = ESVideoPhoneSDKDemo/ZigBee/GDHDLUtlis.h; sourceTree = SOURCE_ROOT; }; B924481024934E6A00F118F1 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; - B9D0813E24912E9800EBD71F /* CBToast.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CBToast.h; sourceTree = "<group>"; }; - B9D0813F24912E9800EBD71F /* CBToast.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CBToast.m; sourceTree = "<group>"; }; - B9D081412491D78A00EBD71F /* ESVideoSDK.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ESVideoSDK.h; sourceTree = "<group>"; }; - B9D081422491D78B00EBD71F /* ESVideoSDK.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ESVideoSDK.m; sourceTree = "<group>"; }; + B924EFAF24AD6B3700E402C4 /* CBToast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CBToast.h; path = ESVideoPhoneSDKDemo/ZigBee/CBToast.h; sourceTree = SOURCE_ROOT; }; + B924EFB024AD6B3700E402C4 /* CBToast.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CBToast.m; path = ESVideoPhoneSDKDemo/ZigBee/CBToast.m; sourceTree = SOURCE_ROOT; }; + B924EFB124AD6B3800E402C4 /* ESVideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ESVideo.h; path = ESVideoPhoneSDKDemo/ZigBee/ESVideo.h; sourceTree = SOURCE_ROOT; }; + B924EFB224AD6B3800E402C4 /* ESVideo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ESVideo.m; path = ESVideoPhoneSDKDemo/ZigBee/ESVideo.m; sourceTree = SOURCE_ROOT; }; C3385920233DAF06006940C3 /* HDLZigBeeESVideoDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HDLZigBeeESVideoDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; C3385923233DAF06006940C3 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; C3385924233DAF06006940C3 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; @@ -118,6 +118,10 @@ B919F6582490EE7A007261A9 /* HDL */ = { isa = PBXGroup; children = ( + B924EFAF24AD6B3700E402C4 /* CBToast.h */, + B924EFB024AD6B3700E402C4 /* CBToast.m */, + B924EFB124AD6B3800E402C4 /* ESVideo.h */, + B924EFB224AD6B3800E402C4 /* ESVideo.m */, B919F65B2490EEA1007261A9 /* ESVideoMonitorViewController.h */, B919F65E2490EEA1007261A9 /* ESVideoMonitorViewController.m */, B919F65D2490EEA1007261A9 /* ESvideoVideoIntercomViewController.h */, @@ -125,10 +129,6 @@ B919F65F2490EEA1007261A9 /* GDHDLUtlis.h */, B919F65C2490EEA1007261A9 /* OpenViewController.h */, B919F65A2490EEA1007261A9 /* OpenViewController.m */, - B9D0813E24912E9800EBD71F /* CBToast.h */, - B9D0813F24912E9800EBD71F /* CBToast.m */, - B9D081412491D78A00EBD71F /* ESVideoSDK.h */, - B9D081422491D78B00EBD71F /* ESVideoSDK.m */, ); path = HDL; sourceTree = "<group>"; @@ -335,15 +335,15 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + B924EFB424AD6B3800E402C4 /* ESVideo.m in Sources */, B919F6612490EEA1007261A9 /* OpenViewController.m in Sources */, C338592B233DAF06006940C3 /* ViewController.mm in Sources */, - B9D081432491D78B00EBD71F /* ESVideoSDK.m in Sources */, C3385925233DAF06006940C3 /* AppDelegate.m in Sources */, - B9D0814024912E9800EBD71F /* CBToast.m in Sources */, C345D08B233EEE520079C82C /* AudioSessionHelper.m in Sources */, B919F6602490EEA1007261A9 /* ESvideoVideoIntercomViewController.m in Sources */, C3385936233DAF12006940C3 /* main.m in Sources */, C3385928233DAF06006940C3 /* SceneDelegate.m in Sources */, + B924EFB324AD6B3800E402C4 /* CBToast.m in Sources */, B919F6622490EEA1007261A9 /* ESVideoMonitorViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 77c97cf..4d80e0a 100644 --- a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,12 @@ <Workspace version = "1.0"> <FileRef - location = "self:ESVideoPhoneSDKDemo.xcodeproj"> + location = "group:/Users/jlchen/JLChen/ProjectsCode/HDLGit/ESVideoPhoneSDKProject/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/ESVideo.h"> + </FileRef> + <FileRef + location = "group:/Users/jlchen/JLChen/ProjectsCode/HDLGit/ESVideoPhoneSDKProject/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/ESVideo.m"> + </FileRef> + <FileRef + location = "self:"> </FileRef> </Workspace> diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/ESVideoSDK.h b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/ESVideoSDK.h deleted file mode 100644 index 46057f7..0000000 --- a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/ESVideoSDK.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// ESVideoSDK.h -// ESVideoPhoneSDKDemo -// -// Created by 闄堝槈涔� on 2020/6/11. -// Copyright 漏 2020 eTouchSky. All rights reserved. -// - -#import <Foundation/Foundation.h> -#import <ESVideoPhoneSDk/ESVideoPhone.h> -#import <ESVideoPhoneSDk/ESError.h> - -NS_ASSUME_NONNULL_BEGIN - -@interface ESVideoSDK : NSObject - -//閿欒淇℃伅 -@property(nonatomic,weak) id<ESVideoPhoneDelegate> delegate; - -+(instancetype) shareInstance; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/ESVideoSDK.m b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/ESVideoSDK.m deleted file mode 100644 index b33db12..0000000 --- a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/ESVideoSDK.m +++ /dev/null @@ -1,41 +0,0 @@ -// -// ESVideoSDK.m -// ESVideoPhoneSDKDemo -// -// Created by 闄堝槈涔� on 2020/6/11. -// Copyright 漏 2020 eTouchSky. All rights reserved. -// - -#import "ESVideoSDK.h" -#import "GDHDLUtlis.h" - -@interface ESVideoSDK() - -@property (nonatomic,strong) ESVideoPhone *es; - - -@end - -@implementation ESVideoSDK - -static ESVideoSDK* _instance = nil; - - - -+(instancetype) shareInstance -{ - static dispatch_once_t onceToken ; - dispatch_once(&onceToken, ^{ - _instance = [[super allocWithZone:NULL] init] ; - - }) ; - - return _instance ; -} - --(void)initSDK -{ -// _es = [[ESVideoPhone alloc]initESVideoPhoneWithFrame:CGRectMake(0, 57, APP_SCREEN_WIDTH, 211) delegate:d imagecallBack:snapImageCallback]; -} - -@end diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/CBToast.h b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/CBToast.h similarity index 100% rename from ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/CBToast.h rename to ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/CBToast.h diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/CBToast.m b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/CBToast.m similarity index 100% rename from ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/CBToast.m rename to ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/CBToast.m diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideo.h b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideo.h new file mode 100644 index 0000000..5d89628 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideo.h @@ -0,0 +1,27 @@ +// +// ESVideo.h +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/6/28. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import <Foundation/Foundation.h> +#import <ESVideoPhoneSDk/ESVideoPhone.h> +#import <ESVideoPhoneSDk/ESError.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface ESVideo : NSObject + +@property (nonatomic,strong) ESVideoPhone *es; +@property (nonatomic, copy) ImageCallback snapImageCallback; + + ++ (instancetype)shareInstance; ++ (void)haltSharedInstance; + +-(void)initSDK; + +@end +NS_ASSUME_NONNULL_END diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideo.m b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideo.m new file mode 100644 index 0000000..06a66a5 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideo.m @@ -0,0 +1,78 @@ +// +// ESVideo.m +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/6/28. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import "ESVideo.h" + + +#define WEAKSELF_AT __weak __typeof(&*self)weakSelf_AT = self; +@interface ESVideo() + + + + +@end + +static ESVideo *_sharedInstance = nil; +static dispatch_once_t _onceToken; + +@implementation ESVideo{ + ImageCallback mSnapImageCallback; +} + ++ (instancetype)shareInstance { + dispatch_once(&_onceToken, ^{ + _sharedInstance = [[ESVideo alloc] init]; + if(_sharedInstance) { + + } + NSLog(@"ESVideo ShareInstance Did Create %p",_sharedInstance); + }); + //NSLog(@"Access ESVideo %p",sharedInstance); + return _sharedInstance; +} + ++ (void)haltSharedInstance { + if (_sharedInstance) { +// if(_sharedInstance.es){ +// [_sharedInstance.es freeSubClass]; +// } + _sharedInstance = nil; + _onceToken = 0; + } +} + + +- (instancetype)init { + self = [super init]; + + WEAKSELF_AT + mSnapImageCallback = ^(UIImage *image){ + if(weakSelf_AT.snapImageCallback){ + weakSelf_AT.snapImageCallback(image); + } + }; + //闂ㄥ彛鏈轰細鏈夎棰戠殑闀垮楂橈紝鏄浐瀹氱殑锛堟殏鏃惰繕涓嶇‘瀹氾級 + _es = [[ESVideoPhone alloc]initESVideoPhoneWithFrame: CGRectMake(0, 57, [[UIScreen mainScreen] bounds].size.width, 211) delegate:nil imagecallBack:mSnapImageCallback]; + + + return self; +} + +- (void)dealloc { + NSLog(@"ESVideo SharedInstance Did Halted "); +} + +-(void)initSDK{ + + NSLog(@"ESVideo initSDK"); + +} + + +@end + diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideoMonitorViewController.m b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideoMonitorViewController.m index 74b4448..07eed88 100644 --- a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideoMonitorViewController.m +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideoMonitorViewController.m @@ -15,6 +15,7 @@ #import <Photos/Photos.h> #import "AudioSessionHelper.h" #import "CBToast.h" +#import "ESVideo.h" @interface ESVideoMonitorViewController ()<ESVideoPhoneDelegate> @@ -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 鍒濆鍖栧け璐�"); @@ -520,11 +529,12 @@ [_es stopTalk]; _es.delegate = nil; - - + ESVideo.shareInstance.snapImageCallback = nil; +// _es.showView.removeFromSuperview; } - [_es freeSubClass]; + +// [_es freeSubClass]; } -(void)dealloc{ @@ -560,6 +570,10 @@ }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"]){ diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESvideoVideoIntercomViewController.m b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESvideoVideoIntercomViewController.m index 7bdb545..bf1c7be 100644 --- a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESvideoVideoIntercomViewController.m +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESvideoVideoIntercomViewController.m @@ -14,7 +14,7 @@ #import "AudioSessionHelper.h" #import <Photos/Photos.h> #import <AudioToolbox/AudioToolbox.h> - +#import "ESVideo.h" @@ -81,6 +81,7 @@ NSString * answerStr; NSString * unlockSuccessfullyStr; NSString * callingStr; + NSString * hangUpStr; // int openDoorTimeout; //鍏ㄥ眬鍙橀噺 SystemSoundID sound; @@ -113,6 +114,7 @@ operationFailedStr = @"鎿嶄綔澶辫触"; refuseStr = @"鎷掔粷"; answerStr = @"鎺ュ惉"; + hangUpStr = @"鎸傛柇"; unlockSuccessfullyStr = @"寮�閿佹垚鍔�"; callingStr = @"鏉ョ數涓�..."; }else{ @@ -122,6 +124,7 @@ operationFailedStr = @"Operation failed."; refuseStr = @"Refuse"; answerStr = @"Answer"; + hangUpStr = @"Hang up"; unlockSuccessfullyStr = @"Unlock successfully"; callingStr = @"Incoming call"; @@ -388,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]; @@ -579,7 +582,10 @@ #pragma SDK鍙瀵硅 鍔熻兘閮ㄥ垎 -(void)initESVideo{ + _es = ESVideo.shareInstance.es; //鍒濆鍖栦腑鏂紝杩涘叆鍚庡彴鐨則ag + + _playing = NO; _isSpeaking = NO; self.isInterrupt = NO; @@ -597,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 鍒濆鍖栧け璐�"); @@ -689,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{ @@ -715,11 +733,11 @@ [_es stopTalk]; _es.delegate = nil; - + ESVideo.shareInstance.snapImageCallback = nil; } - [_es freeSubClass]; +// [_es freeSubClass]; } -(void)dealloc{ [[NSNotificationCenter defaultCenter] removeObserver:self]; @@ -748,6 +766,7 @@ NSString *phoneEventStr = eventArray.lastObject; if([phoneEventStr isEqual:@"EVT_Ringing"]){ + _es.showView.hidden = NO; //鍙嶅懠鎴愬姛 鍏佽鎺ュ惉 鐪嬮渶姹傛槸鍚﹂渶瑕佹挱鏀鹃搩澹板拰闇囧姩 [self setAnswerBtnEnable:YES]; @@ -757,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 diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/GDHDLUtlis.h b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/GDHDLUtlis.h index 92b46e7..910f2b6 100644 --- a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/GDHDLUtlis.h +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/GDHDLUtlis.h @@ -13,8 +13,12 @@ #define IOS9 (TP_SYSTEM_VERSION >= 9.0) #define IOS10 (TP_SYSTEM_VERSION >= 10.0) -//鏄惁鏄疘PhoneX鐨勮澶� -#define IPhoneX ([[UIScreen mainScreen] bounds].size.height == 812) +//鏄惁鏄� iPhoneX_XS_11Pro璁惧 +#define IPhoneX ([UIScreen mainScreen].bounds.size.width == 375.0f && [UIScreen mainScreen].bounds.size.height == 812.0f) +//鏄惁鏄� iPhoneXSMax_XR_11_11ProMax +#define IPhoneXR ([UIScreen mainScreen].bounds.size.width == 414.0f && [UIScreen mainScreen].bounds.size.height == 896.0f) +// 鏄叏闈㈠睆鎵嬫満 +#define IsFullScreen (IPhoneX || IPhoneXR) // Screen #define APP_SCREEN_BOUNDS [[UIScreen mainScreen] bounds] @@ -22,15 +26,15 @@ #define APP_SCREEN_WIDTH (APP_SCREEN_BOUNDS.size.width) #define APP_STATUS_FRAME [UIApplication sharedApplication].statusBarFrame -#define APP_TOP_BAR_HEIGHT (IPhoneX ? 88 : (IOS7 ? 64 : 44)) -#define APP_STATUS_BAR_HEIGHT (IPhoneX ? 44: (IOS7 ? 20 : 0)) -#define APP_STATUS_BAR_HEIGHT_TURE (IPhoneX ? 44: (IOS7 ? 0 : 0)) +#define APP_TOP_BAR_HEIGHT (IsFullScreen ? 88 : (IOS7 ? 64 : 44)) +#define APP_STATUS_BAR_HEIGHT (IsFullScreen ? 44: (IOS7 ? 20 : 0)) +#define APP_STATUS_BAR_HEIGHT_TURE (IsFullScreen ? 44: (IOS7 ? 0 : 0)) #define APP_TOOL_BAR_HEIGHT 49 -#define APP_TAB_BAR_HEIGHT (IPhoneX ? (49 + 34): 49) +#define APP_TAB_BAR_HEIGHT (IsFullScreen ? (49 + 34): 49) #define APP_CONTENT_WIDTH (APP_SCREEN_BOUNDS.size.width) -#define APP_BUTTOM_HEIGHT (IPhoneX ? 34: 0) +#define APP_BUTTOM_HEIGHT (IsFullScreen ? 34: 0) #define APP_CONTENT_HEIGHT (APP_SCREEN_HEIGHT - APP_TOP_BAR_HEIGHT - APP_TAB_BAR_HEIGHT) -#define APP_VISIBLE_HEIGHT (APP_SCREEN_HEIGHT - APP_TOP_BAR_HEIGHT - APP_BUTTOM_HEIGHT) +#define APP_VISIBLE_HEIGHT (APP_SCREEN_HEIGHT - APP_TOP_BAR_HEIGHT -APP_BUTTOM_HEIGHT) #define APP_B_HEIGHT (APP_SCREEN_HEIGHT - APP_BUTTOM_HEIGHT) #define APP_UIFont @"PingFangSC-Regular" #define APP_UIFont_BOLD @"PingFangSC-Semibold" diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/OpenViewController.m b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/OpenViewController.m index e08f37f..1270e8e 100644 --- a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/OpenViewController.m +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/OpenViewController.m @@ -12,7 +12,7 @@ #import "GDHDLUtlis.h" - +#import "ESVideo.h" @interface OpenViewController () @@ -35,15 +35,17 @@ - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor whiteColor]; + + [ESVideo.shareInstance initSDK]; // Do any additional setup after loading the view. [self.view addSubview:self.monitorBtn]; [self.view addSubview:self.calledBtn]; // DEVICEID = @"JJY000017XLUXX"; - DEVICEID = @"JJY000003UYRBK"; + DEVICEID = @"JJY000019VPLLF"; - // DEVICEID = @"JJY000016YWECG"; +// DEVICEID = @"JJY000016YWECG"; } diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h index 11f1d89..5e92338 100644 --- a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h @@ -4,7 +4,7 @@ // // Created by maygion on 2019/3/26. // Copyright 漏 2019 eTouchSky. All rights reserved. -// SDK鐗堟湰鍙凤細1.0.0 娴嬭瘯鐗�1 +// SDK鐗堟湰鍙凤細1.1.0 #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin.xcodeproj/project.pbxproj b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin.xcodeproj/project.pbxproj index 22316d9..a5b880d 100644 --- a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin.xcodeproj/project.pbxproj +++ b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + B924EFB724AD6B6800E402C4 /* ESVideo.m in Sources */ = {isa = PBXBuildFile; fileRef = B924EFB524AD6B6700E402C4 /* ESVideo.m */; }; B956B47C248D2B400093C489 /* libiconv.2.4.0.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = B956B47B248D2B400093C489 /* libiconv.2.4.0.tbd */; platformFilter = ios; }; B956B47E248D2B4C0093C489 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = B956B47D248D2B4C0093C489 /* libz.tbd */; platformFilter = ios; }; B956B480248D2B570093C489 /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = B956B47F248D2B570093C489 /* libbz2.tbd */; platformFilter = ios; }; @@ -30,6 +31,8 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + B924EFB524AD6B6700E402C4 /* ESVideo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESVideo.m; sourceTree = "<group>"; }; + B924EFB624AD6B6800E402C4 /* ESVideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESVideo.h; sourceTree = "<group>"; }; B956B46A248D28B70093C489 /* libESVideoPhoneSDKXamarin.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libESVideoPhoneSDKXamarin.a; sourceTree = BUILT_PRODUCTS_DIR; }; B956B47B248D2B400093C489 /* libiconv.2.4.0.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.2.4.0.tbd; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/libiconv.2.4.0.tbd; sourceTree = DEVELOPER_DIR; }; B956B47D248D2B4C0093C489 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/libz.tbd; sourceTree = DEVELOPER_DIR; }; @@ -81,6 +84,8 @@ B956B46C248D28B70093C489 /* ESVideoPhoneSDKXamarin */ = { isa = PBXGroup; children = ( + B924EFB624AD6B6800E402C4 /* ESVideo.h */, + B924EFB524AD6B6700E402C4 /* ESVideo.m */, B958D92D249378D800A62567 /* CBToast.h */, B958D92E249378D800A62567 /* CBToast.m */, B958D92A249378B200A62567 /* AudioSessionHelper.h */, @@ -166,6 +171,7 @@ B956B486248D2B780093C489 /* ESvideoVideoIntercomViewController.m in Sources */, B956B487248D2B780093C489 /* ESVideoMonitorViewController.m in Sources */, B958D92C249378B200A62567 /* AudioSessionHelper.m in Sources */, + B924EFB724AD6B6800E402C4 /* ESVideo.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideo.h b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideo.h new file mode 100644 index 0000000..5d89628 --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideo.h @@ -0,0 +1,27 @@ +// +// ESVideo.h +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/6/28. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import <Foundation/Foundation.h> +#import <ESVideoPhoneSDk/ESVideoPhone.h> +#import <ESVideoPhoneSDk/ESError.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface ESVideo : NSObject + +@property (nonatomic,strong) ESVideoPhone *es; +@property (nonatomic, copy) ImageCallback snapImageCallback; + + ++ (instancetype)shareInstance; ++ (void)haltSharedInstance; + +-(void)initSDK; + +@end +NS_ASSUME_NONNULL_END diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideo.m b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideo.m new file mode 100644 index 0000000..06a66a5 --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideo.m @@ -0,0 +1,78 @@ +// +// ESVideo.m +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/6/28. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import "ESVideo.h" + + +#define WEAKSELF_AT __weak __typeof(&*self)weakSelf_AT = self; +@interface ESVideo() + + + + +@end + +static ESVideo *_sharedInstance = nil; +static dispatch_once_t _onceToken; + +@implementation ESVideo{ + ImageCallback mSnapImageCallback; +} + ++ (instancetype)shareInstance { + dispatch_once(&_onceToken, ^{ + _sharedInstance = [[ESVideo alloc] init]; + if(_sharedInstance) { + + } + NSLog(@"ESVideo ShareInstance Did Create %p",_sharedInstance); + }); + //NSLog(@"Access ESVideo %p",sharedInstance); + return _sharedInstance; +} + ++ (void)haltSharedInstance { + if (_sharedInstance) { +// if(_sharedInstance.es){ +// [_sharedInstance.es freeSubClass]; +// } + _sharedInstance = nil; + _onceToken = 0; + } +} + + +- (instancetype)init { + self = [super init]; + + WEAKSELF_AT + mSnapImageCallback = ^(UIImage *image){ + if(weakSelf_AT.snapImageCallback){ + weakSelf_AT.snapImageCallback(image); + } + }; + //闂ㄥ彛鏈轰細鏈夎棰戠殑闀垮楂橈紝鏄浐瀹氱殑锛堟殏鏃惰繕涓嶇‘瀹氾級 + _es = [[ESVideoPhone alloc]initESVideoPhoneWithFrame: CGRectMake(0, 57, [[UIScreen mainScreen] bounds].size.width, 211) delegate:nil imagecallBack:mSnapImageCallback]; + + + return self; +} + +- (void)dealloc { + NSLog(@"ESVideo SharedInstance Did Halted "); +} + +-(void)initSDK{ + + NSLog(@"ESVideo initSDK"); + +} + + +@end + 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]; diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESvideoVideoIntercomViewController.m b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESvideoVideoIntercomViewController.m index 63df999..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,11 +94,11 @@ [self initTopBarView]; [self initCentetView]; [self initData]; -// [self setAnswerBtnEnable:NO]; + // [self setAnswerBtnEnable:NO]; [self initESVideo]; //寮�濮嬪弽鍛� [self StartReverseCall]; - [self ShowCalltimeBtn:@"瀹ゅ鏈烘潵鐢典腑..."]; + [self ShowCalltimeBtn:callingStr]; // Do any additional setup after loading the view. } @@ -112,7 +114,9 @@ operationFailedStr = @"鎿嶄綔澶辫触"; refuseStr = @"鎷掔粷"; answerStr = @"鎺ュ惉"; + hangUpStr = @"鎸傛柇"; unlockSuccessfullyStr = @"寮�閿佹垚鍔�"; + callingStr = @"鏉ョ數涓�..."; }else{ tipStr = @"Prompt"; okStr = @"OK"; @@ -120,7 +124,10 @@ operationFailedStr = @"Operation failed."; refuseStr = @"Refuse"; answerStr = @"Answer"; + hangUpStr = @"Hang up"; unlockSuccessfullyStr = @"Unlock successfully"; + callingStr = @"Incoming call"; + } } @@ -152,8 +159,8 @@ -(void)backAction{ [self.navigationController popViewControllerAnimated:true]; -// [self dismissViewControllerAnimated:YES completion:NULL]; - + // [self dismissViewControllerAnimated:YES completion:NULL]; + } - (UIButton *)moreButton{ @@ -174,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]; @@ -384,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]; @@ -437,9 +444,9 @@ -(void)ShowCalltimeBtn:(NSString*) mesStr { if(_calltimeBtn.hidden) _calltimeBtn.hidden = NO; - + [self setCalltimeButtonText:mesStr isTime:NO]; - + } @@ -450,9 +457,9 @@ { [_calltimeBtn setTitle:mesStr forState:UIControlStateNormal]; if(isTime){ - _calltimeBtn.frame = CGRectMake(0, 0, 100, 30); + _calltimeBtn.frame = CGRectMake(0, 0, 80, 30); }else{ - _calltimeBtn.frame = CGRectMake(0, 0, 150, 30); + _calltimeBtn.frame = CGRectMake(0, 0, 115, 30); } _calltimeBtn.center = CGPointMake(APP_SCREEN_WIDTH/2, 397); } @@ -575,7 +582,10 @@ #pragma SDK鍙瀵硅 鍔熻兘閮ㄥ垎 -(void)initESVideo{ + _es = ESVideo.shareInstance.es; //鍒濆鍖栦腑鏂紝杩涘叆鍚庡彴鐨則ag + + _playing = NO; _isSpeaking = NO; self.isInterrupt = NO; @@ -593,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 鍒濆鍖栧け璐�"); @@ -680,9 +692,19 @@ [alertController addAction:[UIAlertAction actionWithTitle:okStr style:UIAlertActionStyleCancel handler:nil]]; [self presentViewController:alertController animated:YES completion:nil]; -// UIAlertView *alertView1 = [[UIAlertView alloc] initWithTitle:tipStr message:mes delegate:self cancelButtonTitle:okStr otherButtonTitles:nil, nil]; -// [alertView1 show]; + // UIAlertView *alertView1 = [[UIAlertView alloc] initWithTitle:tipStr message:mes delegate:self cancelButtonTitle:okStr otherButtonTitles:nil, nil]; + // [alertView1 show]; +} + +-(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]; } @@ -711,11 +733,11 @@ [_es stopTalk]; _es.delegate = nil; - + ESVideo.shareInstance.snapImageCallback = nil; } - [_es freeSubClass]; +// [_es freeSubClass]; } -(void)dealloc{ [[NSNotificationCenter defaultCenter] removeObserver:self]; @@ -744,6 +766,7 @@ NSString *phoneEventStr = eventArray.lastObject; if([phoneEventStr isEqual:@"EVT_Ringing"]){ + _es.showView.hidden = NO; //鍙嶅懠鎴愬姛 鍏佽鎺ュ惉 鐪嬮渶姹傛槸鍚﹂渶瑕佹挱鏀鹃搩澹板拰闇囧姩 [self setAnswerBtnEnable:YES]; @@ -753,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 diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/GDHDLUtlis.h b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/GDHDLUtlis.h index 92b46e7..910f2b6 100644 --- a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/GDHDLUtlis.h +++ b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/GDHDLUtlis.h @@ -13,8 +13,12 @@ #define IOS9 (TP_SYSTEM_VERSION >= 9.0) #define IOS10 (TP_SYSTEM_VERSION >= 10.0) -//鏄惁鏄疘PhoneX鐨勮澶� -#define IPhoneX ([[UIScreen mainScreen] bounds].size.height == 812) +//鏄惁鏄� iPhoneX_XS_11Pro璁惧 +#define IPhoneX ([UIScreen mainScreen].bounds.size.width == 375.0f && [UIScreen mainScreen].bounds.size.height == 812.0f) +//鏄惁鏄� iPhoneXSMax_XR_11_11ProMax +#define IPhoneXR ([UIScreen mainScreen].bounds.size.width == 414.0f && [UIScreen mainScreen].bounds.size.height == 896.0f) +// 鏄叏闈㈠睆鎵嬫満 +#define IsFullScreen (IPhoneX || IPhoneXR) // Screen #define APP_SCREEN_BOUNDS [[UIScreen mainScreen] bounds] @@ -22,15 +26,15 @@ #define APP_SCREEN_WIDTH (APP_SCREEN_BOUNDS.size.width) #define APP_STATUS_FRAME [UIApplication sharedApplication].statusBarFrame -#define APP_TOP_BAR_HEIGHT (IPhoneX ? 88 : (IOS7 ? 64 : 44)) -#define APP_STATUS_BAR_HEIGHT (IPhoneX ? 44: (IOS7 ? 20 : 0)) -#define APP_STATUS_BAR_HEIGHT_TURE (IPhoneX ? 44: (IOS7 ? 0 : 0)) +#define APP_TOP_BAR_HEIGHT (IsFullScreen ? 88 : (IOS7 ? 64 : 44)) +#define APP_STATUS_BAR_HEIGHT (IsFullScreen ? 44: (IOS7 ? 20 : 0)) +#define APP_STATUS_BAR_HEIGHT_TURE (IsFullScreen ? 44: (IOS7 ? 0 : 0)) #define APP_TOOL_BAR_HEIGHT 49 -#define APP_TAB_BAR_HEIGHT (IPhoneX ? (49 + 34): 49) +#define APP_TAB_BAR_HEIGHT (IsFullScreen ? (49 + 34): 49) #define APP_CONTENT_WIDTH (APP_SCREEN_BOUNDS.size.width) -#define APP_BUTTOM_HEIGHT (IPhoneX ? 34: 0) +#define APP_BUTTOM_HEIGHT (IsFullScreen ? 34: 0) #define APP_CONTENT_HEIGHT (APP_SCREEN_HEIGHT - APP_TOP_BAR_HEIGHT - APP_TAB_BAR_HEIGHT) -#define APP_VISIBLE_HEIGHT (APP_SCREEN_HEIGHT - APP_TOP_BAR_HEIGHT - APP_BUTTOM_HEIGHT) +#define APP_VISIBLE_HEIGHT (APP_SCREEN_HEIGHT - APP_TOP_BAR_HEIGHT -APP_BUTTOM_HEIGHT) #define APP_B_HEIGHT (APP_SCREEN_HEIGHT - APP_BUTTOM_HEIGHT) #define APP_UIFont @"PingFangSC-Regular" #define APP_UIFont_BOLD @"PingFangSC-Semibold" diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/OpenViewController.h b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/OpenViewController.h new file mode 100644 index 0000000..4c2e0ce --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/OpenViewController.h @@ -0,0 +1,17 @@ +// +// OpenViewController.h +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/6/1. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import <UIKit/UIKit.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface OpenViewController : UIViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/OpenViewController.m b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/OpenViewController.m new file mode 100644 index 0000000..1270e8e --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/OpenViewController.m @@ -0,0 +1,172 @@ +// +// OpenViewController.m +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/6/1. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import "OpenViewController.h" +#import "ESVideoMonitorViewController.h" +#import "ESvideoVideoIntercomViewController.h" + + +#import "GDHDLUtlis.h" +#import "ESVideo.h" + + +@interface OpenViewController () +@property (nonatomic, strong) UIButton *monitorBtn; // + +@property (nonatomic, strong) UIButton *calledBtn; // + +@property (nonatomic,assign) BOOL isCollect;//鏄惁鏀惰棌 + + + + +@end + +@implementation OpenViewController{ + NSString * DEVICEID; + +} + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = [UIColor whiteColor]; + + [ESVideo.shareInstance initSDK]; + // Do any additional setup after loading the view. + + [self.view addSubview:self.monitorBtn]; + [self.view addSubview:self.calledBtn]; + + // DEVICEID = @"JJY000017XLUXX"; + DEVICEID = @"JJY000019VPLLF"; + +// DEVICEID = @"JJY000016YWECG"; + +} + + +- (UIButton *)monitorBtn{ + if (_monitorBtn == nil) { + _monitorBtn = [[UIButton alloc] initWithFrame:CGRectMake(20, 200, APP_SCREEN_WIDTH-40, 50)]; + _monitorBtn.backgroundColor = TextSelectColor; + [_monitorBtn setTitle:@"鐩戞帶" forState:UIControlStateNormal]; + _monitorBtn.titleLabel.textAlignment = NSTextAlignmentCenter; + _monitorBtn.titleLabel.font = [UIFont fontWithName:APP_UIFont size:15.0]; + [_monitorBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + // [_screenshotTextBtn setTitleColor:TextSelectColor forState:UIControlStateSelected]; + [_monitorBtn addTarget:self action:@selector(monitorAction) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; + // [_monitorBtn addTarget:self action:@selector(screenshotDownAction) forControlEvents:UIControlEventTouchDown]; + _monitorBtn.adjustsImageWhenHighlighted = NO; + _monitorBtn.layer.cornerRadius = 25; + } + return _monitorBtn; +} + + + +-(void)monitorAction{ + + ESVideoMonitorViewController *mVc = [[ESVideoMonitorViewController alloc] init]; + // mVc.modalPresentationStyle = UIModalPresentationFullScreen; + // mVc.edgesForExtendedLayout = YES; + mVc.deviceName = @"瀹ゅ鏈�"; + mVc.roomName = @"2鏍�108"; + mVc.mESRoomID = 888; + + // mVc.mESVideoID = @"JJY000007FSEYX"; + // mVc.mESVideoID = @"JJY000016YWECG"; + // mVc.mESVideoID = @"JJY000016YWECG"; + mVc.mESVideoID = DEVICEID; + + + mVc.isCollect = self.isCollect; + + // [self.navigationController pushViewController:mVc animated:YES]; + mVc.collectButtonCallBack = ^(bool isCollect) { + self.isCollect = isCollect; + NSString *str; + if (isCollect) { + str = @"鏀惰棌"; + }else{ + str = @"鍙栨秷鏀惰棌"; + } + NSLog(@"CallBack%@",str); + }; + + // [self presentViewController:mVc animated:YES completion:nil]; + [self.navigationController pushViewController:mVc animated:YES]; + + + + +} + + + +- (UIButton *)calledBtn{ + if (_calledBtn == nil) { + _calledBtn = [[UIButton alloc] initWithFrame:CGRectMake(20, 300, APP_SCREEN_WIDTH-40, 50)]; + _calledBtn.backgroundColor = TextSelectColor; + [_calledBtn setTitle:@"琚懠鍙�" forState:UIControlStateNormal]; + _calledBtn.titleLabel.textAlignment = NSTextAlignmentCenter; + _calledBtn.titleLabel.font = [UIFont fontWithName:APP_UIFont size:15.0]; + [_calledBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + // [_screenshotTextBtn setTitleColor:TextSelectColor forState:UIControlStateSelected]; + [_calledBtn addTarget:self action:@selector(calledAction) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; + // [_monitorBtn addTarget:self action:@selector(screenshotDownAction) forControlEvents:UIControlEventTouchDown]; + _calledBtn.adjustsImageWhenHighlighted = NO; + _calledBtn.layer.cornerRadius = 25; + } + return _calledBtn; +} + + + + +-(void)calledAction{ + + ESvideoVideoIntercomViewController *mVc = [[ESvideoVideoIntercomViewController alloc] init]; + // mVc.modalPresentationStyle = UIModalPresentationFullScreen; + // mVc.edgesForExtendedLayout = YES; + mVc.deviceName = @"瀹ゅ鏈�2"; + mVc.roomName = @"3鏍�808"; + mVc.mESRoomID = 888; + // mVc.mESVideoID = @"JJY000007FSEYX"; + // mVc.mESVideoID = @"JJY000016YWECG"; + mVc.mESVideoID = DEVICEID; + mVc.isCollect = self.isCollect; + + // [self.navigationController pushViewController:mVc animated:YES]; + mVc.collectButtonCallBack = ^(bool isCollect) { + self.isCollect = isCollect; + NSString *str; + if (isCollect) { + str = @"鏀惰棌"; + }else{ + str = @"鍙栨秷鏀惰棌"; + } + NSLog(@"CallBack%@",str); + }; + + // [self presentViewController:mVc animated:YES completion:nil]; + [self.navigationController pushViewController:mVc animated:YES]; + +} + + +/* + #pragma mark - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. + } + */ + +@end diff --git a/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h b/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h index 11f1d89..5e92338 100644 --- a/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h +++ b/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h @@ -4,7 +4,7 @@ // // Created by maygion on 2019/3/26. // Copyright 漏 2019 eTouchSky. All rights reserved. -// SDK鐗堟湰鍙凤細1.0.0 娴嬭瘯鐗�1 +// SDK鐗堟湰鍙凤細1.1.0 #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> diff --git a/xamarin/Shared.IOS.ESVideoPhoneSDK/ApiDefinition.cs b/xamarin/Shared.IOS.ESVideoPhoneSDK/ApiDefinition.cs index 35d842f..267a4e5 100644 --- a/xamarin/Shared.IOS.ESVideoPhoneSDK/ApiDefinition.cs +++ b/xamarin/Shared.IOS.ESVideoPhoneSDK/ApiDefinition.cs @@ -128,5 +128,34 @@ [Export("collectButtonCallBack", ArgumentSemantic.Copy)] CollectButtonCallBack CollectButtonCallBack { get; set; } } + + + + // @interface ESVideo : NSObject + [BaseType(typeof(NSObject))] + interface ESVideo + { + //// @property (nonatomic, strong) int * _Nonnull es; + //[Export("es", ArgumentSemantic.Strong)] + //unsafe int* Es { get; set; } + + //// @property (copy, nonatomic) int snapImageCallback; + //[Export("snapImageCallback", ArgumentSemantic.Copy)] + //int SnapImageCallback { get; set; } + + // +(instancetype _Nonnull)shareInstance; + [Static] + [Export("shareInstance")] + ESVideo ShareInstance(); + + // +(void)haltSharedInstance; + [Static] + [Export("haltSharedInstance")] + void HaltSharedInstance(); + + // -(void)initSDK; + [Export("initSDK")] + void InitSDK(); + } } diff --git a/xamarin/Shared.IOS.ESVideoPhoneSDK/Library/libESVideoPhoneSDKXamarin.a b/xamarin/Shared.IOS.ESVideoPhoneSDK/Library/libESVideoPhoneSDKXamarin.a index 7a90b67..c90e56e 100644 --- a/xamarin/Shared.IOS.ESVideoPhoneSDK/Library/libESVideoPhoneSDKXamarin.a +++ b/xamarin/Shared.IOS.ESVideoPhoneSDK/Library/libESVideoPhoneSDKXamarin.a Binary files differ -- Gitblit v1.8.0