SJVideoPlayer
SJVideoPlayer copied to clipboard
设置了无动画,但是dimiss时还是有向左上角坐标(0.0)的缩放动画
必现/偶发? 必现
描述bug tableView 点击cell全屏播放视频,设置了无动画,但是dimiss时还是有向左上角坐标(0.0)的缩放动画
核心代码如下:
SJPlayModel *playModel = [SJPlayModel playModelWithTableView:self.tableView indexPath:indexPath];
_player.URLAsset = [[SJVideoPlayerURLAsset alloc] initWithURL:url playModel:playModel];
@weakify(self);
[_player setFitOnScreen:YES animated:NO completionHandler:^(__kindof SJBaseVideoPlayer * _Nonnull player) {
@strongify(self);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
@strongify(self);
[self.player play];
});
}];
你期望的结果是什么? animated:NO 时,出现和消失都没有动画效果
发现是下面代码
- (void)_backButtonWasTapped { if ( self.isFullscreen && ![self _whetherToSupportOnlyOneOrientation] ) { [self rotate]; } else if ( self.isFitOnScreen ) { self.fitOnScreen = NO; } else { UIViewController *vc = [self.view lookupResponderForClass:UIViewController.class]; [vc.view endEditing:YES]; if ( vc.navigationController.viewControllers.count > 1 ) { [vc.navigationController popViewControllerAnimated:YES]; } else { vc.presentingViewController ? [vc dismissViewControllerAnimated:YES completion:nil] : [vc.navigationController popViewControllerAnimated:YES]; } } } 中 self.fitOnScreen = NO; 导致的
因为
- (void)setFitOnScreen:(BOOL)fitOnScreen { [self setFitOnScreen:fitOnScreen animated:YES]; } 始终会传YES,导致一直有动画效果,建议优化下