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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
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