|
@@ -46,7 +46,7 @@
|
|
|
@property(nonatomic,assign) BOOL isPortraitType;//竖屏状态
|
|
|
@property(nonatomic,assign) BOOL isCodeSuspendAudioType;//手动暂停播放音乐
|
|
|
@property(nonatomic,assign) BOOL isCodeSuspendVideoType;//手动暂停播放视频
|
|
|
-@property(nonatomic,assign) BOOL didHandlePortraitType;//竖屏处理过了
|
|
|
+@property(nonatomic,assign) BOOL didHandleRotateingType;//是否正在处理旋转
|
|
|
@end
|
|
|
|
|
|
@implementation videoPlayByAVPlayerViewController
|
|
@@ -59,6 +59,7 @@
|
|
|
//self.navBarBGView.backgroundColor = [UIColor blackColor];
|
|
|
|
|
|
self.view.backgroundColor = [UIColor blackColor];
|
|
|
+ _isPortraitType = YES;
|
|
|
|
|
|
//[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleDeviceOrientationChange) name:UIDeviceOrientationDidChangeNotification object:nil];
|
|
|
|
|
@@ -199,27 +200,28 @@
|
|
|
|
|
|
UIDeviceOrientation orient = [UIDevice currentDevice].orientation;
|
|
|
|
|
|
- HLog(@"orientChangeFun :%d--%ld",_didHandlePortraitType,orient)
|
|
|
- if(_didHandlePortraitType && orient == UIDeviceOrientationPortrait){
|
|
|
+ HLog(@"orientChangeFun :%d--%ld",_didHandleRotateingType,orient)
|
|
|
+ if(_didHandleRotateingType){
|
|
|
return;
|
|
|
}
|
|
|
- _didHandlePortraitType = NO;
|
|
|
|
|
|
+ KWeakSelf
|
|
|
switch (orient) {
|
|
|
case UIDeviceOrientationPortrait:
|
|
|
HLog(@"竖直屏幕");
|
|
|
if(!_isPortraitType){
|
|
|
+ _didHandleRotateingType = YES;
|
|
|
[self.player rotateToOrientation:UIInterfaceOrientationPortrait animated:NO completion:^{
|
|
|
- [self screenLandscapeToPortraitFun];
|
|
|
+ [weakSelf screenLandscapeToPortraitFun];
|
|
|
}];
|
|
|
}
|
|
|
- _didHandlePortraitType = YES;
|
|
|
break;
|
|
|
case UIDeviceOrientationLandscapeLeft:
|
|
|
HLog(@"手机左转");
|
|
|
if(_isPortraitType){
|
|
|
+ _didHandleRotateingType = YES;
|
|
|
[self.player rotateToOrientation:UIInterfaceOrientationLandscapeRight animated:NO completion:^{
|
|
|
- [self screenPortraitToLandscapeFun];
|
|
|
+ [weakSelf screenPortraitToLandscapeFun];
|
|
|
}];
|
|
|
}
|
|
|
|
|
@@ -230,8 +232,9 @@
|
|
|
case UIDeviceOrientationLandscapeRight:
|
|
|
HLog(@"手机右转");
|
|
|
if(_isPortraitType){
|
|
|
+ _didHandleRotateingType = YES;
|
|
|
[self.player rotateToOrientation:UIInterfaceOrientationLandscapeLeft animated:NO completion:^{
|
|
|
- [self screenPortraitToLandscapeFun];
|
|
|
+ [weakSelf screenPortraitToLandscapeFun];
|
|
|
}];
|
|
|
}
|
|
|
break;
|
|
@@ -256,6 +259,7 @@
|
|
|
#pragma mark 竖屏转横屏
|
|
|
- (void)screenPortraitToLandscapeFun{
|
|
|
_isPortraitType = NO;
|
|
|
+ _didHandleRotateingType = NO;
|
|
|
|
|
|
if(_editShareV.secretShareView)
|
|
|
{
|
|
@@ -289,6 +293,7 @@
|
|
|
#pragma mark 横屏转竖屏
|
|
|
- (void)screenLandscapeToPortraitFun{
|
|
|
_isPortraitType = YES;
|
|
|
+ _didHandleRotateingType = NO;
|
|
|
|
|
|
if(_editShareV.secretShareView)
|
|
|
{
|
|
@@ -368,7 +373,7 @@
|
|
|
|
|
|
[titleLab mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.mas_equalTo(45);
|
|
|
- make.right.mas_equalTo(-45);
|
|
|
+ make.right.mas_equalTo(-80);
|
|
|
make.height.mas_equalTo(titleLabFrame.size.height);
|
|
|
make.top.mas_equalTo(titleLabFrame.origin.y);
|
|
|
}];
|