|
@@ -46,6 +46,7 @@
|
|
|
@property(nonatomic,assign) BOOL isPortraitType;//竖屏状态
|
|
|
@property(nonatomic,assign) BOOL isCodeSuspendAudioType;//手动暂停播放音乐
|
|
|
@property(nonatomic,assign) BOOL isCodeSuspendVideoType;//手动暂停播放视频
|
|
|
+@property(nonatomic,assign) BOOL didHandlePortraitType;//竖屏处理过了
|
|
|
@end
|
|
|
|
|
|
@implementation videoPlayByAVPlayerViewController
|
|
@@ -73,9 +74,6 @@
|
|
|
self.controlView.backBtnClickCallback = ^{
|
|
|
@zf_strongify(self)
|
|
|
[self didClickBackBtnFun];
|
|
|
-// [self.player rotateToOrientation:UIInterfaceOrientationPortrait animated:NO completion:nil];
|
|
|
-// [self.player stop];
|
|
|
- //[self dismissViewControllerAnimated:NO completion:nil];
|
|
|
};
|
|
|
|
|
|
_playerManager = [[ZFAVPlayerManager alloc] init];
|
|
@@ -203,10 +201,16 @@
|
|
|
|
|
|
/**屏幕旋转的通知回调*/
|
|
|
- (void)orientChange:(NSNotification *)noti {
|
|
|
+
|
|
|
+ if(_didHandlePortraitType){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ _didHandlePortraitType = YES;
|
|
|
+
|
|
|
UIDeviceOrientation orient = [UIDevice currentDevice].orientation;
|
|
|
switch (orient) {
|
|
|
case UIDeviceOrientationPortrait:
|
|
|
- NSLog(@"竖直屏幕");
|
|
|
+ HLog(@"竖直屏幕");
|
|
|
if(!_isPortraitType){
|
|
|
[self.player rotateToOrientation:UIInterfaceOrientationPortrait animated:NO completion:^{
|
|
|
[self screenLandscapeToPortraitFun];
|
|
@@ -214,24 +218,25 @@
|
|
|
}
|
|
|
break;
|
|
|
case UIDeviceOrientationLandscapeLeft:
|
|
|
- NSLog(@"手机左转");
|
|
|
+ HLog(@"手机左转");
|
|
|
if(_isPortraitType){
|
|
|
[self.player rotateToOrientation:UIInterfaceOrientationLandscapeRight animated:NO completion:^{
|
|
|
[self screenPortraitToLandscapeFun];
|
|
|
}];
|
|
|
}
|
|
|
+ _didHandlePortraitType = NO;
|
|
|
break;
|
|
|
case UIDeviceOrientationPortraitUpsideDown:
|
|
|
// NSLog(@"手机竖直");
|
|
|
break;
|
|
|
case UIDeviceOrientationLandscapeRight:
|
|
|
- NSLog(@"手机右转");
|
|
|
+ HLog(@"手机右转");
|
|
|
if(_isPortraitType){
|
|
|
[self.player rotateToOrientation:UIInterfaceOrientationLandscapeLeft animated:NO completion:^{
|
|
|
[self screenPortraitToLandscapeFun];
|
|
|
}];
|
|
|
-
|
|
|
}
|
|
|
+ _didHandlePortraitType = NO;
|
|
|
break;
|
|
|
case UIDeviceOrientationUnknown:
|
|
|
//NSLog(@"未知");
|
|
@@ -364,10 +369,12 @@
|
|
|
//横屏
|
|
|
//_controlView.landScapeControlView.fullScreenBtn.hidden = YES;
|
|
|
|
|
|
+ //[_controlView.landScapeControlView.backBtn addTarget:self action:@selector(didClickBackBtnFun) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+
|
|
|
UILabel *titleLabInlandScape = _controlView.landScapeControlView.titleLabel;
|
|
|
titleLabInlandScape.textAlignment = NSTextAlignmentCenter;
|
|
|
titleLabInlandScape.lineBreakMode = NSLineBreakByTruncatingMiddle;
|
|
|
- CGRect titleLabFrameInlandScape = titleLabInlandScape.frame;
|
|
|
+ //CGRect titleLabFrameInlandScape = titleLabInlandScape.frame;
|
|
|
//titleLabInlandScape.backgroundColor = [UIColor greenColor];
|
|
|
|
|
|
[titleLabInlandScape mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
@@ -453,6 +460,8 @@
|
|
|
{
|
|
|
[self.player stop];
|
|
|
|
|
|
+ //_didClickBackType = YES;
|
|
|
+
|
|
|
if(_isCodeSuspendAudioType){
|
|
|
[[DFPlayer sharedPlayer] df_play];
|
|
|
}
|