前言
當(dāng)前很多有關(guān)于視頻播放的一些APP,基本在視頻顯示上面都是進(jìn)行的自定義控件。進(jìn)行了很多美化,便捷,以及多功能的支持。下面就和大家介紹一下我的自定義控件:

代碼
- (void)viewDidLoad {
[super viewDidLoad];
UIView *modelV = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 400, 300)];
modelV.center = self.view.center;
modelV.backgroundColor = [UIColor grayColor];
[self.view addSubview:modelV];
DJPlayControlView *controlV = [[DJPlayControlView alloc] init];
controlV.frame = CGRectMake(0, 0, 400, 300);
controlV.titleLabel.text= @"視頻標(biāo)題";
[modelV addSubview:controlV];
}
說明
這里DJPlayControlView就是自定義的控件視圖,當(dāng)前顯示的比較簡單,因為未使用播放器,所以DJPlayControlView下面只是一個View(替代播放器),層次圖如下:


這里播放器控件視圖大小和播放器一樣,只是視圖層在播放器上面
#import <UIKit/UIKit.h>
@class ASValueTrackingSlider;
@class MMMaterialDesignSpinner;
@interface DJPlayControlView : UIView
/** 標(biāo)題 */
@property (nonatomic, strong) UILabel? ? ? ? ? ? ? ? *titleLabel;
/** 開始播放按鈕 */
@property (nonatomic, strong) UIButton? ? ? ? ? ? ? ? *startBtn;
/** 當(dāng)前播放時長label */
@property (nonatomic, strong) UILabel? ? ? ? ? ? ? ? *currentTimeLabel;
/** 視頻總時長label */
@property (nonatomic, strong) UILabel? ? ? ? ? ? ? ? *totalTimeLabel;
/** 緩沖進(jìn)度條 */
@property (nonatomic, strong) UIProgressView? ? ? ? ? *progressView;
/** 滑桿 */
@property (nonatomic, strong) ASValueTrackingSlider? *videoSlider;
/** 全屏按鈕 */
@property (nonatomic, strong) UIButton? ? ? ? ? ? ? ? *fullScreenBtn;
/** 鎖定屏幕方向按鈕 */
@property (nonatomic, strong) UIButton? ? ? ? ? ? ? ? *lockBtn;
/** 系統(tǒng)菊花 */
@property (nonatomic, strong) MMMaterialDesignSpinner *activity;
/** 返回按鈕*/
@property (nonatomic, strong) UIButton? ? ? ? ? ? ? ? *backBtn;
/** 關(guān)閉按鈕*/
@property (nonatomic, strong) UIButton? ? ? ? ? ? ? ? *closeBtn;
/** 重播按鈕 */
@property (nonatomic, strong) UIButton? ? ? ? ? ? ? ? *repeatBtn;
/** bottomView*/
@property (nonatomic, strong) UIImageView? ? ? ? ? ? *bottomImageView;
/** topView */
@property (nonatomic, strong) UIImageView? ? ? ? ? ? *topImageView;
/** 緩存按鈕 */
@property (nonatomic, strong) UIButton? ? ? ? ? ? ? ? *downLoadBtn;
/** 切換分辨率按鈕 */
@property (nonatomic, strong) UIButton? ? ? ? ? ? ? ? *resolutionBtn;
/** 分辨率的View */
@property (nonatomic, strong) UIView? ? ? ? ? ? ? ? ? *resolutionView;
/** 播放按鈕 */
@property (nonatomic, strong) UIButton? ? ? ? ? ? ? ? *playeBtn;
/** 加載失敗按鈕 */
@property (nonatomic, strong) UIButton? ? ? ? ? ? ? ? *failBtn;
/** 快進(jìn)快退View*/
@property (nonatomic, strong) UIView? ? ? ? ? ? ? ? ? *fastView;
/** 快進(jìn)快退進(jìn)度progress*/
@property (nonatomic, strong) UIProgressView? ? ? ? ? *fastProgressView;
/** 快進(jìn)快退時間*/
@property (nonatomic, strong) UILabel? ? ? ? ? ? ? ? *fastTimeLabel;
/** 快進(jìn)快退ImageView*/
@property (nonatomic, strong) UIImageView? ? ? ? ? ? *fastImageView;
/** 當(dāng)前選中的分辨率btn按鈕 */
@property (nonatomic, weak? ) UIButton? ? ? ? ? ? ? ? *resoultionCurrentBtn;
/** 占位圖 */
@property (nonatomic, strong) UIImageView? ? ? ? ? ? *placeholderImageView;
/** 控制層消失時候在底部顯示的播放進(jìn)度progress */
@property (nonatomic, strong) UIProgressView? ? ? ? ? *bottomProgressView;
/** 分辨率的名稱 */
@property (nonatomic, strong) NSArray? ? ? ? ? ? ? ? *resolutionArray;
/** 顯示控制層 */
@property (nonatomic, assign, getter=isShowing) BOOL? showing;
/** 小屏播放 */
@property (nonatomic, assign, getter=isShrink ) BOOL? shrink;
/** 在cell上播放 */
@property (nonatomic, assign, getter=isCellVideo)BOOL cellVideo;
/** 是否拖拽slider控制播放進(jìn)度 */
@property (nonatomic, assign, getter=isDragged) BOOL? dragged;
/** 是否播放結(jié)束 */
@property (nonatomic, assign, getter=isPlayEnd) BOOL? playeEnd;
/** 是否全屏播放 */
@property (nonatomic, assign,getter=isFullScreen)BOOL fullScreen;
@end