From dd29df2e08ac87c878e26513f1b5ae06eae7a6d9 Mon Sep 17 00:00:00 2001 From: Davin <591807572@qq.com> Date: 星期日, 25 六月 2023 19:54:32 +0800 Subject: [PATCH] feature UI调整 --- EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m | 842 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 715 insertions(+), 127 deletions(-) diff --git a/EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m b/EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m index a86a6a8..155f7c6 100644 --- a/EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m +++ b/EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m @@ -11,19 +11,21 @@ #import <Photos/Photos.h> #import "EZLivePlayViewController.h" #import "UIViewController+EZBackPop.h" -#import "EZDeviceInfo.h" -#import "EZPlayer.h" +#import <EZOpenSDKFramework/EZDeviceInfo.h> +#import <EZOpenSDKFramework/EZPlayer.h> #import "DDKit.h" #import "Masonry.h" #import "HIKLoadView.h" #import "MBProgressHUD.h" -#import "EZCameraInfo.h" +#import <EZOpenSDKFramework/EZCameraInfo.h> #import <AVFoundation/AVFoundation.h> #import "Toast+UIView.h" -#import "EZStreamPlayer.h" +#import <EZOpenSDKFramework/EZStreamPlayer.h> #import "MBProgressHUD.h" - - +#import <EZOpenSDKFramework/EZPMPlayPrivateTokenInfo.h> +#import "HDLEZAlertInputView.h" +#import "HDLEZOPButton.h" +#import "HDLEZVideoDoorToolView.h" #define MinimumZoomScale 1.0 #define MaximumZoomScale 4.0 @@ -32,6 +34,7 @@ { NSOperation *op; BOOL _isPressed; + BOOL _landscape; // 鏄惁鏃嬭浆 } @property (nonatomic) BOOL isOpenSound; @@ -47,6 +50,9 @@ @property (nonatomic, strong) HIKLoadView *loadingView; @property (nonatomic, weak) IBOutlet UIButton *playerPlayButton; @property (nonatomic, weak) IBOutlet UIView *playerView; +@property (weak, nonatomic) IBOutlet NSLayoutConstraint *playerViewWHRatio; +@property (weak, nonatomic) IBOutlet NSLayoutConstraint *playerViewBottomMargin; + @property (nonatomic, weak) IBOutlet UIView *toolBar; @property (nonatomic, weak) IBOutlet UIView *bottomView; @property (nonatomic, weak) IBOutlet UIButton *controlButton; @@ -88,7 +94,24 @@ @property (nonatomic, strong) EZCameraInfo *cameraInfo; @property (weak, nonatomic) IBOutlet UILabel *streamTypeLabel; @property (weak, nonatomic) IBOutlet UIScrollView *scrollView; +@property (weak, nonatomic) IBOutlet NSLayoutConstraint *scrollViewTopMargin; @property (weak, nonatomic) IBOutlet UILabel *zoomSizeLabel; +@property (weak, nonatomic) IBOutlet NSLayoutConstraint *scrollViewWHRatio; // 婊氬姩瑙嗗浘瀹介珮姣� +@property (nonatomic, strong) HDLEZButton *unlockButton;//寮�閿佹寜閽� + +@property (nonatomic, copy) NSString *streamToken; + +@property (nonatomic, strong) UIView *doorPlayerView;//闂ㄩ攣鎾斁view +@property (nonatomic, assign) CGFloat doorPlayerAspectRatio; // 闂ㄩ攣鎾斁瑙嗗浘瀹介珮姣� + +// 鍛煎彨瑙嗗浘鐩稿叧鎺т欢 +@property (weak, nonatomic) IBOutlet UIView *videoCallOutView; // 鍛煎彨寮规 +@property (weak, nonatomic) IBOutlet UILabel *callOutAlertLabel; // 鎻愮ず璇█ +@property (weak, nonatomic) IBOutlet HDLEZOPButton *hangUpButton; // 鎸傛柇鎸夐挳 +@property (weak, nonatomic) IBOutlet HDLEZOPButton *ignoreButton; // 蹇界暐鎸夐挳 +@property (weak, nonatomic) IBOutlet HDLEZOPButton *answerButton; // 鎺ュ惉鎸夐挳 + +@property (strong, nonatomic) HDLEZVideoDoorToolView *fullSceneToolView; // 鍏ㄥ睆宸ュ叿瑙嗗浘 @end @@ -109,121 +132,154 @@ self.isStartingTalk = NO; self.ptzView.hidden = YES; self.talkView.hidden = YES; + self.videoCallOutView.hidden = YES; + self.doorPlayerAspectRatio = HDLEZ_APP_SCREEN_WIDTH / HDLEZ_APP_SCREEN_HEIGHT; + _landscape = NO; - self.talkButton.enabled = self.deviceInfo.isSupportTalk; - self.controlButton.enabled = self.deviceInfo.isSupportPTZ; - self.captureButton.enabled = NO; - self.localRecordButton.enabled = NO; - self.streamPlayBtn.hidden = YES; + if (!self.deviceInfo) {//濡傛灉娌℃湁浼燿eviceInfo,闇�涓诲姩鑾峰彇 + [self getDeviceInfo]; + return; + } - if (_url) - { - _player = [EZOPENSDK createPlayerWithUrl:_url]; - } - else if([self.deviceInfo.deviceType containsString:@"CAS"]) //hub - { - _cameraInfo = [[EZCameraInfo alloc]init]; //鍏煎demo涔嬪墠鐨勪笟鍔¢�昏緫锛屾墜鍔ㄥ~鍏呬簡cameraInfo锛屽疄闄呭紑鍙戠洿鎺ヤ紶鍏ュ簭鍒楀彿鍜岄�氶亾鍙风敓鎴怑ZPlayer鍗冲彲 - _cameraInfo.deviceSerial = _hubCoDevSerial; - _cameraInfo.cameraNo = _cameraIndex; - _player = [EZOPENSDK createPlayerWithDeviceSerial:_cameraInfo.deviceSerial cameraNo:_cameraInfo.cameraNo]; - } - else - { - _cameraInfo = [self.deviceInfo.cameraInfo dd_objectAtIndex:_cameraIndex]; - _player = [EZOPENSDK createPlayerWithDeviceSerial:_cameraInfo.deviceSerial cameraNo:_cameraInfo.cameraNo]; - _talkPlayer = [EZOPENSDK createPlayerWithDeviceSerial:_cameraInfo.deviceSerial cameraNo:_cameraInfo.cameraNo]; - if (_cameraInfo.videoLevel == 2) - { - [self.qualityButton setTitle:NSLocalizedString(@"device_quality_high", @"楂樻竻") forState:UIControlStateNormal]; - } - else if (_cameraInfo.videoLevel == 1) - { - [self.qualityButton setTitle:NSLocalizedString(@"device_quality_median", @"鍧囪 ") forState:UIControlStateNormal]; - } - else - { - [self.qualityButton setTitle:NSLocalizedString(@"device_quality_low",@"娴佺晠") forState:UIControlStateNormal]; - } - } - if (_cameraInfo.cameraNo == 0 || [self.deviceInfo.deviceType containsString:@"CAS"]) { //涓嶆敮鎸佹竻鏅板害鍒囨崲 - self.qualityButton.hidden = YES; - } + //鍒濆鍖栫浉鍏虫暟鎹� + [self initialData]; + +// self.talkButton.enabled = self.deviceInfo.isSupportTalk; +// self.controlButton.enabled = self.deviceInfo.isSupportPTZ; +// self.captureButton.enabled = NO; +// self.localRecordButton.enabled = NO; +// self.streamPlayBtn.hidden = YES; +// +// if (_url) +// { +// _player = [EZOPENSDK createPlayerWithUrl:_url]; +// } +// else if([self.deviceInfo.deviceType containsString:@"CAS"]) //hub +// { +// _cameraInfo = [[EZCameraInfo alloc]init]; //鍏煎demo涔嬪墠鐨勪笟鍔¢�昏緫锛屾墜鍔ㄥ~鍏呬簡cameraInfo锛屽疄闄呭紑鍙戠洿鎺ヤ紶鍏ュ簭鍒楀彿鍜岄�氶亾鍙风敓鎴怑ZPlayer鍗冲彲 +// _cameraInfo.deviceSerial = _hubCoDevSerial; +// _cameraInfo.cameraNo = _cameraIndex; +// _player = [EZOPENSDK createPlayerWithDeviceSerial:_cameraInfo.deviceSerial cameraNo:_cameraInfo.cameraNo]; +// } +// else +// { +// _cameraInfo = [self.deviceInfo.cameraInfo dd_objectAtIndex:_cameraIndex]; +// _player = [EZOPENSDK createPlayerWithDeviceSerial:_cameraInfo.deviceSerial cameraNo:_cameraInfo.cameraNo]; +// _talkPlayer = [EZOPENSDK createPlayerWithDeviceSerial:_cameraInfo.deviceSerial cameraNo:_cameraInfo.cameraNo]; +// if (_cameraInfo.videoLevel == 2) +// { +// [self.qualityButton setTitle:NSLocalizedString(@"device_quality_high", @"楂樻竻") forState:UIControlStateNormal]; +// } +// else if (_cameraInfo.videoLevel == 1) +// { +// [self.qualityButton setTitle:NSLocalizedString(@"device_quality_median", @"鍧囪 ") forState:UIControlStateNormal]; +// } +// else +// { +// [self.qualityButton setTitle:NSLocalizedString(@"device_quality_low",@"娴佺晠") forState:UIControlStateNormal]; +// } +// } +// if (_cameraInfo.cameraNo == 0 || [self.deviceInfo.deviceType containsString:@"CAS"]) { //涓嶆敮鎸佹竻鏅板害鍒囨崲 +// self.qualityButton.hidden = YES; +// } +// +// if (self.deviceInfo.cameraInfo.count > 1) { +// self.title = [NSString stringWithFormat:@"Camera %ld", (long)_cameraInfo.cameraNo]; +// } +// else { +// self.title = _deviceInfo.deviceName; +// } +// self.largeTitleLabel.text = self.title; +// [self hidenWatchFunc]; +// +//#if DEBUG +// if (!_url) +// { +// //鎶撳浘鎺ュ彛婕旂ず浠g爜 +// [EZOPENSDK captureCamera:_cameraInfo.deviceSerial cameraNo:_cameraInfo.cameraNo completion:^(NSString *url, NSError *error) { +// NSLog(@"[%@] capture cameraNo is [%d] url is %@, error is %@", _cameraInfo.deviceSerial, (int)_cameraInfo.cameraNo, url, error); +// }]; +// } +//#endif +// +// _player.delegate = self; +// _talkPlayer.delegate = self; +// //鍒ゆ柇璁惧鏄惁鍔犲瘑锛屽姞瀵嗗氨浠巇emo鐨勫唴瀛樹腑鑾峰彇璁惧楠岃瘉鐮佸~鍏ュ埌鎾斁鍣ㄧ殑楠岃瘉鐮佹帴鍙i噷锛屾湰demo鍙鐞嗗唴瀛樺瓨鍌紝鏈湴鎸佷箙鍖栧瓨鍌ㄧ敤鎴疯嚜琛屽畬鎴� +// if (self.deviceInfo.isEncrypt) +// { +// NSString *verifyCode = [[GlobalKit shareKit].deviceVerifyCodeBySerial objectForKey:self.deviceInfo.deviceSerial]; +// [_player setPlayVerifyCode:verifyCode]; +// [_talkPlayer setPlayVerifyCode:verifyCode]; +// } +// [_player setPlayerView:_playerView]; +// BOOL hdStatus = [[NSUserDefaults standardUserDefaults] boolForKey:[NSString stringWithFormat:@"EZVideoPlayHardDecodingStatus_%@", self.deviceInfo.deviceSerial]]; +// [_player setHDPriority:hdStatus]; +// [_player startRealPlay]; +// +// if(!_loadingView) +// _loadingView = [[HIKLoadView alloc] initWithHIKLoadViewStyle:HIKLoadViewStyleSqureClockWise]; +// [self.view insertSubview:_loadingView aboveSubview:self.playerView]; +// [_loadingView mas_makeConstraints:^(MASConstraintMaker *make) { +// make.width.height.mas_equalTo(@14); +// make.centerX.mas_equalTo(self.playerView.mas_centerX); +// make.centerY.mas_equalTo(self.playerView.mas_centerY); +// }]; +// [self.loadingView startSquareClcokwiseAnimation]; +// +// self.largeBackButton.hidden = YES; +// _isOpenSound = YES; +// +// [self.controlButton dd_centerImageAndTitle]; +// [self.talkButton dd_centerImageAndTitle]; +// [self.captureButton dd_centerImageAndTitle]; +// [self.localRecordButton dd_centerImageAndTitle]; +// +// [self.voiceButton setImage:[UIImage imageNamed:@"preview_unvoice_btn_sel"] forState:UIControlStateHighlighted]; +// [self addLine]; +// +// self.localRecordLabel.layer.borderColor = [UIColor whiteColor].CGColor; +// self.localRecordLabel.layer.cornerRadius = 12.0f; +// self.localRecordLabel.layer.borderWidth = 1.0f; +// self.localRecordLabel.clipsToBounds = YES; +// self.playButton.enabled = NO; +// +// +// self.scrollView.minimumZoomScale = MinimumZoomScale; +// self.scrollView.maximumZoomScale = MaximumZoomScale; +// self.scrollView.backgroundColor = [UIColor clearColor]; +// self.scrollView.delegate = self; +// self.scrollView.showsHorizontalScrollIndicator = NO; +// self.scrollView.showsVerticalScrollIndicator = NO; +// self.scrollView.userInteractionEnabled = YES; +// self.scrollView.multipleTouchEnabled = YES; +// self.scrollView.pagingEnabled = NO; +// +// if ([GlobalKit shareKit].deviceType==HDLEZDeviceType_Door) {//涓洪棬閿佹椂锛屽彧鏄剧ず楹﹀厠椋庡拰寮�闂ㄦ寜閽� +// self.captureButton.hidden=YES; +// self.localRecordButton.hidden=YES; +// +// [self.controlButton setTitle:NSLocalizedString(@"device_open", @"寮�闂�") forState:UIControlStateNormal]; +// } +} - if (self.deviceInfo.cameraInfo.count > 1) { - self.title = [NSString stringWithFormat:@"Camera %ld", (long)_cameraInfo.cameraNo]; - } - else { - self.title = _deviceInfo.deviceName; - } - self.largeTitleLabel.text = self.title; - [self hidenWatchFunc]; - -#if DEBUG - if (!_url) - { - //鎶撳浘鎺ュ彛婕旂ず浠g爜 - [EZOPENSDK captureCamera:_cameraInfo.deviceSerial cameraNo:_cameraInfo.cameraNo completion:^(NSString *url, NSError *error) { - NSLog(@"[%@] capture cameraNo is [%d] url is %@, error is %@", _cameraInfo.deviceSerial, (int)_cameraInfo.cameraNo, url, error); +/*娣诲姞闂ㄩ攣鎾斁view + */ +-(UIView*)doorPlayerView{ + if (!_doorPlayerView) { + _doorPlayerView=[[UIView alloc] init]; + [_playerView addSubview:_doorPlayerView]; + [_doorPlayerView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(_playerView.mas_centerX); + make.top.bottom.equalTo(_playerView); + make.width.mas_equalTo(_doorPlayerView.mas_height).multipliedBy(1); }]; } -#endif - - _player.delegate = self; - _talkPlayer.delegate = self; - //鍒ゆ柇璁惧鏄惁鍔犲瘑锛屽姞瀵嗗氨浠巇emo鐨勫唴瀛樹腑鑾峰彇璁惧楠岃瘉鐮佸~鍏ュ埌鎾斁鍣ㄧ殑楠岃瘉鐮佹帴鍙i噷锛屾湰demo鍙鐞嗗唴瀛樺瓨鍌紝鏈湴鎸佷箙鍖栧瓨鍌ㄧ敤鎴疯嚜琛屽畬鎴� - if (self.deviceInfo.isEncrypt) - { - NSString *verifyCode = [[GlobalKit shareKit].deviceVerifyCodeBySerial objectForKey:self.deviceInfo.deviceSerial]; - [_player setPlayVerifyCode:verifyCode]; - [_talkPlayer setPlayVerifyCode:verifyCode]; - } - [_player setPlayerView:_playerView]; - BOOL hdStatus = [[NSUserDefaults standardUserDefaults] boolForKey:[NSString stringWithFormat:@"EZVideoPlayHardDecodingStatus_%@", self.deviceInfo.deviceSerial]]; - [_player setHDPriority:hdStatus]; - [_player startRealPlay]; - - if(!_loadingView) - _loadingView = [[HIKLoadView alloc] initWithHIKLoadViewStyle:HIKLoadViewStyleSqureClockWise]; - [self.view insertSubview:_loadingView aboveSubview:self.playerView]; - [_loadingView mas_makeConstraints:^(MASConstraintMaker *make) { - make.width.height.mas_equalTo(@14); - make.centerX.mas_equalTo(self.playerView.mas_centerX); - make.centerY.mas_equalTo(self.playerView.mas_centerY); - }]; - [self.loadingView startSquareClcokwiseAnimation]; - - self.largeBackButton.hidden = YES; - _isOpenSound = YES; - - [self.controlButton dd_centerImageAndTitle]; - [self.talkButton dd_centerImageAndTitle]; - [self.captureButton dd_centerImageAndTitle]; - [self.localRecordButton dd_centerImageAndTitle]; - - [self.voiceButton setImage:[UIImage imageNamed:@"preview_unvoice_btn_sel"] forState:UIControlStateHighlighted]; - [self addLine]; - - self.localRecordLabel.layer.borderColor = [UIColor whiteColor].CGColor; - self.localRecordLabel.layer.cornerRadius = 12.0f; - self.localRecordLabel.layer.borderWidth = 1.0f; - self.localRecordLabel.clipsToBounds = YES; - self.playButton.enabled = NO; - - - self.scrollView.minimumZoomScale = MinimumZoomScale; - self.scrollView.maximumZoomScale = MaximumZoomScale; - self.scrollView.backgroundColor = [UIColor clearColor]; - self.scrollView.delegate = self; - self.scrollView.showsHorizontalScrollIndicator = NO; - self.scrollView.showsVerticalScrollIndicator = NO; - self.scrollView.userInteractionEnabled = YES; - self.scrollView.multipleTouchEnabled = YES; - self.scrollView.pagingEnabled = NO; + return _doorPlayerView; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; -// self.navigationController.navigationBarHidden = NO;//2021-02-01 + self.navigationController.navigationBar.hidden = NO;//2021-02-01 self.ptzViewContraint.constant = self.bottomView.frame.size.height; self.talkViewContraint.constant = self.ptzViewContraint.constant; } @@ -266,6 +322,226 @@ // Dispose of any resources that can be recreated. } +/*鑾峰彇璁惧淇℃伅 + */ +-(void)getDeviceInfo{ + __weak __typeof(self)weakSelf = self; + //鑾峰彇璁惧淇℃伅 + [EZOpenSDK getDeviceInfo:self.deviceSerial completion:^(EZDeviceInfo *deviceInfo, NSError *error) { + if(error) + { + NSLog(@"EZ 鏌ヨ璁惧淇℃伅澶辫触:%@",error); + [weakSelf.view makeToast:error.userInfo[@"NSLocalizedDescription"] + duration:1.5 + position:@"center"]; + return; + } + if (deviceInfo) { + self.deviceInfo=deviceInfo; + [self initialData]; + } + }]; +} + +/*鍒濆鍖栫浉鍏虫暟鎹� + */ +-(void)initialData{ + self.talkButton.enabled = self.deviceInfo.isSupportTalk; + self.controlButton.enabled = self.deviceInfo.isSupportPTZ; + self.captureButton.enabled = NO; + self.localRecordButton.enabled = NO; + self.streamPlayBtn.hidden = YES; + self.isShowAlert = YES; + NSLog(@"#####鍒濆鍖栨柟娉曞睍绀�"); + + if (_url) + { + _player = [EZOPENSDK createPlayerWithUrl:_url]; + } + else if([self.deviceInfo.deviceType containsString:@"CAS"]) //hub + { + _cameraInfo = [[EZCameraInfo alloc]init]; //鍏煎demo涔嬪墠鐨勪笟鍔¢�昏緫锛屾墜鍔ㄥ~鍏呬簡cameraInfo锛屽疄闄呭紑鍙戠洿鎺ヤ紶鍏ュ簭鍒楀彿鍜岄�氶亾鍙风敓鎴怑ZPlayer鍗冲彲 + _cameraInfo.deviceSerial = _hubCoDevSerial; + _cameraInfo.cameraNo = _cameraIndex; + _player = [EZOPENSDK createPlayerWithDeviceSerial:_cameraInfo.deviceSerial cameraNo:_cameraInfo.cameraNo]; + } + else + { + _cameraInfo = [self.deviceInfo.cameraInfo dd_objectAtIndex:_cameraIndex]; + _player = [EZOPENSDK createPlayerWithDeviceSerial:_cameraInfo.deviceSerial cameraNo:_cameraInfo.cameraNo]; + _talkPlayer = [EZOPENSDK createPlayerWithDeviceSerial:_cameraInfo.deviceSerial cameraNo:_cameraInfo.cameraNo]; + if (_cameraInfo.videoLevel == 2) + { + [self.qualityButton setTitle:NSLocalizedString(@"device_quality_high", @"楂樻竻") forState:UIControlStateNormal]; + } + else if (_cameraInfo.videoLevel == 1) + { + [self.qualityButton setTitle:NSLocalizedString(@"device_quality_median", @"鍧囪 ") forState:UIControlStateNormal]; + } + else + { + [self.qualityButton setTitle:NSLocalizedString(@"device_quality_low",@"娴佺晠") forState:UIControlStateNormal]; + } + } +#warning 涓嶆敮鎸佸垏鎹㈡竻鏅板害锛屽叏灞忔椂涔熼渶瑕佷富鎸� + if (_cameraInfo.cameraNo == 0 || [self.deviceInfo.deviceType containsString:@"CAS"]) { //涓嶆敮鎸佹竻鏅板害鍒囨崲 + self.qualityButton.hidden = YES; + } + + if (self.deviceInfo.cameraInfo.count > 1) { + self.title = [NSString stringWithFormat:@"Camera %ld", (long)_cameraInfo.cameraNo]; + } + else { + self.title = _deviceInfo.deviceName; + } + self.largeTitleLabel.text = self.title; + [self hidenWatchFunc]; + +#if DEBUG + if (!_url) + { + //鎶撳浘鎺ュ彛婕旂ず浠g爜 + [EZOPENSDK captureCamera:_cameraInfo.deviceSerial cameraNo:_cameraInfo.cameraNo completion:^(NSString *url, NSError *error) { + NSLog(@"[%@] capture cameraNo is [%d] url is %@, error is %@", _cameraInfo.deviceSerial, (int)_cameraInfo.cameraNo, url, error); + }]; + } +#endif + + _player.delegate = self; + _talkPlayer.delegate = self; + //鍒ゆ柇璁惧鏄惁鍔犲瘑锛屽姞瀵嗗氨浠巇emo鐨勫唴瀛樹腑鑾峰彇璁惧楠岃瘉鐮佸~鍏ュ埌鎾斁鍣ㄧ殑楠岃瘉鐮佹帴鍙i噷锛屾湰demo鍙鐞嗗唴瀛樺瓨鍌紝鏈湴鎸佷箙鍖栧瓨鍌ㄧ敤鎴疯嚜琛屽畬鎴� + if (self.deviceInfo.isEncrypt) + { + NSString *verifyCode = [[GlobalKit shareKit].deviceVerifyCodeBySerial objectForKey:self.deviceInfo.deviceSerial]; + [_player setPlayVerifyCode:verifyCode]; + [_talkPlayer setPlayVerifyCode:verifyCode]; + } +// if ([GlobalKit shareKit].deviceType==HDLEZDeviceType_Door) {//涓洪棬閿佹椂 + [_player setPlayerView:self.doorPlayerView]; +// }else{ +// [_player setPlayerView:_playerView]; +// } + BOOL hdStatus = [[NSUserDefaults standardUserDefaults] boolForKey:[NSString stringWithFormat:@"EZVideoPlayHardDecodingStatus_%@", self.deviceInfo.deviceSerial]]; + [_player setHDPriority:hdStatus]; + [_player startRealPlay]; + + if(!_loadingView) + _loadingView = [[HIKLoadView alloc] initWithHIKLoadViewStyle:HIKLoadViewStyleSqureClockWise]; + [self.view insertSubview:_loadingView aboveSubview:self.playerView]; + [_loadingView mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.height.mas_equalTo(@14); + make.centerX.mas_equalTo(self.playerView.mas_centerX); + make.centerY.mas_equalTo(self.playerView.mas_centerY); + }]; + [self.loadingView startSquareClcokwiseAnimation]; + + self.largeBackButton.hidden = YES; + _isOpenSound = YES; + + [self.controlButton dd_centerImageAndTitle]; + [self.talkButton dd_centerImageAndTitle]; + [self.captureButton dd_centerImageAndTitle]; + [self.localRecordButton dd_centerImageAndTitle]; + + [self.voiceButton setImage:[UIImage imageNamed:@"preview_unvoice_btn_sel"] forState:UIControlStateHighlighted]; + [self addLine]; + + self.localRecordLabel.layer.borderColor = [UIColor whiteColor].CGColor; + self.localRecordLabel.layer.cornerRadius = 12.0f; + self.localRecordLabel.layer.borderWidth = 1.0f; + self.localRecordLabel.clipsToBounds = YES; + self.playButton.enabled = NO; + + + self.scrollView.minimumZoomScale = MinimumZoomScale; + self.scrollView.maximumZoomScale = MaximumZoomScale; + self.scrollView.backgroundColor = [UIColor clearColor]; + self.scrollView.delegate = self; + self.scrollView.showsHorizontalScrollIndicator = NO; + self.scrollView.showsVerticalScrollIndicator = NO; + self.scrollView.userInteractionEnabled = YES; + self.scrollView.multipleTouchEnabled = YES; + self.scrollView.pagingEnabled = NO; + + if ([GlobalKit shareKit].deviceType==HDLEZDeviceType_Door) {//涓洪棬閿佹椂锛屾樉绀洪害鍏嬮 +// self.captureButton.hidden=YES; +// self.localRecordButton.hidden=YES; + self.controlButton.hidden=YES; + + //閲嶈鎺у埗鍙版寜閽� + _unlockButton=[[HDLEZButton alloc] init]; + [self.bottomView addSubview:_unlockButton]; + [_unlockButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.left.right.bottom.equalTo( self.controlButton); + }]; + [_unlockButton setImage:[UIImage imageNamed:@"hdl_ez_ic_unlock_disable"] forState:UIControlStateNormal]; + [_unlockButton setTitle:NSLocalizedString(@"device_open", @"寮�闂�") forState:UIControlStateNormal]; + [_unlockButton dd_centerImageAndTitle]; + [_unlockButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal]; + _unlockButton.titleLabel.font=[UIFont systemFontOfSize:14]; + [_unlockButton addTarget:self action:@selector(unlockDoor) forControlEvents:UIControlEventTouchUpInside]; + _unlockButton.enabled=NO; +// self.controlButton.enabled=YES; +// [self.controlButton setImage:[UIImage imageNamed:@"hdl_ez_ic_unlock"] forState:UIControlStateNormal]; +// [self.controlButton setTitle:NSLocalizedString(@"device_open", @"寮�闂�") forState:UIControlStateNormal]; + } + + self.callOutAlertLabel.text = HDLEZLocallizedString(@"device_callout_alert_message"); + [self.hangUpButton setTitle:HDLEZLocallizedString(@"device_callout_hang_up") forState:UIControlStateNormal]; + self.hangUpButton.imagePosition = HDLEZOPButtonImagePositionTop; + self.hangUpButton.spacingBetweenImageAndTitle = 12.; + [self.ignoreButton setTitle:HDLEZLocallizedString(@"device_callout_ignore") forState:UIControlStateNormal]; + self.ignoreButton.imagePosition = HDLEZOPButtonImagePositionTop; + self.ignoreButton.spacingBetweenImageAndTitle = 12.; + [self.answerButton setTitle:HDLEZLocallizedString(@"device_callout_answer") forState:UIControlStateNormal]; + self.answerButton.imagePosition = HDLEZOPButtonImagePositionTop; + self.answerButton.spacingBetweenImageAndTitle = 12.; + + // 闂ㄩ攣鍏ㄥ睆鐘舵�佷笅宸ュ叿鏍� + [self.view addSubview:self.fullSceneToolView]; + __weak EZLivePlayViewController *weakSelf = self; + [self.fullSceneToolView configPlayStatus:YES soundOn:YES videoLevel:1 toolOperation:^(HDLEZVideoFullSceneOperation operationType) { + [weakSelf doorLockFullSceneOperation:operationType]; + }]; +} + +/*寮�閿� + */ +-(void)unlockDoor{ + [HDLEZAlertInputView showInputAlertWithtitle:HDLEZLocallizedString(@"device_please_input_door_password") cancleTitle:HDLEZLocallizedString(@"device_temp_cancle") sureTitle:HDLEZLocallizedString(@"device_temp_sure") keyboardType:UIKeyboardTypeASCIICapableNumberPad cancleBlock:^{ + + } sureBlock:^(NSString * _Nonnull content) { + HDLEZLog(@"鐐瑰嚮浜嗙‘璁わ細%@",content); + [MBProgressHUD showHUDAddedTo:self.view animated:YES]; + __weak __typeof(self)weakSelf = self; + [[EZHttpUtil sharedManager] authLockByHDL:content deviceId:self.deviceId completion:^(ResponseData * _Nonnull responseData) { + if (responseData.success) { + [[EZHttpUtil sharedManager] remoteOpenByHDL:weakSelf.streamToken deviceId:weakSelf.deviceId completion:^(ResponseData * _Nonnull responseData) { + [MBProgressHUD hideHUDForView:weakSelf.view animated:YES]; + if (responseData.success) { + [weakSelf.view makeToast:HDLEZLocallizedString(@"device_open_success") + duration:1.5 + position:@"center"]; + + }else{ + [weakSelf.view makeToast:responseData.message + duration:1.5 + position:@"center"]; + } + }]; + }else{ + [MBProgressHUD hideHUDForView:weakSelf.view animated:YES]; + [weakSelf.view makeToast:responseData.message + duration:1.5 + position:@"center"]; + } + }]; + + }]; + + + +} /* #pragma mark - Navigation @@ -293,29 +569,68 @@ } } -- (UIInterfaceOrientationMask)supportedInterfaceOrientations -{ - return UIInterfaceOrientationMaskAllButUpsideDown; +//- (UIInterfaceOrientationMask)supportedInterfaceOrientations +//{ +// return UIInterfaceOrientationMaskAllButUpsideDown; +//} +- (UIInterfaceOrientationMask)supportedInterfaceOrientations { + if (@available(iOS 16.0, *)) { + if (_landscape && !self.isVideoDoorLock) { + //妯睆 + return UIInterfaceOrientationMaskLandscape; + } else { + //绔栧睆 + return UIInterfaceOrientationMaskPortrait; + } + } else { + return UIInterfaceOrientationMaskAllButUpsideDown; + } } - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { + if (self.isVideoDoorLock) return; self.navigationController.navigationBarHidden = NO; self.toolBar.hidden = NO; self.largeBackButton.hidden = YES; self.bottomView.hidden = NO; self.largeTitleLabel.hidden = YES; self.localRecrodContraint.constant = 10; + + [self.scrollView setTranslatesAutoresizingMaskIntoConstraints:NO]; + [self.toolBar setTranslatesAutoresizingMaskIntoConstraints:NO]; + [NSLayoutConstraint deactivateConstraints:@[self.scrollViewWHRatio]]; + self.scrollViewWHRatio = [NSLayoutConstraint constraintWithItem:self.scrollView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.scrollView attribute:NSLayoutAttributeHeight multiplier:16/9. constant:0]; + [NSLayoutConstraint activateConstraints:@[self.scrollViewWHRatio]]; + dispatch_async(dispatch_get_main_queue(), ^{ + [self.scrollView layoutIfNeeded]; + [self.toolBar layoutIfNeeded]; + }); + if(toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) { self.navigationController.navigationBarHidden = YES; self.localRecrodContraint.constant = 50; - self.toolBar.hidden = YES; +// self.toolBar.hidden = YES; self.largeTitleLabel.hidden = NO; self.largeBackButton.hidden = NO; self.bottomView.hidden = YES; + + CGFloat tureScreenW = HDLEZ_APP_SCREEN_WIDTH > HDLEZ_APP_SCREEN_HEIGHT ? HDLEZ_APP_SCREEN_HEIGHT : HDLEZ_APP_SCREEN_WIDTH; + CGFloat tureScreenH = HDLEZ_APP_SCREEN_WIDTH < HDLEZ_APP_SCREEN_HEIGHT ? HDLEZ_APP_SCREEN_HEIGHT : HDLEZ_APP_SCREEN_WIDTH; + + + [self.scrollView setTranslatesAutoresizingMaskIntoConstraints:NO]; + [self.toolBar setTranslatesAutoresizingMaskIntoConstraints:NO]; + [NSLayoutConstraint deactivateConstraints:@[self.scrollViewWHRatio]]; + self.scrollViewWHRatio = [NSLayoutConstraint constraintWithItem:self.scrollView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.scrollView attribute:NSLayoutAttributeHeight multiplier:tureScreenH/(tureScreenW - 37) constant:0]; + [NSLayoutConstraint activateConstraints:@[self.scrollViewWHRatio]]; + dispatch_async(dispatch_get_main_queue(), ^{ + [self.scrollView layoutIfNeeded]; + [self.toolBar layoutIfNeeded]; + }); } } @@ -368,6 +683,28 @@ } [_emptyButton setTitle:[NSString stringWithFormat:fromatStr,value] forState:UIControlStateNormal]; +} + + +/** + * 鏀跺埌鐨勭敾闈㈤暱瀹藉�� + * + * @param player 鎾斁鍣ㄥ璞� + * @param height 楂樺害 + * @param width 瀹藉害 + */ +- (void)player:(EZPlayer *)player didReceivedDisplayHeight:(NSInteger)height displayWidth:(NSInteger)width{ + NSLog(@"鐢婚潰闀匡細%ld锛屽锛�%ld",(long)height,(long)width); + CGFloat playerVH=self.playerView.frame.size.height; +// HDLEZLog(@"楂橈細%ld",(long)playerVH); + CGFloat ratio=((CGFloat)width)/((CGFloat)height); + NSLog(@"姣斾緥锛�%f",ratio); + CGFloat playerVW=playerVH*ratio; + self.doorPlayerAspectRatio = ratio; +// HDLEZLog(@"瀹斤細%ld",(long)playerVW); + [self.doorPlayerView mas_updateConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(_doorPlayerView.mas_height).multipliedBy(ratio); + }]; } @@ -493,6 +830,16 @@ } } +/** 鏅鸿兘闂ㄩ攣寮�闂╰oken */ +- (void)player:(EZPlayer *)player playPrivateTokenInfo:(EZPMPlayPrivateTokenInfo *)tokenInfo { + NSLog(@"寮�闂╰oken--->%@", tokenInfo.token); + self.streamToken=tokenInfo.token; + + if (!_unlockButton.isEnabled) { + [_unlockButton setImage:[UIImage imageNamed:@"hdl_ez_ic_unlock"] forState:UIControlStateNormal]; + _unlockButton.enabled=YES; + } +} #pragma mark - ValidateCode Methods - (void)showSetPassword @@ -553,14 +900,113 @@ - (IBAction)large:(id)sender { - NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft]; - [[UIDevice currentDevice] setValue:value forKey:@"orientation"]; + self.videoCallOutView.hidden = YES; + if (_landscape == YES) { + [self largeBack:self.largeBackButton]; + return; + } + _landscape = YES; + if (self.isVideoDoorLock) { + self.navigationController.navigationBarHidden = YES; + self.localRecrodContraint.constant = 50; + self.toolBar.hidden = YES; + self.largeTitleLabel.hidden = YES; + self.largeBackButton.hidden = YES; + self.bottomView.hidden = YES; + self.scrollView.backgroundColor = [UIColor blackColor]; + + [self.scrollView setTranslatesAutoresizingMaskIntoConstraints:NO]; + [self.playerView setTranslatesAutoresizingMaskIntoConstraints:NO]; + [NSLayoutConstraint deactivateConstraints:@[self.scrollViewTopMargin, self.scrollViewWHRatio, self.playerViewWHRatio, self.playerViewBottomMargin]]; + self.scrollViewTopMargin = [NSLayoutConstraint constraintWithItem:self.scrollView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-HDLEZ_APP_STATUS_BAR_HEIGHT]; + self.scrollViewWHRatio = [NSLayoutConstraint constraintWithItem:self.scrollView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.scrollView attribute:NSLayoutAttributeHeight multiplier:HDLEZ_APP_SCREEN_WIDTH/HDLEZ_APP_SCREEN_HEIGHT constant:0]; + + self.playerViewWHRatio = [NSLayoutConstraint constraintWithItem:self.playerView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.playerView attribute:NSLayoutAttributeHeight multiplier:self.doorPlayerAspectRatio constant:0]; + CGFloat playerBottomMargin = HDLEZ_APP_SCREEN_HEIGHT - (HDLEZ_APP_SCREEN_WIDTH / self.doorPlayerAspectRatio); + NSLog(@"########鎾斁闂撮殭锛�%lf", playerBottomMargin); + self.playerViewBottomMargin = [NSLayoutConstraint constraintWithItem:self.scrollView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.playerView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:playerBottomMargin]; + [NSLayoutConstraint activateConstraints:@[self.scrollViewTopMargin, self.scrollViewWHRatio, self.playerViewWHRatio, self.playerViewBottomMargin]]; + dispatch_async(dispatch_get_main_queue(), ^{ + [self.scrollView layoutIfNeeded]; + [self.playerView layoutIfNeeded]; + }); + self.fullSceneToolView.hidden = NO; + [self.view bringSubviewToFront:self.fullSceneToolView]; + return; + } + if (@available(iOS 16.0, *)) { + if (self.navigationController) { + dispatch_async(dispatch_get_main_queue(), ^{ + [self.navigationController setNeedsUpdateOfSupportedInterfaceOrientations]; + }); + } else { + dispatch_async(dispatch_get_main_queue(), ^{ + [self setNeedsUpdateOfSupportedInterfaceOrientations]; + }); + } + NSArray *array = [[[UIApplication sharedApplication] connectedScenes] allObjects]; + UIWindowScene *ws = (UIWindowScene *)array.firstObject; + UIWindowSceneGeometryPreferencesIOS *geometryPreferences = [[UIWindowSceneGeometryPreferencesIOS alloc] init]; + geometryPreferences.interfaceOrientations = UIInterfaceOrientationMaskLandscape; + [ws requestGeometryUpdateWithPreferences:geometryPreferences errorHandler:^(NSError * _Nonnull error) { + NSLog(@"iOS 16 Error: %@",error); + }]; + } else { + NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft]; + [[UIDevice currentDevice] setValue:value forKey:@"orientation"]; + } } - (IBAction)largeBack:(id)sender { - NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait]; - [[UIDevice currentDevice] setValue:value forKey:@"orientation"]; + _landscape = NO; + if (self.isVideoDoorLock) { + self.navigationController.navigationBarHidden = NO; + self.toolBar.hidden = NO; + self.largeBackButton.hidden = YES; + self.bottomView.hidden = NO; + self.largeTitleLabel.hidden = YES; + self.localRecrodContraint.constant = 10; + self.videoCallOutView.hidden = !self.isShowAlert; + self.scrollView.backgroundColor = [UIColor clearColor]; + + [self.scrollView setTranslatesAutoresizingMaskIntoConstraints:NO]; + [self.playerView setTranslatesAutoresizingMaskIntoConstraints:NO]; + [NSLayoutConstraint deactivateConstraints:@[self.scrollViewTopMargin,self.scrollViewWHRatio, self.playerViewWHRatio, self.playerViewBottomMargin]]; + self.scrollViewTopMargin = [NSLayoutConstraint constraintWithItem:self.scrollView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0]; + self.scrollViewWHRatio = [NSLayoutConstraint constraintWithItem:self.scrollView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.scrollView attribute:NSLayoutAttributeHeight multiplier:16/9. constant:0]; + + self.playerViewWHRatio = [NSLayoutConstraint constraintWithItem:self.playerView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.playerView attribute:NSLayoutAttributeHeight multiplier:16/9. constant:0]; + self.playerViewBottomMargin = [NSLayoutConstraint constraintWithItem:self.scrollView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.playerView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0]; + [NSLayoutConstraint activateConstraints:@[self.scrollViewTopMargin,self.scrollViewWHRatio, self.playerViewWHRatio, self.playerViewBottomMargin]]; + dispatch_async(dispatch_get_main_queue(), ^{ + [self.scrollView layoutIfNeeded]; + [self.playerView layoutIfNeeded]; + }); + self.fullSceneToolView.hidden = YES; + return; + } + if (@available(iOS 16.0, *)) { + if (self.navigationController) { + dispatch_async(dispatch_get_main_queue(), ^{ + [self.navigationController setNeedsUpdateOfSupportedInterfaceOrientations]; + }); + } else { + dispatch_async(dispatch_get_main_queue(), ^{ + [self setNeedsUpdateOfSupportedInterfaceOrientations]; + }); + } + NSArray *array = [[[UIApplication sharedApplication] connectedScenes] allObjects]; + UIWindowScene *ws = (UIWindowScene *)array.firstObject; + UIWindowSceneGeometryPreferencesIOS *geometryPreferences = [[UIWindowSceneGeometryPreferencesIOS alloc] init]; + geometryPreferences.interfaceOrientations = UIInterfaceOrientationMaskPortrait; + [ws requestGeometryUpdateWithPreferences:geometryPreferences errorHandler:^(NSError * _Nonnull error) { + NSLog(@"iOS 16 Error: %@",error); + }]; + } else { + NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait]; + [[UIDevice currentDevice] setValue:value forKey:@"orientation"]; + } } - (IBAction)capture:(id)sender @@ -626,6 +1072,7 @@ [self.voiceButton setImage:[UIImage imageNamed:@"preview_voice_btn"] forState:UIControlStateNormal]; } _isOpenSound = !_isOpenSound; + [self.fullSceneToolView soundOn:_isOpenSound]; } - (IBAction)playButtonClicked:(id)sender @@ -639,6 +1086,11 @@ self.localRecordButton.enabled = NO; self.captureButton.enabled = NO; self.playerPlayButton.hidden = NO; + + //寮�闂ㄦ寜閽疆鐏帮紝涓嶇粰鐐瑰嚮锛堟殏鍋滅殑鎯呭喌涓嬩笉缁欏紑闂級 + [_unlockButton setImage:[UIImage imageNamed:@"hdl_ez_ic_unlock_disable"] forState:UIControlStateNormal]; + _unlockButton.enabled=NO; + } else { @@ -649,6 +1101,11 @@ [self.loadingView startSquareClcokwiseAnimation]; } _isPlaying = !_isPlaying; + [self.fullSceneToolView playStatus:_isPlaying]; +} + +- (SEL)extracted { + return @selector(hideQualityView); } - (IBAction)qualityButtonClicked:(id)sender @@ -661,7 +1118,7 @@ { self.qualityView.hidden = NO; //鍋滅暀5s浠ュ悗闅愯棌瑙嗛璐ㄩ噺View. - [self performSelector:@selector(hideQualityView) withObject:nil afterDelay:5.0f]; + [self performSelector:[self extracted] withObject:nil afterDelay:5.0f]; } self.qualityButton.selected = !self.qualityButton.selected; } @@ -703,23 +1160,28 @@ if (error) { - [self.view makeToast:[NSString stringWithFormat:@"%@", error.description]]; +// [self.view makeToast:[NSString stringWithFormat:@"%@", error.description]]; + + [self.view makeToast:NSLocalizedString(@"setting_opration_fail", @"鎿嶄綔澶辫触")]; return; } [weakSelf.player stopRealPlay]; - _cameraInfo.videoLevel = type; + weakSelf.cameraInfo.videoLevel = type; if (sender == weakSelf.highButton) { [weakSelf.qualityButton setTitle:NSLocalizedString(@"device_quality_high", @"楂樻竻") forState:UIControlStateNormal]; + [self.fullSceneToolView videoLevel:2]; } else if (sender == weakSelf.middleButton) { [weakSelf.qualityButton setTitle:NSLocalizedString(@"device_quality_median", @"鍧囪 ") forState:UIControlStateNormal]; + [self.fullSceneToolView videoLevel:1]; } else { [weakSelf.qualityButton setTitle:NSLocalizedString(@"device_quality_low", @"娴佺晠") forState:UIControlStateNormal]; + [self.fullSceneToolView videoLevel:0]; } if (result) { @@ -933,6 +1395,38 @@ _isPressed = !_isPressed; } +- (IBAction)clickCalloutHangupAction:(id)sender { + [UIView dd_showMessage:@"鎸傛柇寮�鍙戜腑..."]; + self.isShowAlert = NO; +} + +- (IBAction)clickCalloutIgnoreAction:(id)sender { + [UIView dd_showMessage:@"蹇界暐寮�鍙戜腑..."]; + self.isShowAlert = NO; +} + +- (IBAction)clickCalloutAnswerAction:(id)sender { + [UIView dd_showMessage:@"鎺ュ惉寮�鍙戜腑..."]; + self.isShowAlert = NO; + [self talkButtonClicked:self.talkButton]; +} + + +#pragma mark - Publish Methods +/// 灞曠ず鍛煎彨寮规 +- (void)showCallOutAlertView { + self.videoCallOutView.hidden = NO; + [UIView dd_showMessage:@"灞曠ず鍛煎彨寮规"]; + NSLog(@"灞曠ず鍛煎彨寮规"); +} + +/// 闅愯棌鍛煎彨寮规 +- (void)hiddenCallOutAlertView { + self.videoCallOutView.hidden = YES; + [UIView dd_showMessage:@"闅愯棌鍛煎彨寮规"]; + NSLog(@"闅愯棌鍛煎彨寮规"); +} + #pragma mark - Private Methods - (void) checkMicPermissionResult:(void(^)(BOOL enable)) retCb @@ -1053,17 +1547,41 @@ } CGFloat averageWidth = [UIScreen mainScreen].bounds.size.width/5.0; UIImageView *lineImageView1 = [UIView dd_instanceVerticalLine:20 color:[UIColor grayColor]]; - lineImageView1.frame = CGRectMake(averageWidth, 7, lineImageView1.frame.size.width, lineImageView1.frame.size.height); +// lineImageView1.frame = CGRectMake(averageWidth, 7, lineImageView1.frame.size.width, lineImageView1.frame.size.height); [self.toolBar addSubview:lineImageView1]; + [lineImageView1 mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.playButton.mas_right); + make.centerY.mas_equalTo(self.playButton.mas_centerY); + make.width.mas_equalTo(lineImageView1.frame.size.width); + make.height.mas_equalTo(lineImageView1.frame.size.height); + }]; UIImageView *lineImageView2 = [UIView dd_instanceVerticalLine:20 color:[UIColor grayColor]]; - lineImageView2.frame = CGRectMake(averageWidth * 2, 7, lineImageView2.frame.size.width, lineImageView2.frame.size.height); +// lineImageView2.frame = CGRectMake(averageWidth * 2, 7, lineImageView2.frame.size.width, lineImageView2.frame.size.height); [self.toolBar addSubview:lineImageView2]; + [lineImageView2 mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.voiceButton.mas_right); + make.centerY.mas_equalTo(self.voiceButton.mas_centerY); + make.width.mas_equalTo(lineImageView2.frame.size.width); + make.height.mas_equalTo(lineImageView2.frame.size.height); + }]; UIImageView *lineImageView3 = [UIView dd_instanceVerticalLine:20 color:[UIColor grayColor]]; - lineImageView3.frame = CGRectMake(averageWidth * 3, 7, lineImageView3.frame.size.width, lineImageView3.frame.size.height); +// lineImageView3.frame = CGRectMake(averageWidth * 3, 7, lineImageView3.frame.size.width, lineImageView3.frame.size.height); [self.toolBar addSubview:lineImageView3]; + [lineImageView3 mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.qualityButton.mas_right); + make.centerY.mas_equalTo(self.qualityButton.mas_centerY); + make.width.mas_equalTo(lineImageView3.frame.size.width); + make.height.mas_equalTo(lineImageView3.frame.size.height); + }]; UIImageView *lineImageView4 = [UIView dd_instanceVerticalLine:20 color:[UIColor grayColor]]; - lineImageView4.frame = CGRectMake(averageWidth * 4, 7, lineImageView4.frame.size.width, lineImageView4.frame.size.height); +// lineImageView4.frame = CGRectMake(averageWidth * 4, 7, lineImageView4.frame.size.width, lineImageView4.frame.size.height); [self.toolBar addSubview:lineImageView4]; + [lineImageView4 mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.emptyButton.mas_right); + make.centerY.mas_equalTo(self.emptyButton.mas_centerY); + make.width.mas_equalTo(lineImageView4.frame.size.width); + make.height.mas_equalTo(lineImageView4.frame.size.height); + }]; } @@ -1164,5 +1682,75 @@ } } +#pragma mark - PrivateMethod (闂ㄩ攣鍏ㄥ睆鏃剁殑涓�绯诲垪鎿嶄綔) +- (void)doorLockFullSceneOperation:(HDLEZVideoFullSceneOperation)operation { + switch (operation) { + case HDLEZVideoFullSceneOperationOfHangUp: { // 鎸傛柇 + [self hiddenCallOutAlertView]; + } + break; + case HDLEZVideoFullSceneOperationOfPlay: { // 鎾斁 + [self playButtonClicked:self.playButton]; + } + break; + case HDLEZVideoFullSceneOperationOfPause: { // 鏆傚仠 + [self playButtonClicked:self.playButton]; + } + break; + case HDLEZVideoFullSceneOperationOfSound: { // 寮�鍚煶閲� + [_player openSound]; + NSLog(@"#######寮�鍚煶閲�"); + } + break; + case HDLEZVideoFullSceneOperationOfSoundOff: { // 闈欓煶 + [_player closeSound]; + NSLog(@"#######闈欓煶"); + } + break; + case HDLEZVideoFullSceneOperationOfSmooth: { // 娴佺晠 + [self qualitySelectedClicked:self.lowButton]; + } + break; + case HDLEZVideoFullSceneOperationOfBalance: { // 鍧囪 + [self qualitySelectedClicked:self.middleButton]; + } + break; + case HDLEZVideoFullSceneOperationOfHDFull: { // 楂樻竻 + [self qualitySelectedClicked:self.highButton]; + } + break; + case HDLEZVideoFullSceneOperationOfExitFull: { // 閫�鍑哄叏灞� + [self largeBack:self.largeButton]; + } + break; + default: + break; + } +} + +#pragma Setter +- (void)setIsShowAlert:(BOOL)isShowAlert { + _isShowAlert = isShowAlert; + if (isShowAlert) { + NSLog(@"#####set鏂规硶灞曠ず"); + [self showCallOutAlertView]; + } else { + NSLog(@"#####set鏂规硶闅愯棌"); + [self hiddenCallOutAlertView]; + } +} + +#pragma mark - Getter +- (HDLEZVideoDoorToolView *)fullSceneToolView { + if (!_fullSceneToolView) { + _fullSceneToolView = [[HDLEZVideoDoorToolView alloc] initWithFrame:CGRectMake(0, HDLEZ_APP_SCREEN_HEIGHT - 280, HDLEZ_APP_SCREEN_WIDTH, 280)]; + _fullSceneToolView.hidden = YES; + } + return _fullSceneToolView; +} + +- (BOOL)prefersHomeIndicatorAutoHidden { + return YES; +} @end -- Gitblit v1.8.0