|
@@ -60,6 +60,8 @@
|
|
|
|
|
|
self.view.backgroundColor = [UIColor blackColor];
|
|
|
|
|
|
+ //[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleDeviceOrientationChange) name:UIDeviceOrientationDidChangeNotification object:nil];
|
|
|
+
|
|
|
_bgView = [[UIView alloc] init];
|
|
|
[self.view addSubview:_bgView];
|
|
|
|
|
@@ -80,6 +82,7 @@
|
|
|
/// 播放器相关
|
|
|
self.player = [[ZFPlayerController alloc] initWithPlayerManager:_playerManager containerView:_bgView];
|
|
|
self.player.controlView = self.controlView;
|
|
|
+ //self.player.allowOrentitaionRotation = NO;
|
|
|
|
|
|
// self.player.orientationObserver.supportInterfaceOrientation = ZFInterfaceOrientationMaskLandscape;
|
|
|
// [self.player rotateToOrientation:UIInterfaceOrientationLandscapeRight animated:NO completion:nil];
|
|
@@ -163,7 +166,7 @@
|
|
|
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
|
|
|
|
|
|
//添加 设备旋转 通知
|
|
|
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientChange:) name:UIDeviceOrientationDidChangeNotification object:nil];
|
|
|
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientChangeFun) name:UIDeviceOrientationDidChangeNotification object:nil];
|
|
|
|
|
|
if(_isCodeSuspendVideoType){
|
|
|
[self.player.currentPlayerManager play];
|
|
@@ -200,14 +203,16 @@
|
|
|
}
|
|
|
|
|
|
/**屏幕旋转的通知回调*/
|
|
|
-- (void)orientChange:(NSNotification *)noti {
|
|
|
+- (void)orientChangeFun {
|
|
|
+
|
|
|
+ UIDeviceOrientation orient = [UIDevice currentDevice].orientation;
|
|
|
|
|
|
- if(_didHandlePortraitType){
|
|
|
+ HLog(@"hxd 333333 orientChangeFun :%d--%ld",_didHandlePortraitType,orient)
|
|
|
+ if(_didHandlePortraitType && orient == UIDeviceOrientationPortrait){
|
|
|
return;
|
|
|
}
|
|
|
- _didHandlePortraitType = YES;
|
|
|
+ _didHandlePortraitType = NO;
|
|
|
|
|
|
- UIDeviceOrientation orient = [UIDevice currentDevice].orientation;
|
|
|
switch (orient) {
|
|
|
case UIDeviceOrientationPortrait:
|
|
|
HLog(@"竖直屏幕");
|
|
@@ -216,6 +221,7 @@
|
|
|
[self screenLandscapeToPortraitFun];
|
|
|
}];
|
|
|
}
|
|
|
+ _didHandlePortraitType = YES;
|
|
|
break;
|
|
|
case UIDeviceOrientationLandscapeLeft:
|
|
|
HLog(@"手机左转");
|
|
@@ -224,7 +230,7 @@
|
|
|
[self screenPortraitToLandscapeFun];
|
|
|
}];
|
|
|
}
|
|
|
- _didHandlePortraitType = NO;
|
|
|
+
|
|
|
break;
|
|
|
case UIDeviceOrientationPortraitUpsideDown:
|
|
|
// NSLog(@"手机竖直");
|
|
@@ -236,7 +242,6 @@
|
|
|
[self screenPortraitToLandscapeFun];
|
|
|
}];
|
|
|
}
|
|
|
- _didHandlePortraitType = NO;
|
|
|
break;
|
|
|
case UIDeviceOrientationUnknown:
|
|
|
//NSLog(@"未知");
|
|
@@ -252,9 +257,30 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+- (void)handleDeviceOrientationChange
|
|
|
+{
|
|
|
+ HLog(@"hxd 333333")
|
|
|
+ [self orientChangeFun];
|
|
|
+}
|
|
|
#pragma mark 竖屏转横屏
|
|
|
- (void)screenPortraitToLandscapeFun{
|
|
|
_isPortraitType = NO;
|
|
|
+
|
|
|
+ if(_editShareV.secretShareView)
|
|
|
+ {
|
|
|
+ [_controlView.landScapeControlView addSubview:_editShareV.secretShareView];
|
|
|
+ [_editShareV.secretShareView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(0);
|
|
|
+ make.right.mas_equalTo(0);
|
|
|
+ make.bottom.mas_equalTo(0);
|
|
|
+ make.top.mas_equalTo(0);
|
|
|
+ }];
|
|
|
+
|
|
|
+ _editShareV.isPortraitType = _isPortraitType;
|
|
|
+ _editShareV.secretShareView.isPortraitType = _isPortraitType;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if(_editShareV){
|
|
|
_editShareV.isPortraitType = _isPortraitType;
|
|
|
[_controlView.landScapeControlView addSubview:_editShareV];
|
|
@@ -273,6 +299,23 @@
|
|
|
- (void)screenLandscapeToPortraitFun{
|
|
|
_isPortraitType = YES;
|
|
|
|
|
|
+ if(_editShareV.secretShareView)
|
|
|
+ {
|
|
|
+ [self.view addSubview:_editShareV.secretShareView];
|
|
|
+
|
|
|
+ [_editShareV.secretShareView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(0);
|
|
|
+ make.right.mas_equalTo(0);
|
|
|
+ make.bottom.mas_equalTo(0);
|
|
|
+ make.top.mas_equalTo(0);
|
|
|
+ }];
|
|
|
+
|
|
|
+ self->_editShareV.isPortraitType = self->_isPortraitType;
|
|
|
+ self->_editShareV.secretShareView.isPortraitType = self->_isPortraitType;
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if(_editShareV){
|
|
|
_editShareV.isPortraitType = _isPortraitType;
|
|
|
[self.view addSubview:_editShareV];
|
|
@@ -582,6 +625,7 @@
|
|
|
[_controlView.landScapeControlView addSubview:_editShareV];
|
|
|
}
|
|
|
else{
|
|
|
+ _editShareV.isPortraitType = YES;
|
|
|
[self.view addSubview:_editShareV];
|
|
|
}
|
|
|
|