Giter VIP home page Giter VIP logo

chplayer's Introduction

播放器功能:

双击旋转屏幕, 左右滑动快进退,(左半部分)上下滑动调节屏幕亮度,(右半部分)上下滑动调节音量(真机调试才能看到调节系统声音控件),拖动进度条播放 自动旋转屏幕(自动旋转条件:app应用设置支持横屏旋转,将iPhone自动旋转设置打开),锁屏.~~(后期弹幕功能开发中....)

播放器三种类型:

1.仿爱奇艺,芒果,优酷播放器(无导航栏)

2.带导航栏

3.直接全屏

类型1:

image

image

image

类型2:

image

image

类型3:

image

当然,tabbar控制器下 播放器也完美运行。这里就不演示了。

用法:

1.info.plist 文件中 加入

 <key>NSAppTransportSecurity</key>
   <dict>
	 <key>NSAllowsArbitraryLoads</key>
	 <true/>
   </dict>
   <key>UIViewControllerBasedStatusBarAppearance</key>
   <false/>

2.工程中 Device Orientation 默认勾选三个旋转方向(Portrait,Landscape Left,landscape Right)

3.本工程需要用到 Masonry 自动布局 请将 Masonry包导入本工程 github地址:https://github.com/SnapKit/Masonry

4.工程内部所有的导航控制器均要继承于AutorotateNavigaVC,工程内部所有的tab控制器均要继承于AutorotateTabbarVC

5.工程中不需要自动旋转的控制器请这样设置

// 设置是否支持自动旋转 默认开启

- (BOOL)shouldAutorotate{
 return YES;
}

// 支持旋转的方向

- (UIInterfaceOrientationMask)supportedInterfaceOrientations{
 return UIInterfaceOrientationMaskPortrait;
}

6.创建播放器

 NSString *strUrl = @"http://he.yinyuetai.com/uploads/videos/common/080A01550943F9C13EED24FBF1933A39.flv?sc=aabb162ef563e9b2&br=3106&rd=iOS";
 //创建播放器 设置播放器类型playerType 是否自动播放autoPlay
 CHPlayerView * playerView = [[CHPlayerView alloc] initWithFrame:rect playerType:self.type autoPlay:YES];
 [self.view addSubview:playerView];
 self.playerView = playerView;
 //设置播放链接
 playerView.playerUrl = strUrl;
 //设置播放器标题
 playerView.videoTitle = @"惊天魔盗团主题曲";
 //设置播放器额外属性
 playerView.playedColor   = [UIColor greenColor];
 playerView.cacheBarColor = [UIColor cyanColor];
 //设置播放移动小圆点 在 CHPlayerHeader.h 文件中修改对应的图片名称 并放入图片资源即可
 //非全屏返回
 playerView.backClickBlock = ^(){
      [weakSelf backAction];
 };
 //非全屏更多选项
 playerView.moreClickBlock = ^(){
      weakSelf.playerView.playerUrl = @"http://hd.yinyuetai.com/uploads/videos/common/B47E013A6407D27C66A5DF307657F2B3.flv?sc=741fb0d8a9b7028c&br=1099&rd=iOS";
      weakSelf.playerView.videoTitle = @"2010超时代演唱会";
 };
 //播放结束回调
 playerView.playerEndBlock = ^(){
      weakSelf.playerView.playerUrl = @"http://he.yinyuetai.com/uploads/videos/common/080A01550943F9C13EED24FBF1933A39.flv?sc=aabb162ef563e9b2&br=3106&rd=iOS";
      weakSelf.playerView.videoTitle = @"Taylor Swift style!!";
 };

更多详情 请参考demo. 如有疑问 请issues.

chplayer's People

Contributors

coopsif avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

chplayer's Issues

Masonry这个怎么放到工程里面?

能不能把这个Masonry下载下来直接放到chplayer这个工程里面,这样我们直接下载chplayer这个就可以使用了,不会把Masonry集成到chplayer中

全屏按钮

你好,全屏按钮点击无效,其它的按钮手势都正常,但是点击全屏按钮没有反应,是需要设置什么吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.