BSYPlayerView Class Reference

Inherits from UIView
Declared in BSYPlayerView.h

  player

播放属性

@property (nonatomic, strong, readonly) AVPlayer *player

Declared In

BSYPlayerView.h

  playerLayer

播放图层

@property (nonatomic, strong, readonly) AVPlayerLayer *playerLayer

Declared In

BSYPlayerView.h

  delegate

代理

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

Declared In

BSYPlayerView.h

  playing

当前播放状态

@property (nonatomic, assign, readonly) BOOL playing

Declared In

BSYPlayerView.h

  muted

是否静音,默认为NO

@property (nonatomic, assign) BOOL muted

Declared In

BSYPlayerView.h

  looping

是否循环播放,默认为NO

@property (nonatomic, assign) BOOL looping

Declared In

BSYPlayerView.h

  timeOutLoad

视频加载超时时间,默认30s(逻辑待实现,暂时不生效)

@property (nonatomic, assign) CGFloat timeOutLoad

Declared In

BSYPlayerView.h

  timeOutBuffer

缓存超时时间,默认30s(逻辑待实现,暂时不生效)

@property (nonatomic, assign) CGFloat timeOutBuffer

Declared In

BSYPlayerView.h

– currentPlaybackTime

获取当前已播放时间位置

- (NSTimeInterval)currentPlaybackTime

Return Value

获取当前已播放时间位置

Discussion

@method

获取当前已播放时间位置

Declared In

BSYPlayerView.h

– duration

获取当前播放视频总时长

- (NSTimeInterval)duration

Return Value

获取当前播放视频总时长

Discussion

@method

获取当前播放视频总时长

Declared In

BSYPlayerView.h

– playableDuration

获取可播放的持续时间

- (NSTimeInterval)playableDuration

Return Value

可播放的持续时间

Discussion

@method

获取可播放的持续时间

Declared In

BSYPlayerView.h

  loadStyle

缓冲模式 默认DWPlayerViewLoadStyleDefault

@property (nonatomic, assign) BSYPlayerViewLoadStyle loadStyle

Declared In

BSYPlayerView.h

  videoProtect

是否开启防录屏模式,默认为NO。仅对iOS11以上系统生效

@property (nonatomic, assign) BOOL videoProtect

Declared In

BSYPlayerView.h

  videoGravity

视频填充模式,默认AVLayerVideoGravityResizeAspect

@property (nonatomic, copy) NSString *videoGravity

Declared In

BSYPlayerView.h

  forwardBufferDuration

期待缓冲时长,默认0,建议取值1 ~ 50。仅对iOS10以上系统,m3u8格式视频有效

@property (nonatomic, assign) NSTimeInterval forwardBufferDuration

Declared In

BSYPlayerView.h

  qualityModel

当前正在播放的媒体清晰度model,非在线视频返回nil。注意,在调用playVodViedo:withCustomId:方法后才可获取到此属性

@property (nonatomic, strong, readonly) BSYVodVideoQualityModel *qualityModel

Declared In

BSYPlayerView.h

– playVodViedo:withCustomId:

播放网络视频

- (void)playVodViedo:(BSYVodVideoModel *)videoModel withCustomId:(nullable NSString *)customId

Parameters

videoModel

在线视频model

customId

用户自定义参数,预留参数,传nil

Discussion

@method

播放默认清晰度

Declared In

BSYPlayerView.h

– playLocalVideo:

播放本地视频

- (void)playLocalVideo:(BSYDownloadModel *)downloadModel

Parameters

downloadModel

离线视频model

Discussion

@method

播放本地视频

Declared In

BSYPlayerView.h

– switchQuality:withCustomId:

切换清晰度方法

- (void)switchQuality:(BSYVodVideoQualityModel *)qualitiyModel withCustomId:(nullable NSString *)customId

Parameters

qualitiyModel

清晰度model

customId

用户自定义参数,预留参数,传nil

Discussion

@method

切换清晰度方法

Declared In

BSYPlayerView.h

– setPlayInBackground:

后台播放功能

- (void)setPlayInBackground:(BOOL)play

Parameters

play

是否允许后台播放

Discussion

@method

开启/关闭后台播放功能

Declared In

BSYPlayerView.h

– setPlayerRate:

切换倍速

- (void)setPlayerRate:(float)rate

Parameters

rate

倍速速率

Discussion

@method

切换倍速

Declared In

BSYPlayerView.h

– play

播放

- (void)play

Discussion

@method

播放当前媒体资源

Declared In

BSYPlayerView.h

– pause

暂停

- (void)pause

Discussion

@method

暂停当前媒体资源

Declared In

BSYPlayerView.h

– scrub:

拖到XX秒播放视频

- (void)scrub:(float)time

Parameters

time

跳转时间

Discussion

@method

在AVPlayerItemStatusReadyToPlay即状态处于可播放后,拖拽生效

Declared In

BSYPlayerView.h

– scrubPrecise:CompletionHandler:

拖到XX秒播放视频

- (void)scrubPrecise:(float)time CompletionHandler:(void ( ^ ) ( BOOL finished ))completion

Parameters

time

跳转时间

completion

跳转完成回调

Discussion

@method

在AVPlayerItemStatusReadyToPlay即状态处于可播放后,拖拽生效

Declared In

BSYPlayerView.h

– setVolume:

设置音量

- (void)setVolume:(float)volume

Parameters

volume

音量

Discussion

@method

设置音量

Declared In

BSYPlayerView.h

– resetPlayer

关闭|释放播放资源

- (void)resetPlayer

Discussion

@method

关闭|释放播放资源

Declared In

BSYPlayerView.h