| | |
| | | { |
| | | NSOperation *op; |
| | | BOOL _isPressed; |
| | | BOOL _landscape; // 是否旋转 |
| | | } |
| | | |
| | | @property (nonatomic) BOOL isOpenSound; |
| | |
| | | @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 (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 |
| | | |
| | |
| | | self.isStartingTalk = NO; |
| | | self.ptzView.hidden = YES; |
| | | self.talkView.hidden = YES; |
| | | _landscape = NO; |
| | | |
| | | if (!self.deviceInfo) {//如果没有传deviceInfo,需主动获取 |
| | | [self getDeviceInfo]; |
| | |
| | | self.captureButton.enabled = NO; |
| | | self.localRecordButton.enabled = NO; |
| | | self.streamPlayBtn.hidden = YES; |
| | | self.isShowAlert = YES; |
| | | |
| | | if (_url) |
| | | { |
| | |
| | | // [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; |
| | | }); |
| | | } |
| | | |
| | | /*开锁 |
| | |
| | | } |
| | | } |
| | | |
| | | - (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]; |
| | | }); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | - (IBAction)large:(id)sender |
| | | { |
| | | NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft]; |
| | | [[UIDevice currentDevice] setValue:value forKey:@"orientation"]; |
| | | 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, *)) { |
| | | 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"]; |
| | | 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, *)) { |
| | | 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 |
| | |
| | | _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 |
| | |
| | | } |
| | | 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); |
| | | }]; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | #pragma Setter |
| | | - (void)setIsShowAlert:(BOOL)isShowAlert { |
| | | _isShowAlert = isShowAlert; |
| | | if (isShowAlert) { |
| | | [self showCallOutAlertView]; |
| | | } else { |
| | | [self hiddenCallOutAlertView]; |
| | | } |
| | | } |
| | | |
| | | - (BOOL)prefersHomeIndicatorAutoHidden { |
| | | return YES; |
| | | } |
| | | |
| | | @end |