From 83de5ad48e86873b698c904f8954576e8b31dfb5 Mon Sep 17 00:00:00 2001 From: Davin <591807572@qq.com> Date: 星期二, 20 六月 2023 11:35:36 +0800 Subject: [PATCH] feature 门锁全屏 && 设置页面UI --- EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m | 144 ++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 134 insertions(+), 10 deletions(-) diff --git a/EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m b/EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m index fdd73f4..d790261 100644 --- a/EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m +++ b/EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m @@ -89,6 +89,7 @@ @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;//寮�閿佹寜閽� @@ -96,6 +97,13 @@ @property (nonatomic, copy) NSString *streamToken; @property (nonatomic, strong) UIView *doorPlayerView;//闂ㄩ攣鎾斁view + +// 鍛煎彨瑙嗗浘鐩稿叧鎺т欢 +@property (weak, nonatomic) IBOutlet UIView *videoCallOutView; // 鍛煎彨寮规 +@property (weak, nonatomic) IBOutlet UILabel *callOutAlertLabel; // 鎻愮ず璇█ +@property (weak, nonatomic) IBOutlet UIButton *hangUpButton; // 鎸傛柇鎸夐挳 +@property (weak, nonatomic) IBOutlet UIButton *ignoreButton; // 蹇界暐鎸夐挳 +@property (weak, nonatomic) IBOutlet UIButton *answerButton; // 鎺ュ惉鎸夐挳 @end @@ -116,6 +124,7 @@ self.isStartingTalk = NO; self.ptzView.hidden = YES; self.talkView.hidden = YES; + _landscape = NO; if (!self.deviceInfo) {//濡傛灉娌℃湁浼燿eviceInfo,闇�涓诲姩鑾峰彇 [self getDeviceInfo]; @@ -332,6 +341,7 @@ self.captureButton.enabled = NO; self.localRecordButton.enabled = NO; self.streamPlayBtn.hidden = YES; + self.isShowAlert = YES; if (_url) { @@ -463,6 +473,14 @@ // [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.ignoreButton setTitle:HDLEZLocallizedString(@"device_callout_ignore") forState:UIControlStateNormal]; + [self.answerButton setTitle:HDLEZLocallizedString(@"device_callout_answer") forState:UIControlStateNormal]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + self.isShowAlert = NO; + }); } /*寮�閿� @@ -535,7 +553,7 @@ //} - (UIInterfaceOrientationMask)supportedInterfaceOrientations { if (@available(iOS 16.0, *)) { - if (_landscape) { + if (_landscape && !self.isVideoDoorLock) { //妯睆 return UIInterfaceOrientationMaskLandscape; } else { @@ -550,6 +568,7 @@ - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { + if (self.isVideoDoorLock) return; self.navigationController.navigationBarHidden = NO; self.toolBar.hidden = NO; self.largeBackButton.hidden = YES; @@ -572,7 +591,7 @@ { 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; @@ -584,7 +603,7 @@ [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 constant:0]; + 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]; @@ -858,9 +877,32 @@ - (IBAction)large:(id)sender { - NSLog(@"######杩涘叆妯睆锛�"); + if (_landscape == YES) { + [self largeBack:self.largeBackButton]; + return; + } + _landscape = YES; + if (self.isVideoDoorLock) { + self.navigationController.navigationBarHidden = YES; + self.localRecrodContraint.constant = 50; + self.toolBar.hidden = NO; + self.largeTitleLabel.hidden = NO; + self.largeBackButton.hidden = YES; + self.bottomView.hidden = YES; + + [self.scrollView setTranslatesAutoresizingMaskIntoConstraints:NO]; + [self.toolBar setTranslatesAutoresizingMaskIntoConstraints:NO]; + [NSLayoutConstraint deactivateConstraints:@[self.scrollViewTopMargin, self.scrollViewWHRatio]]; + 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 - 37.) constant:0]; + [NSLayoutConstraint activateConstraints:@[self.scrollViewTopMargin, self.scrollViewWHRatio]]; + dispatch_async(dispatch_get_main_queue(), ^{ + [self.scrollView layoutIfNeeded]; + [self.toolBar layoutIfNeeded]; + }); + return; + } if (@available(iOS 16.0, *)) { - _landscape = YES; if (self.navigationController) { dispatch_async(dispatch_get_main_queue(), ^{ [self.navigationController setNeedsUpdateOfSupportedInterfaceOrientations]; @@ -886,8 +928,28 @@ - (IBAction)largeBack:(id)sender { NSLog(@"######鏀跺洖妯睆锛�"); + _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.scrollView setTranslatesAutoresizingMaskIntoConstraints:NO]; + [self.toolBar setTranslatesAutoresizingMaskIntoConstraints:NO]; + [NSLayoutConstraint deactivateConstraints:@[self.scrollViewTopMargin,self.scrollViewWHRatio]]; + 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]; + [NSLayoutConstraint activateConstraints:@[self.scrollViewTopMargin,self.scrollViewWHRatio]]; + dispatch_async(dispatch_get_main_queue(), ^{ + [self.scrollView layoutIfNeeded]; + [self.toolBar layoutIfNeeded]; + }); + return; + } if (@available(iOS 16.0, *)) { - _landscape = NO; if (self.navigationController) { dispatch_async(dispatch_get_main_queue(), ^{ [self.navigationController setNeedsUpdateOfSupportedInterfaceOrientations]; @@ -1287,6 +1349,31 @@ _isPressed = !_isPressed; } +- (IBAction)clickCalloutHangupAction:(id)sender { + [UIView dd_showMessage:@"鎸傛柇寮�鍙戜腑..."]; +} + +- (IBAction)clickCalloutIgnoreAction:(id)sender { + [UIView dd_showMessage:@"蹇界暐寮�鍙戜腑..."]; +} + +- (IBAction)clickCalloutAnswerAction:(id)sender { + [UIView dd_showMessage:@"鎺ュ惉寮�鍙戜腑..."]; +} + + +#pragma mark - Publish Methods +/// 灞曠ず鍛煎彨寮规 +- (void)showCallOutAlertView { + self.videoCallOutView.hidden = NO; +} + +/// 闅愯棌鍛煎彨寮规 +- (void)hiddenCallOutAlertView { + self.videoCallOutView.hidden = YES; + +} + #pragma mark - Private Methods - (void) checkMicPermissionResult:(void(^)(BOOL enable)) retCb @@ -1407,17 +1494,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); + }]; } @@ -1518,5 +1629,18 @@ } } +#pragma Setter +- (void)setIsShowAlert:(BOOL)isShowAlert { + _isShowAlert = isShowAlert; + if (isShowAlert) { + [self showCallOutAlertView]; + } else { + [self hiddenCallOutAlertView]; + } +} + +- (BOOL)prefersHomeIndicatorAutoHidden { + return YES; +} @end -- Gitblit v1.8.0