| | |
| | | |
| | | @property (nonatomic) BOOL isOpenSound; |
| | | @property (nonatomic) BOOL isPlaying; |
| | | @property (nonatomic) BOOL isAnswering; // 正在接听中 |
| | | @property (nonatomic, strong) NSTimer *recordTimer; |
| | | @property (nonatomic) NSTimeInterval seconds; |
| | | @property (nonatomic, strong) CALayer *orangeLayer; |
| | |
| | | @property (nonatomic, weak) IBOutlet UIButton *captureButton; |
| | | @property (nonatomic, weak) IBOutlet UIButton *localRecordButton; |
| | | @property (nonatomic, weak) IBOutlet UIButton *playButton; |
| | | @property (weak, nonatomic) IBOutlet NSLayoutConstraint *playBtnLeftMargin; |
| | | @property (weak, nonatomic) IBOutlet UIButton *streamPlayBtn; |
| | | @property (nonatomic, weak) IBOutlet UIButton *voiceButton; |
| | | @property (nonatomic, weak) IBOutlet UIButton *qualityButton; |
| | | @property (nonatomic, weak) IBOutlet UIButton *emptyButton; |
| | | @property (weak, nonatomic) IBOutlet NSLayoutConstraint *emptyBtnLeftMargin; |
| | | @property (nonatomic, weak) IBOutlet UIButton *largeButton; |
| | | @property (weak, nonatomic) IBOutlet NSLayoutConstraint *largeBtnRightMargin; |
| | | @property (nonatomic, weak) IBOutlet UIButton *largeBackButton; |
| | | @property (weak, nonatomic) IBOutlet NSLayoutConstraint *largeBackBtnLeftMargin; |
| | | @property (nonatomic, weak) IBOutlet UIView *ptzView; |
| | | @property (nonatomic, weak) IBOutlet UIButton *ptzCloseButton; |
| | | @property (nonatomic, weak) IBOutlet UIButton *ptzControlButton; |
| | |
| | | self.isStartingTalk = NO; |
| | | self.ptzView.hidden = YES; |
| | | self.talkView.hidden = YES; |
| | | self.isAnswering = NO; |
| | | self.videoCallOutView.hidden = YES; |
| | | self.doorPlayerAspectRatio = HDLEZ_APP_SCREEN_WIDTH / HDLEZ_APP_SCREEN_HEIGHT; |
| | | _landscape = NO; |
| | |
| | | //结束本地录像 |
| | | if(self.localRecordButton.selected) |
| | | { |
| | | __weak __typeof(self)weakSelf = self; |
| | | [_player stopLocalRecordExt:^(BOOL ret) { |
| | | |
| | | NSLog(@"%d", ret); |
| | | |
| | | [_recordTimer invalidate]; |
| | | _recordTimer = nil; |
| | | self.localRecordLabel.hidden = YES; |
| | | [self saveRecordToPhotosAlbum:_filePath]; |
| | | _filePath = nil; |
| | | [weakSelf.recordTimer invalidate]; |
| | | weakSelf.recordTimer = nil; |
| | | weakSelf.localRecordLabel.hidden = YES; |
| | | [weakSelf saveRecordToPhotosAlbum:weakSelf.filePath]; |
| | | weakSelf.filePath = nil; |
| | | }]; |
| | | } |
| | | |
| | |
| | | self.captureButton.enabled = NO; |
| | | self.localRecordButton.enabled = NO; |
| | | self.streamPlayBtn.hidden = YES; |
| | | self.isShowAlert = YES; |
| | | NSLog(@"#####初始化方法展示"); |
| | | // self.isShowAlert = YES; |
| | | |
| | | if (_url) |
| | | { |
| | |
| | | [self.qualityButton setTitle:NSLocalizedString(@"device_quality_low",@"流畅") forState:UIControlStateNormal]; |
| | | } |
| | | } |
| | | #warning 不支持切换清晰度,全屏时也需要主持 |
| | | if (_cameraInfo.cameraNo == 0 || [self.deviceInfo.deviceType containsString:@"CAS"]) { //不支持清晰度切换 |
| | | self.qualityButton.hidden = YES; |
| | | [self.fullSceneToolView supportVideoLevelChange:NO]; |
| | | } |
| | | |
| | | if (self.deviceInfo.cameraInfo.count > 1) { |
| | |
| | | if (!_url) |
| | | { |
| | | //抓图接口演示代码 |
| | | __weak __typeof(self)weakSelf = self; |
| | | [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); |
| | | NSLog(@"[%@] capture cameraNo is [%d] url is %@, error is %@", weakSelf.cameraInfo.deviceSerial, (int)weakSelf.cameraInfo.cameraNo, url, error); |
| | | }]; |
| | | } |
| | | #endif |
| | |
| | | |
| | | // 门锁全屏状态下工具栏 |
| | | [self.view addSubview:self.fullSceneToolView]; |
| | | __weak EZLivePlayViewController *weakSelf = self; |
| | | [self.fullSceneToolView configPlayStatus:YES soundOn:YES videoLevel:1 toolOperation:^(HDLEZVideoFullSceneOperation operationType) { |
| | | __weak __typeof(self)weakSelf = self; |
| | | [self.fullSceneToolView ringRingRing:YES]; // 默认显示挂断按钮 |
| | | [self.fullSceneToolView configPlayStatus:YES soundOn:YES videoLevel:_cameraInfo.videoLevel toolOperation:^(HDLEZVideoFullSceneOperation operationType) { |
| | | [weakSelf doorLockFullSceneOperation:operationType]; |
| | | }]; |
| | | } |
| | |
| | | |
| | | [self.scrollView setTranslatesAutoresizingMaskIntoConstraints:NO]; |
| | | [self.toolBar setTranslatesAutoresizingMaskIntoConstraints:NO]; |
| | | [NSLayoutConstraint deactivateConstraints:@[self.scrollViewWHRatio]]; |
| | | [self.playButton setTranslatesAutoresizingMaskIntoConstraints:NO]; |
| | | [self.emptyButton setTranslatesAutoresizingMaskIntoConstraints:NO]; |
| | | [self.largeButton setTranslatesAutoresizingMaskIntoConstraints:NO]; |
| | | // [self.largeBackButton setTranslatesAutoresizingMaskIntoConstraints:NO]; |
| | | [NSLayoutConstraint deactivateConstraints:@[self.scrollViewWHRatio, self.playBtnLeftMargin, self.emptyBtnLeftMargin, self.largeBtnRightMargin]]; |
| | | self.scrollViewWHRatio = [NSLayoutConstraint constraintWithItem:self.scrollView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.scrollView attribute:NSLayoutAttributeHeight multiplier:16/9. constant:0]; |
| | | [NSLayoutConstraint activateConstraints:@[self.scrollViewWHRatio]]; |
| | | self.playBtnLeftMargin = [NSLayoutConstraint constraintWithItem:self.playButton attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.toolBar attribute:NSLayoutAttributeLeading multiplier:1 constant:0]; |
| | | self.emptyBtnLeftMargin = [NSLayoutConstraint constraintWithItem:self.emptyButton attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.qualityButton attribute:NSLayoutAttributeTrailing multiplier:1 constant:0]; |
| | | self.largeBtnRightMargin = [NSLayoutConstraint constraintWithItem:self.toolBar attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:self.largeButton attribute:NSLayoutAttributeTrailing multiplier:1 constant:0]; |
| | | [NSLayoutConstraint activateConstraints:@[self.scrollViewWHRatio, self.playBtnLeftMargin, self.emptyBtnLeftMargin, self.largeBtnRightMargin]]; |
| | | dispatch_async(dispatch_get_main_queue(), ^{ |
| | | [self.scrollView layoutIfNeeded]; |
| | | [self.toolBar layoutIfNeeded]; |
| | | [self.playButton layoutIfNeeded]; |
| | | [self.emptyButton layoutIfNeeded]; |
| | | [self.largeButton layoutIfNeeded]; |
| | | }); |
| | | |
| | | if(toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || |
| | |
| | | |
| | | 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; |
| | | |
| | | CGFloat marginSpace = 64; |
| | | |
| | | [self.scrollView setTranslatesAutoresizingMaskIntoConstraints:NO]; |
| | | [self.toolBar setTranslatesAutoresizingMaskIntoConstraints:NO]; |
| | | [NSLayoutConstraint deactivateConstraints:@[self.scrollViewWHRatio]]; |
| | | [self.playButton setTranslatesAutoresizingMaskIntoConstraints:NO]; |
| | | [self.emptyButton setTranslatesAutoresizingMaskIntoConstraints:NO]; |
| | | [self.largeButton setTranslatesAutoresizingMaskIntoConstraints:NO]; |
| | | [NSLayoutConstraint deactivateConstraints:@[self.scrollViewWHRatio, self.playBtnLeftMargin, self.emptyBtnLeftMargin, self.largeBtnRightMargin]]; |
| | | 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]]; |
| | | self.playBtnLeftMargin = [NSLayoutConstraint constraintWithItem:self.playButton attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.toolBar attribute:NSLayoutAttributeLeading multiplier:1 constant:marginSpace]; |
| | | self.emptyBtnLeftMargin = [NSLayoutConstraint constraintWithItem:self.emptyButton attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.qualityButton attribute:NSLayoutAttributeTrailing multiplier:1 constant:(tureScreenH - tureScreenW - 2 * marginSpace)]; |
| | | self.largeBtnRightMargin = [NSLayoutConstraint constraintWithItem:self.toolBar attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:self.largeButton attribute:NSLayoutAttributeTrailing multiplier:1 constant:marginSpace]; |
| | | [NSLayoutConstraint activateConstraints:@[self.scrollViewWHRatio, self.playBtnLeftMargin, self.emptyBtnLeftMargin, self.largeBtnRightMargin]]; |
| | | dispatch_async(dispatch_get_main_queue(), ^{ |
| | | [self.scrollView layoutIfNeeded]; |
| | | [self.toolBar layoutIfNeeded]; |
| | | [self.playButton layoutIfNeeded]; |
| | | [self.emptyButton layoutIfNeeded]; |
| | | [self.largeButton layoutIfNeeded]; |
| | | }); |
| | | } |
| | | } |
| | |
| | | // HDLEZLog(@"高:%ld",(long)playerVH); |
| | | CGFloat ratio=((CGFloat)width)/((CGFloat)height); |
| | | NSLog(@"比例:%f",ratio); |
| | | CGFloat playerVW=playerVH*ratio; |
| | | // CGFloat playerVW=playerVH*ratio; |
| | | self.doorPlayerAspectRatio = ratio; |
| | | // HDLEZLog(@"宽:%ld",(long)playerVW); |
| | | [self.doorPlayerView mas_updateConstraints:^(MASConstraintMaker *make) { |
| | |
| | | |
| | | - (IBAction)large:(id)sender |
| | | { |
| | | if (!self.isPlaying)return; // 未播放禁止全屏, |
| | | self.videoCallOutView.hidden = YES; |
| | | if (_landscape == YES) { |
| | | [self largeBack:self.largeBackButton]; |
| | |
| | | self.speakImageView.alpha = 0; |
| | | self.talkView.hidden = YES; |
| | | }]; |
| | | self.isAnswering = NO; |
| | | } |
| | | |
| | | - (IBAction)localButtonClicked:(id)sender |
| | |
| | | //结束本地录像 |
| | | if(self.localRecordButton.selected) |
| | | { |
| | | __weak __typeof(self)weakSelf = self; |
| | | [_player stopLocalRecordExt:^(BOOL ret) { |
| | | |
| | | NSLog(@"%d", ret); |
| | | |
| | | [_recordTimer invalidate]; |
| | | _recordTimer = nil; |
| | | self.localRecordLabel.hidden = YES; |
| | | [self saveRecordToPhotosAlbum:_filePath]; |
| | | _filePath = nil; |
| | | [weakSelf.recordTimer invalidate]; |
| | | weakSelf.recordTimer = nil; |
| | | weakSelf.localRecordLabel.hidden = YES; |
| | | [weakSelf saveRecordToPhotosAlbum:weakSelf.filePath]; |
| | | weakSelf.filePath = nil; |
| | | }]; |
| | | } |
| | | else |
| | |
| | | } |
| | | |
| | | - (IBAction)clickCalloutHangupAction:(id)sender { |
| | | [UIView dd_showMessage:@"挂断开发中..."]; |
| | | self.isShowAlert = NO; |
| | | [self closeTalkView:self.talkCloseButton]; |
| | | } |
| | | |
| | | - (IBAction)clickCalloutIgnoreAction:(id)sender { |
| | | [UIView dd_showMessage:@"忽略开发中..."]; |
| | | // [UIView dd_showMessage:@"忽略开发中..."]; |
| | | self.isShowAlert = NO; |
| | | self.isAnswering = NO; |
| | | } |
| | | |
| | | - (IBAction)clickCalloutAnswerAction:(id)sender { |
| | | [UIView dd_showMessage:@"接听开发中..."]; |
| | | self.isShowAlert = NO; |
| | | self.isAnswering = YES; |
| | | [self talkButtonClicked:self.talkButton]; |
| | | } |
| | | |
| | |
| | | /// 展示呼叫弹框 |
| | | - (void)showCallOutAlertView { |
| | | self.videoCallOutView.hidden = NO; |
| | | [UIView dd_showMessage:@"展示呼叫弹框"]; |
| | | NSLog(@"展示呼叫弹框"); |
| | | } |
| | | |
| | | /// 隐藏呼叫弹框 |
| | | - (void)hiddenCallOutAlertView { |
| | | self.videoCallOutView.hidden = YES; |
| | | [UIView dd_showMessage:@"隐藏呼叫弹框"]; |
| | | NSLog(@"隐藏呼叫弹框"); |
| | | } |
| | | |
| | | #pragma mark - Private Methods |
| | |
| | | [view removeFromSuperview]; |
| | | } |
| | | } |
| | | CGFloat averageWidth = [UIScreen mainScreen].bounds.size.width/5.0; |
| | | // 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); |
| | | [self.toolBar addSubview:lineImageView1]; |
| | |
| | | - (void)doorLockFullSceneOperation:(HDLEZVideoFullSceneOperation)operation { |
| | | switch (operation) { |
| | | case HDLEZVideoFullSceneOperationOfHangUp: { // 挂断 |
| | | [self largeBack:self.largeButton]; |
| | | [self closeTalkView:self.talkCloseButton]; |
| | | [self hiddenCallOutAlertView]; |
| | | [self.navigationController popViewControllerAnimated:YES]; |
| | | } |
| | | break; |
| | | case HDLEZVideoFullSceneOperationOfPlay: { // 播放 |
| | |
| | | - (void)setIsShowAlert:(BOOL)isShowAlert { |
| | | _isShowAlert = isShowAlert; |
| | | if (isShowAlert) { |
| | | NSLog(@"#####set方法展示"); |
| | | [self showCallOutAlertView]; |
| | | } else { |
| | | NSLog(@"#####set方法隐藏"); |
| | | [self hiddenCallOutAlertView]; |
| | | } |
| | | } |