2020-07-02 1.更新最新SDK。 2.参试封装工具类,只初始化一次SDK方案,暂时解决SDK无法释放问题。
8个文件已添加
2个文件已删除
17个文件已修改
2 文件已重命名
| | |
| | | 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 */; }; |
| | |
| | | |
| | | /* 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>"; }; |
| | |
| | | C3385922233DAF06006940C3 /* ESVideoPhoneSDKDemo */ = { |
| | | isa = PBXGroup; |
| | | children = ( |
| | | B96CCD7924A88EAD00FCCEBF /* ESVideo.h */, |
| | | B96CCD7824A88EAD00FCCEBF /* ESVideo.m */, |
| | | C3385923233DAF06006940C3 /* AppDelegate.h */, |
| | | C3385924233DAF06006940C3 /* AppDelegate.m */, |
| | | C3385926233DAF06006940C3 /* SceneDelegate.h */, |
| | |
| | | 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 */, |
New file |
| | |
| | | // |
| | | // 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 |
New file |
| | |
| | | // |
| | | // 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 |
| | | |
| | |
| | | #import <ESVideoPhoneSDk/ESVideoPhone.h> |
| | | #import <ESVideoPhoneSDk/ESError.h> |
| | | #import "AudioSessionHelper.h" |
| | | #import "ESVideo.h" |
| | | |
| | | @interface ViewController ()<ESVideoPhoneDelegate,UITextFieldDelegate> |
| | | |
| | |
| | | } |
| | | - (void)viewDidLoad { |
| | | [super viewDidLoad]; |
| | | |
| | | [ESVideo.shareInstance initSDK]; |
| | | //初始化中断,进入后台的tag |
| | | _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; //⚠️这里必须要检查是否已经授权否则会失败,初始化视频音频采集 |
| | |
| | | }); |
| | | }; |
| | | //门口机会有视频的长宽高,是固定的(暂时还不确定) |
| | | _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 初始化失败"); |
| | |
| | | [_es stopTalk]; |
| | | } |
| | | -(void)dealloc{ |
| | | _es.delegate = nil; |
| | | // _es.showView |
| | | NSLog(@"==============dealloc1"); |
| | | [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| | | NSLog(@"==============dealloc2"); |
| | | [_es freeSubClass]; |
| | | // [_es freeSubClass]; |
| | | NSLog(@"==============dealloc3"); |
| | | } |
| | | |
| | |
| | | // |
| | | // 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> |
| | |
| | | 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 */; }; |
| | |
| | | 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>"; }; |
| | |
| | | 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 */, |
| | |
| | | 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>"; |
| | |
| | | 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; |
| | |
| | | <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> |
New file |
| | |
| | | // |
| | | // 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 |
New file |
| | |
| | | // |
| | | // 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 |
| | | |
| | |
| | | #import <Photos/Photos.h> |
| | | #import "AudioSessionHelper.h" |
| | | #import "CBToast.h" |
| | | #import "ESVideo.h" |
| | | |
| | | @interface ESVideoMonitorViewController ()<ESVideoPhoneDelegate> |
| | | |
| | |
| | | #pragma SDK可视对讲 功能部分 |
| | | -(void)initESVideo{ |
| | | //初始化中断,进入后台的tag |
| | | _es = ESVideo.shareInstance.es; |
| | | |
| | | _playing = NO; |
| | | _isSpeaking = NO; |
| | | self.isInterrupt = NO; |
| | |
| | | }); |
| | | }; |
| | | //门口机会有视频的长宽高,是固定的(暂时还不确定) |
| | | _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 初始化失败"); |
| | |
| | | [_es stopTalk]; |
| | | |
| | | _es.delegate = nil; |
| | | |
| | | |
| | | ESVideo.shareInstance.snapImageCallback = nil; |
| | | // _es.showView.removeFromSuperview; |
| | | |
| | | } |
| | | [_es freeSubClass]; |
| | | |
| | | // [_es freeSubClass]; |
| | | } |
| | | |
| | | -(void)dealloc{ |
| | |
| | | }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"]){ |
| | | |
| | | |
| | |
| | | #import "AudioSessionHelper.h" |
| | | #import <Photos/Photos.h> |
| | | #import <AudioToolbox/AudioToolbox.h> |
| | | |
| | | #import "ESVideo.h" |
| | | |
| | | |
| | | |
| | |
| | | NSString * answerStr; |
| | | NSString * unlockSuccessfullyStr; |
| | | NSString * callingStr; |
| | | NSString * hangUpStr; |
| | | // int openDoorTimeout; |
| | | //全局变量 |
| | | SystemSoundID sound; |
| | |
| | | operationFailedStr = @"操作失败"; |
| | | refuseStr = @"拒绝"; |
| | | answerStr = @"接听"; |
| | | hangUpStr = @"挂断"; |
| | | unlockSuccessfullyStr = @"开锁成功"; |
| | | callingStr = @"来电中..."; |
| | | }else{ |
| | |
| | | operationFailedStr = @"Operation failed."; |
| | | refuseStr = @"Refuse"; |
| | | answerStr = @"Answer"; |
| | | hangUpStr = @"Hang up"; |
| | | unlockSuccessfullyStr = @"Unlock successfully"; |
| | | callingStr = @"Incoming call"; |
| | | |
| | |
| | | //挂断按钮移动中间 |
| | | _hangUpImgBtn.frame = CGRectMake(159, 448, 58, 58); |
| | | _hangUpTextBtn.frame = CGRectMake(138, 514, 100, 21); |
| | | |
| | | [_hangUpTextBtn setTitle:hangUpStr forState:UIControlStateNormal]; |
| | | //开始计时 |
| | | _callTimeout = 0; |
| | | [self startCountdown]; |
| | |
| | | |
| | | #pragma SDK可视对讲 功能部分 |
| | | -(void)initESVideo{ |
| | | _es = ESVideo.shareInstance.es; |
| | | //初始化中断,进入后台的tag |
| | | |
| | | |
| | | _playing = NO; |
| | | _isSpeaking = NO; |
| | | self.isInterrupt = NO; |
| | |
| | | }); |
| | | }; |
| | | //门口机会有视频的长宽高,是固定的(暂时还不确定) |
| | | _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 初始化失败"); |
| | |
| | | |
| | | } |
| | | |
| | | -(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{ |
| | |
| | | [_es stopTalk]; |
| | | |
| | | _es.delegate = nil; |
| | | |
| | | ESVideo.shareInstance.snapImageCallback = nil; |
| | | |
| | | |
| | | } |
| | | [_es freeSubClass]; |
| | | // [_es freeSubClass]; |
| | | } |
| | | -(void)dealloc{ |
| | | [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| | |
| | | NSString *phoneEventStr = eventArray.lastObject; |
| | | |
| | | if([phoneEventStr isEqual:@"EVT_Ringing"]){ |
| | | _es.showView.hidden = NO; |
| | | //反呼成功 允许接听 看需求是否需要播放铃声和震动 |
| | | [self setAnswerBtnEnable:YES]; |
| | | |
| | |
| | | } 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初始化OK,可以连接),EVT_P2POnlineStatusChangedonline=1 |
| | |
| | | #define IOS9 (TP_SYSTEM_VERSION >= 9.0) |
| | | #define IOS10 (TP_SYSTEM_VERSION >= 10.0) |
| | | |
| | | //是否是IPhoneX的设备 |
| | | #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] |
| | |
| | | #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" |
| | |
| | | |
| | | |
| | | #import "GDHDLUtlis.h" |
| | | |
| | | #import "ESVideo.h" |
| | | |
| | | |
| | | @interface OpenViewController () |
| | |
| | | - (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"; |
| | | |
| | | } |
| | | |
| | |
| | | // |
| | | // 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> |
| | |
| | | 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; }; |
| | |
| | | /* 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; }; |
| | |
| | | B956B46C248D28B70093C489 /* ESVideoPhoneSDKXamarin */ = { |
| | | isa = PBXGroup; |
| | | children = ( |
| | | B924EFB624AD6B6800E402C4 /* ESVideo.h */, |
| | | B924EFB524AD6B6700E402C4 /* ESVideo.m */, |
| | | B958D92D249378D800A62567 /* CBToast.h */, |
| | | B958D92E249378D800A62567 /* CBToast.m */, |
| | | B958D92A249378B200A62567 /* AudioSessionHelper.h */, |
| | |
| | | B956B486248D2B780093C489 /* ESvideoVideoIntercomViewController.m in Sources */, |
| | | B956B487248D2B780093C489 /* ESVideoMonitorViewController.m in Sources */, |
| | | B958D92C249378B200A62567 /* AudioSessionHelper.m in Sources */, |
| | | B924EFB724AD6B6800E402C4 /* ESVideo.m in Sources */, |
| | | ); |
| | | runOnlyForDeploymentPostprocessing = 0; |
| | | }; |
New file |
| | |
| | | // |
| | | // 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 |
New file |
| | |
| | | // |
| | | // 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 |
| | | |
| | |
| | | #import <Photos/Photos.h> |
| | | #import "AudioSessionHelper.h" |
| | | #import "CBToast.h" |
| | | #import "ESVideo.h" |
| | | |
| | | @interface ESVideoMonitorViewController ()<ESVideoPhoneDelegate> |
| | | |
| | |
| | | |
| | | -(void)backAction{ |
| | | [self.navigationController popViewControllerAnimated:true]; |
| | | // [self dismissViewControllerAnimated:YES completion:NULL]; |
| | | // [self dismissViewControllerAnimated:YES completion:NULL]; |
| | | } |
| | | |
| | | - (UIButton *)moreButton{ |
| | |
| | | |
| | | - (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]; |
| | |
| | | #pragma SDK可视对讲 功能部分 |
| | | -(void)initESVideo{ |
| | | //初始化中断,进入后台的tag |
| | | _es = ESVideo.shareInstance.es; |
| | | |
| | | _playing = NO; |
| | | _isSpeaking = NO; |
| | | self.isInterrupt = NO; |
| | |
| | | }); |
| | | }; |
| | | //门口机会有视频的长宽高,是固定的(暂时还不确定) |
| | | _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 初始化失败"); |
| | |
| | | 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]; |
| | | } |
| | | |
| | | |
| | |
| | | [_es stopTalk]; |
| | | |
| | | _es.delegate = nil; |
| | | |
| | | |
| | | ESVideo.shareInstance.snapImageCallback = nil; |
| | | // _es.showView.removeFromSuperview; |
| | | |
| | | } |
| | | [_es freeSubClass]; |
| | | |
| | | // [_es freeSubClass]; |
| | | } |
| | | |
| | | -(void)dealloc{ |
| | |
| | | }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]; |
| | |
| | | #import "AudioSessionHelper.h" |
| | | #import <Photos/Photos.h> |
| | | #import <AudioToolbox/AudioToolbox.h> |
| | | |
| | | #import "ESVideo.h" |
| | | |
| | | |
| | | |
| | |
| | | NSString * refuseStr; |
| | | NSString * answerStr; |
| | | NSString * unlockSuccessfullyStr; |
| | | NSString * callingStr; |
| | | NSString * hangUpStr; |
| | | // int openDoorTimeout; |
| | | //全局变量 |
| | | SystemSoundID sound; |
| | |
| | | [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. |
| | | } |
| | | |
| | |
| | | operationFailedStr = @"操作失败"; |
| | | refuseStr = @"拒绝"; |
| | | answerStr = @"接听"; |
| | | hangUpStr = @"挂断"; |
| | | unlockSuccessfullyStr = @"开锁成功"; |
| | | callingStr = @"来电中..."; |
| | | }else{ |
| | | tipStr = @"Prompt"; |
| | | okStr = @"OK"; |
| | |
| | | operationFailedStr = @"Operation failed."; |
| | | refuseStr = @"Refuse"; |
| | | answerStr = @"Answer"; |
| | | hangUpStr = @"Hang up"; |
| | | unlockSuccessfullyStr = @"Unlock successfully"; |
| | | callingStr = @"Incoming call"; |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | -(void)backAction{ |
| | | [self.navigationController popViewControllerAnimated:true]; |
| | | // [self dismissViewControllerAnimated:YES completion:NULL]; |
| | | |
| | | // [self dismissViewControllerAnimated:YES completion:NULL]; |
| | | |
| | | } |
| | | |
| | | - (UIButton *)moreButton{ |
| | |
| | | |
| | | - (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]; |
| | |
| | | //挂断按钮移动中间 |
| | | _hangUpImgBtn.frame = CGRectMake(159, 448, 58, 58); |
| | | _hangUpTextBtn.frame = CGRectMake(138, 514, 100, 21); |
| | | |
| | | [_hangUpTextBtn setTitle:hangUpStr forState:UIControlStateNormal]; |
| | | //开始计时 |
| | | _callTimeout = 0; |
| | | [self startCountdown]; |
| | |
| | | |
| | | -(void)ShowCalltimeBtn:(NSString*) mesStr { |
| | | if(_calltimeBtn.hidden) _calltimeBtn.hidden = NO; |
| | | |
| | | |
| | | [self setCalltimeButtonText:mesStr isTime:NO]; |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | { |
| | | [_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); |
| | | } |
| | |
| | | |
| | | #pragma SDK可视对讲 功能部分 |
| | | -(void)initESVideo{ |
| | | _es = ESVideo.shareInstance.es; |
| | | //初始化中断,进入后台的tag |
| | | |
| | | |
| | | _playing = NO; |
| | | _isSpeaking = NO; |
| | | self.isInterrupt = NO; |
| | |
| | | }); |
| | | }; |
| | | //门口机会有视频的长宽高,是固定的(暂时还不确定) |
| | | _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 初始化失败"); |
| | |
| | | [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]; |
| | | } |
| | | |
| | | |
| | |
| | | [_es stopTalk]; |
| | | |
| | | _es.delegate = nil; |
| | | |
| | | ESVideo.shareInstance.snapImageCallback = nil; |
| | | |
| | | |
| | | } |
| | | [_es freeSubClass]; |
| | | // [_es freeSubClass]; |
| | | } |
| | | -(void)dealloc{ |
| | | [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| | |
| | | NSString *phoneEventStr = eventArray.lastObject; |
| | | |
| | | if([phoneEventStr isEqual:@"EVT_Ringing"]){ |
| | | _es.showView.hidden = NO; |
| | | //反呼成功 允许接听 看需求是否需要播放铃声和震动 |
| | | [self setAnswerBtnEnable:YES]; |
| | | |
| | |
| | | } 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初始化OK,可以连接),EVT_P2POnlineStatusChangedonline=1 |
| | |
| | | #define IOS9 (TP_SYSTEM_VERSION >= 9.0) |
| | | #define IOS10 (TP_SYSTEM_VERSION >= 10.0) |
| | | |
| | | //是否是IPhoneX的设备 |
| | | #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] |
| | |
| | | #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" |
New file |
| | |
| | | // |
| | | // 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 |
New file |
| | |
| | | // |
| | | // 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 |
| | |
| | | // |
| | | // 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> |
| | |
| | | [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(); |
| | | } |
| | | } |
| | | |