Skip to content

Commit

Permalink
fix iOS7 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
renzifeng committed Apr 20, 2016
1 parent 9e8ba26 commit cff0eff
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions ZFPlayer/ZFPlayerView.m
Original file line number Diff line number Diff line change
Expand Up @@ -269,19 +269,8 @@ - (void)layoutSubviews
[super layoutSubviews];
self.playerLayer.frame = self.bounds;

// 屏幕方向一发生变化就会调用这里
[UIApplication sharedApplication].statusBarHidden = NO;
self.isMaskShowing = NO;
// 延迟隐藏controlView
[self animateShow];

// 解决4s,屏幕宽高比不是16:9的问题,player加到控制器上时候
if (iPhone4s && !self.isCellVideo) {
[self mas_updateConstraints:^(MASConstraintMaker *make) {
CGFloat width = [UIScreen mainScreen].bounds.size.width;
make.height.mas_equalTo(width*320/480);
}];
}
// fix iOS7 crash bug
[self layoutIfNeeded];
}
Expand Down Expand Up @@ -326,6 +315,14 @@ - (void)setVideoURL:(NSURL *)videoURL
- (void)setVideoURL:(NSURL *)videoURL
{
_videoURL = videoURL;

// // 解决4s,屏幕宽高比不是16:9的问题,player加到控制器上时候
// if (iPhone4s && !self.isCellVideo) {
// [self mas_updateConstraints:^(MASConstraintMaker *make) {
// make.height.equalTo(self.mas_width).multipliedBy(2/3);
// }];
// }

// 如果已经下载过这个video了,那么直接播放本地视频
if ([[ZFDownloadManager sharedInstance] isCompletion:videoURL.absoluteString]) {
videoURL = [NSURL fileURLWithPath:ZFFileFullpath(videoURL.absoluteString)];
Expand Down Expand Up @@ -831,7 +828,14 @@ - (void)fullScreenAction:(UIButton *)sender
/**
* 屏幕方向发生变化会调用这里
*/
- (void)onDeviceOrientationChange {
- (void)onDeviceOrientationChange
{
// 解决4s,屏幕宽高比不是16:9的问题,player加到控制器上时候
if (iPhone4s && !self.isCellVideo ) {
[self mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(ScreenWidth*2/3);
}];
}
if (self.isLocked) {
self.isFullScreen = YES;
return;
Expand Down Expand Up @@ -926,7 +930,11 @@ - (void)onDeviceOrientationChange {
self.isFullScreen = NO;
return;
}


// 只要屏幕旋转就显示控制层
self.isMaskShowing = NO;
// 延迟隐藏controlView
[self animateShow];
}

/**
Expand Down

0 comments on commit cff0eff

Please sign in to comment.