To run the example project, clone the repo, and run pod install
from the Example directory first.
KPengIjkPlayer is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'KPengIjkPlayer',:git=>'https://github.com/smithgoo/KPengIjkPlayer.git'
KPengIjkPlayer is available under the MIT license. See the LICENSE file for more info.
How to use
- (void)playerBackAction {
if (!_videoPlayer.isFullScreen) {
[self.navigationController popViewControllerAnimated:YES];
} else {
[_videoPlayer videoPlayrotateAction:NO];
}
}
- (void)exchangeAction:(UIButton*)sender {
[_videoPlayer exChangePlayMthod];
}
#pragma mark -与全屏相关的代理方法等
- (void)videoScreenFullScreenOrNot:(BOOL)isFullScreen {
[_videoPlayer videoPlayrotateAction:isFullScreen];
}
#pragma mark------ijk 播放的代理方法 -(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator{
if ([UIDevice currentDevice].orientation ==UIDeviceOrientationLandscapeLeft||[UIDevice currentDevice].orientation ==UIDeviceOrientationLandscapeRight){
UIWindow*window= [UIApplication sharedApplication].keyWindow;
_videoPlayer.frame=CGRectMake(0, 0, size.width,size.height);
_videoPlayer.player.view.frame=CGRectMake(0, 0, size.width,size.height);
_videoPlayer.isFullScreen=YES;
_videoPlayer.toolsView.isFullScreen =YES;
[window addSubview:_videoPlayer];
}else{
// if (KIsiPhoneX||KIsiPhoneXR||KIsiPhoneXS||KIsiPhoneXS_MAX) {
// _playerView.frame=CGRectMake(0, 30, size.width, size.width/16*9);
// _playerView.player.view.frame=CGRectMake(0, 30, size.width, size.width/16*9);
// } else {
_videoPlayer.frame=CGRectMake(0, 0, size.width, size.width/16*9);
_videoPlayer.player.view.frame=CGRectMake(0, 0, size.width, size.width/16*9);
// }
_videoPlayer.isFullScreen=NO;
_videoPlayer.toolsView.isFullScreen =NO;
[self.view addSubview:_videoPlayer];
}
}