ZFPlayer - 视频播放器
Apache
跨平台
Swift
软件简介
ZFPlayer是一款基于AVPlayer,支持横屏、竖屏(全屏播放还可锁定屏幕方向),上下滑动调节音量、屏幕亮度,左右滑动调节播放进度的视频播放器软件。
功能:
-
支持横、竖屏切换,在全屏播放模式下还可以锁定屏幕方向
-
支持本地视频、网络视频播放
-
左侧1/2位置上下滑动调节屏幕亮度(模拟器调不了亮度,请在真机调试)
-
右侧1/2位置上下滑动调节音量(模拟器调不了音量,请在真机调试)
-
左右滑动调节播放进度
用法(支持IB和代码)
IB用法
直接拖UIView到IB上,宽高比为16:9,代码部分只需要实现
self.playerView.videoURL = self.videoURL;
// 返回按钮事件
__weak typeof(self) weakSelf = self;
self.playerView.goBackBlock = ^{
[weakSelf.navigationController popViewControllerAnimated:YES];
};
代码实现(Masonry)用法
self.playerView = [ZFPlayerView setupZFPlayer];
[self.view addSubview:self.playerView];
[self.playerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.right.equalTo(self.view);
make.height.equalTo(self.playerView.mas_width).multipliedBy(9.0f/16.0f);
}];
self.playerView.videoURL = self.videoURL;// 返回按钮事件__weak typeof(self) weakSelf = self;
self.playerView.goBackBlock = ^{
[weakSelf.navigationController popViewControllerAnimated:YES];
};
图片效果演示