横屏效果:
FZAVPlayer
特征
- 1. 封装源生 AVPlayer 。
- 2. 支持横竖屏切换。
- 3. 支持亮度调节。
- 4. 支持音量调节。
- 5. 支持进度调节。
例
要运行示例项目,请克隆repo,然后从Example目录运行 ”pod install“。
要求
安装
FZAVPlayer 可通过CocoaPods获得. 要安装它,只需将以下行添加到Podfile文件
pod 'FZAVPlayer'
怎样使用
- Objective-C
- (void)viewDidLoad {
[super viewDidLoad];
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"Test" ofType:@"mov"]];
self.player.title = @"屌丝男士";
[self.playerView playWithUrl:url];
}
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
[self.playerView play];
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[self.playerView stop];
}
-(FZAVPlayerView *)playerView{
if (_playerView == nil) {
_playerView = [[FZAVPlayerView alloc]initWithFrame:CGRectMake(0, 200, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.width)];
_playerView.showControlView = YES;
_playerView.showTitleBar = YES;
_playerView.showBackBtn = NO;
_playerView.autoReplay = YES;
_playerView.disableFullScreen = NO;
_playerView.videoGravity = AVLayerVideoGravityResizeAspectFill;
_playerView.showInView = self.view;
}
return _playerView;
}
- Swift
//swif代码
作者
wufuzeng, [email protected]
纵有疾风起,人生不言弃
许可证
FZAVPlayer is available under the MIT license. See the LICENSE file for more info.