-
Notifications
You must be signed in to change notification settings - Fork 479
如何直接弹出全屏的播放器?
changsanjiang edited this page Dec 23, 2020
·
4 revisions
代码如下:
- (IBAction)push:(id)sender {
TestVC *vc = [TestVC.alloc init];
vc.view.hidden = YES;
[self.view addSubview:vc.view];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[vc.player rotate:SJOrientation_LandscapeLeft animated:YES completion:^(__kindof SJBaseVideoPlayer * _Nonnull player) {
vc.view.hidden = NO;
[self.navigationController pushViewController:vc animated:YES];
}];
});
}
#pragma mark -
@interface TestVC : UIViewController
@property (nonatomic, strong) SJVideoPlayer *player;
@end
@implementation TestVC
- (BOOL)shouldAutorotate {
return NO;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = UIColor.whiteColor;
self.player = SJVideoPlayer.player;
[self.view addSubview:self.player.view];
[self.player.view mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.offset(0);
make.left.right.offset(0);
make.height.equalTo(self.player.view.mas_width).multipliedBy(9/16.0);
}];
}
@end