Skip to content

playerConfiguration

shixuemei edited this page Sep 28, 2017 · 5 revisions

配置项

KSYMediaplayer中汇集了一系列配置播放器的属性,包含:

属性/方法 功能 说明
shouldAutoplay 播放视频时是否需要自动播放 默认值是YES
shouldEnableVideoPostProcessing 是否开启视频后处理 默认值是NO
videoDecoderMode 配置视频解码方式 默认值是MPMovieVideoDecoderMode_AUTO
shouldLoop 是否循环播放 只对点播生效,默认值是NO
setTimeout 设置建立链接的超时时间和拉流超时时间,单位是秒 链接超时的默认值是10,拉流超时的默认值是30s
bufferTimeMax 直播流播放时最大的缓冲时长,单位是秒 默认值是2s
scalingMode 视频缩放模式 默认值是MPMovieScalingModeAspectFit
shouldEnableKSYStatModule 是否允许统计播放信息 默认值为YES,如果设置为NO,调用getMetadataqosInfo将会得到nil

示例代码

_player = [[KSYMoviePlayerController alloc] initWithContentURL: _url];
_player.controlStyle = MPMovieControlStyleNone;
[_player.view setFrame: videoView.bounds];  // player's frame must match parent's
[videoView addSubview: _player.view];
[videoView bringSubviewToFront:stat];
videoView.autoresizesSubviews = TRUE;
_player.view.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
_player.shouldAutoplay = TRUE;
_player.shouldEnableVideoPostProcessing = TRUE;
_player.scalingMode = MPMovieScalingModeAspectFit;
_player.videoDecoderMode = MPMovieVideoDecoderMode_AUTO;
_player.shouldLoop = NO;
_player.bufferTimeMax = 5;
[_player setTimeout:5 readTimeout:30];
Clone this wiki locally