// // ESVideo.m // ESVideoPhoneSDKDemo // // Created by 陈嘉乐 on 2020/6/28. // Copyright © 2020 eTouchSky. All rights reserved. // #import "ESVideo.h" #import "GDHDLUtlis.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, GetRealHeight(57), [[UIScreen mainScreen] bounds].size.width, GetRealHeight(211)) delegate:nil imagecallBack:mSnapImageCallback]; return self; } - (void)dealloc { NSLog(@"ESVideo SharedInstance Did Halted "); } -(void)initSDK{ NSLog(@"ESVideo initSDK"); } @end