Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

FoundBug/ZFPlayer

Repository files navigation

ZFPlayer

基于AVPlayer,实现了各大视频软件的功能

  • 支持横、竖屏切换,在全屏播放模式下还可以锁定屏幕方向
  • 支持本地视频、网络视频播放
  • 左侧1/2位置上下滑动调节屏幕亮度(模拟器调不了亮度,请在真机调试)
  • 右侧1/2位置上下滑动调节音量(模拟器调不了音量,请在真机调试)
  • 左右滑动调节播放进度

使用需要安装cocopods

$ cd ZFPlayer
$ pod install

Open the "Player.xcworkspace"

用法(支持IB和代码)

IB用法

直接拖UIView到IB上,宽高比为约束为16:9(优先级改为750,比1000低就行),代码部分只需要实现

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);
	// 注意此处,宽高比16:9优先级比1000低就行,在因为iPhone 4S宽高比不是16:9
	make.height.equalTo(self.playerView.mas_width).multipliedBy(9.0f/16.0f).with.priority(750);
}];
self.playerView.videoURL = self.videoURL;
// 返回按钮事件
__weak typeof(self) weakSelf = self;
self.playerView.goBackBlock = ^{
	[weakSelf.navigationController popViewControllerAnimated:YES];
};

图片效果演示

图片效果演示

声音调节演示

亮度调节演示

ps:本人最近swift做的项目,朋友们给点建议吧:

知乎日报Swift

#有技术问题也可以加我的iOS技术群,互相讨论,群号为:213376937

期待

  • 如果在使用过程中遇到BUG,或发现功能不够用,希望你能Issues我,或者微博联系我:@任子丰
  • 如果觉得好用请Star!

About

基于AVPlayer,支持横屏、竖屏(全屏播放还可锁定屏幕方向),上下滑动调节音量、屏幕亮度,左右滑动调节播放进度

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages

  • Objective-C 99.8%
  • Ruby 0.2%

AltStyle によって変換されたページ (->オリジナル) /