| | |
| | | { |
| | | BOOL _isOpenSound; |
| | | BOOL _isPlaying; |
| | | BOOL _landscape; // 是否旋转 |
| | | |
| | | NSTimeInterval _playSeconds; //播放秒数 |
| | | NSTimeInterval _duringSeconds; //录像时长 |
| | |
| | | @property (nonatomic, strong) HIKLoadView *loadingView; |
| | | @property (nonatomic) BOOL isSelectedDevice; |
| | | @property (nonatomic, weak) IBOutlet UIView *playerView; |
| | | @property (weak, nonatomic) IBOutlet NSLayoutConstraint *playViewWHScale; |
| | | @property (nonatomic, weak) IBOutlet UILabel *largeTitleLabel; |
| | | @property (nonatomic, weak) IBOutlet UIDatePicker *datePicker; |
| | | @property (nonatomic, weak) IBOutlet UITextField *dateTextField; |
| | |
| | | self.isAutorotate = YES; |
| | | self.largeTitleLabel.text = self.deviceInfo.deviceName; |
| | | self.largeTitleLabel.hidden = YES; |
| | | _landscape = NO; |
| | | |
| | | if(!_records) |
| | | _records = [NSMutableArray new]; |
| | |
| | | |
| | | - (UIInterfaceOrientationMask)supportedInterfaceOrientations |
| | | { |
| | | if (@available(iOS 16.0, *)) { |
| | | if (_landscape) { |
| | | //横屏 |
| | | return UIInterfaceOrientationMaskLandscape; |
| | | } else { |
| | | //竖屏 |
| | | return UIInterfaceOrientationMaskPortrait; |
| | | } |
| | | } else { |
| | | return UIInterfaceOrientationMaskAllButUpsideDown; |
| | | } |
| | | } |
| | | |
| | | - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation |
| | |
| | | self.largeButton.hidden = NO; |
| | | self.voiceButton.hidden = NO; |
| | | self.playButton.hidden = NO; |
| | | [self.playerView setTranslatesAutoresizingMaskIntoConstraints:NO]; |
| | | [NSLayoutConstraint deactivateConstraints:@[self.playViewWHScale]]; |
| | | self.playViewWHScale = [NSLayoutConstraint constraintWithItem:self.playerView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.playerView attribute:NSLayoutAttributeHeight multiplier:16/9. constant:0]; |
| | | [NSLayoutConstraint activateConstraints:@[self.playViewWHScale]]; |
| | | dispatch_async(dispatch_get_main_queue(), ^{ |
| | | [self.playerView layoutIfNeeded]; |
| | | }); |
| | | if(toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || |
| | | toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) |
| | | { |
| | |
| | | self.playbackList.hidden = YES; |
| | | self.largeBackButton.hidden = NO; |
| | | self.navigationController.navigationBarHidden = 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.playerView setTranslatesAutoresizingMaskIntoConstraints:NO]; |
| | | [NSLayoutConstraint deactivateConstraints:@[self.playViewWHScale]]; |
| | | self.playViewWHScale = [NSLayoutConstraint constraintWithItem:self.playerView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.playerView attribute:NSLayoutAttributeHeight multiplier:tureScreenH/(tureScreenW) constant:0]; |
| | | [NSLayoutConstraint activateConstraints:@[self.playViewWHScale]]; |
| | | dispatch_async(dispatch_get_main_queue(), ^{ |
| | | [self.playerView 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 (@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 |
| | | { |
| | | _landscape = NO; |
| | | 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)voiceButtonClicked:(id)sender |
| | |
| | | } |
| | | } |
| | | |
| | | - (BOOL)prefersHomeIndicatorAutoHidden { |
| | | return YES; |
| | | } |
| | | |
| | | @end |