1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//
//  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