QCPlayer Class Reference

Inherits from NSObject
Declared in QCPlayer.h

Overview

不带有界面的纯播放器,类似AVFoundation的AVPlayer 可根据该播放器构建自己的带界面的播放器,也可直接使用已构建好的带界面的QCPLayerView。

  playerLayerView

渲染播放视频每一帧的视频显示view,只读

@property (nonatomic, strong, readonly) UIView *playerLayerView

Declared In

QCPlayer.h

  delegate

纯播放器的代理

@property (nonatomic, weak) id<QCPlayerDelegate> delegate

See Also

Declared In

QCPlayer.h

  duration

当前纯播放器播放的视频的总时长,单位:毫秒

@property (nonatomic, assign, readonly) double duration

Declared In

QCPlayer.h

  currentTime

当前纯播放器正在播放的视频的播放时间,单位:毫秒

@property (nonatomic, assign, readonly) double currentTime

Declared In

QCPlayer.h

  state

获取纯播放器当前的状态

@property (nonatomic, assign, readonly) QCPlayerState state

Declared In

QCPlayer.h

– playWithModel:

使用基本播放原子配置当前的纯播放器

- (void)playWithModel:(QCPlayerModel *)model

Parameters

model视频

播放原子模型

See Also

Declared In

QCPlayer.h

– play

视频播放

- (void)play

Declared In

QCPlayer.h

– stop

视频停止

- (void)stop

Declared In

QCPlayer.h

– pause

视频暂停

- (void)pause

Declared In

QCPlayer.h

– seekTo:

对视频进行进度定位

- (void)seekTo:(NSInteger)ms

Parameters

ms

需要定位的位置,单位毫秒

Declared In

QCPlayer.h

– getDuration

获取视频的总播放长度,单位毫秒

- (NSInteger)getDuration

Declared In

QCPlayer.h

– getCurrentPosition

获取视频当前播放位置,单位毫秒

- (NSInteger)getCurrentPosition

Declared In

QCPlayer.h

– getThebuffer

已缓存的视频进度

- (double)getThebuffer

Declared In

QCPlayer.h

– isPlaying

播放器是否在播放使用中

- (BOOL)isPlaying

Declared In

QCPlayer.h

– bufferPercentage

已缓存的视频进度百分比

- (float)bufferPercentage

Declared In

QCPlayer.h

– canPause

视频播放器的状态是否可暂停

- (BOOL)canPause

Declared In

QCPlayer.h

– canSeekBackward

视频播放器是否可以向前seek

- (BOOL)canSeekBackward

Declared In

QCPlayer.h

– canSeekForward

视频播放器是否可以向后seek

- (BOOL)canSeekForward

Declared In

QCPlayer.h

– resume

恢复视频播放

- (void)resume

Declared In

QCPlayer.h

– suspend

停止视频播放,并回收资源

- (void)suspend

Declared In

QCPlayer.h

– setVolume:

设置视频播放的音量

- (void)setVolume:(NSInteger)volume

Parameters

volume

需要设置的音量值,值为0-100

Declared In

QCPlayer.h

– setBrightness:

设置视频亮度

- (void)setBrightness:(float)percentage

Parameters

percentage

视频亮度的百分比,值为0-1

Declared In

QCPlayer.h

– setRate:

设置视频播放的速率

- (void)setRate:(float)rate

Parameters

rate

视频播放的速率值

Declared In

QCPlayer.h

– enableHWCodec:

是否开启视频硬件加速 默认值 NO

- (void)enableHWCodec:(BOOL)enable

Parameters

enable

是否开启硬件加速

Declared In

QCPlayer.h

– screenShot

对当前帧进行视频截图

- (UIImage *)screenShot

Return Value

返回当前帧截图的图片对象

Declared In

QCPlayer.h

– seekToTime:completionHandler:

从定位的位置点开始播放视频,可以设置回调函数当定位完成后进行相应的操作

- (void)seekToTime:(NSInteger)dragedSeconds completionHandler:(void ( ^ ) ( ))completionHandler

Parameters

dragedSeconds

需要定位的位置点

completionHandler

定位完成后会触发该回调

Declared In

QCPlayer.h

– changeVolume:

更改当前视频的音量

- (void)changeVolume:(CGFloat)value

Parameters

value

音量值

Declared In

QCPlayer.h

– changeHeader:

自定义视频请求地址的请求头

- (void)changeHeader:(NSString *)value

Parameters

value

自定义请求头

Declared In

QCPlayer.h

– switchResolutionPlayerWithIndex:

根据索引切换相应的分辨率进行播放 多分辨率时该方法可用 如果索引超过设置的多分辨率数组长度,无效果

- (void)switchResolutionPlayerWithIndex:(NSInteger)index

Parameters

index

想要切换进行播放的分辨率索引

Declared In

QCPlayer.h

– getCurrentResolutionPlayerIndex

当前正在播放的分辨率索引

- (NSInteger)getCurrentResolutionPlayerIndex

Declared In

QCPlayer.h