// // 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