NELivePlayerParameter Protocol Reference
Conforms to | NSObject |
---|---|
Declared in | NELivePlayer.h |
view
required method
用于显示的view (只读)
@property (nonatomic, readonly) UIView *view
Discussion
该view中不包含播放控制组件,只用于显示视频图像
Declared In
NELivePlayer.h
– setBufferStrategy:
required method
设置缓冲策略
- (void)setBufferStrategy:(NELPBufferStrategy)bufferStrategy
Parameters
bufferStrategy |
缓冲策略 |
---|
Discussion
1)在播放器初始化后,prepareToPlay之前调用. 2)缓冲策略有直播低延时模式、直播流畅模式以及点播抗抖动模式. 3)如果是直播,建议采用低延时模式或流畅模式,如果是点播或本地视频,建议采用抗抖动模式
Declared In
NELivePlayer.h
– isPlaying
required method
是否正在播放
- (BOOL)isPlaying
Return Value
YES:正在播放,NO:不在播放
Declared In
NELivePlayer.h
– setPauseInBackground:
required method
设置播放器切入后台后的播放状态
- (void)setPauseInBackground:(BOOL)pause
Parameters
pause |
YES:后台暂停 NO:继续播放 |
---|
Discussion
1) 若设置后台暂停,则在切入后台后播放器处于暂停状态,回到前台需要手动播放.\n 2) 若设置后台继续播放,则在切入后台后音频继续播放,回到前台后音视频正常播放.\n
Declared In
NELivePlayer.h
– setScalingMode:
required method
设置显示模式.
- (void)setScalingMode:(NELPMovieScalingMode)aScalingMode
Parameters
aScalingMode |
显示模式. |
---|
Declared In
NELivePlayer.h
– setMute:
required method
设置静音
- (void)setMute:(BOOL)isMute
Parameters
isMute |
YES:开启静音 NO:关闭静音 |
---|
Declared In
NELivePlayer.h
– setHardwareDecoder:
required method
设置硬件解码。
- (void)setHardwareDecoder:(BOOL)isOpen
Parameters
isOpen |
isOpen YES:硬件解码 NO:软件解码 默认:NO |
---|
Declared In
NELivePlayer.h
– setMirrorDisplay:
required method
设置镜像显示
- (void)setMirrorDisplay:(BOOL)isMirror
Parameters
isMirror |
是否镜像显示 |
---|
Discussion
设置镜像显示
Declared In
NELivePlayer.h
– setLoopPlayCount:
required method
设置循环次数
- (void)setLoopPlayCount:(int)count
Parameters
count |
循环次数 |
---|
Discussion
设置循环次数
Declared In
NELivePlayer.h
– getVideoInfo:
required method
获取视频信息
- (void)getVideoInfo:(NELPVideoInfo *)videoInfo
Parameters
videoInfo |
视频信息 |
---|
Discussion
1) 调用prepareToPlay方法,播放器发出NELivePlayerDidPreparedToPlayNotification通知后,调用该方法才能获取到有效的视频信息。\n 2) 其中帧率和码率都是从视频头中读取,若头中没有该信息,则返回0.
Declared In
NELivePlayer.h
– getAudioInfo:
required method
获取音频信息
- (void)getAudioInfo:(NELPAudioInfo *)audioInfo
Parameters
audioInfo |
音频信息 |
---|
Discussion
调用prepareToPlay方法,播放器发出NELivePlayerDidPreparedToPlayNotification通知后,调用该方法才能获取到有效的音频信息。
Declared In
NELivePlayer.h
– getAudioTracksInfo
required method
获取音轨的信息
- (NSArray<NELivePlayerAudioTrackInfo*> *)getAudioTracksInfo
Parameters
info |
音轨的信息 |
---|
Discussion
获取音轨的信息
Declared In
NELivePlayer.h
– getSelectedAudioTrack
required method
获取当前选择的音轨
- (NSInteger)getSelectedAudioTrack
Return Value
当前选择的音轨序号. <0 时为接口调用出错
Discussion
获取当前选择的音轨
Declared In
NELivePlayer.h
– setSelectedAudioTrack:
required method
设置选择的音轨
- (int)setSelectedAudioTrack:(NSInteger)index
Parameters
index |
切换的音轨序号 |
---|
Discussion
设置选择的音轨
Declared In
NELivePlayer.h
playbackSpeed
required method
设置播放速度,仅适用于点播。
@property (nonatomic) float playbackSpeed
Discussion
取值范围 (0.5 ~ 2.0),默认1.0
Declared In
NELivePlayer.h
– setVolume:
required method
设置播放音量
- (void)setVolume:(float)volume
Parameters
volume |
音量大小(范围 0.0 ~ 1.0,0.0为最小,1.0为最大) |
---|
Declared In
NELivePlayer.h
– setPlaybackTimeout:
required method
设置拉流超时时间,在prepareToPlay之前调用
- (void)setPlaybackTimeout:(long)timeout
Parameters
timeout |
超时时间 (单位: 毫秒 ms 范围:0 ~ 30000ms) |
---|
Declared In
NELivePlayer.h
– registerGetVideoRawDataCB:and:
required method
注册获取视频帧数据的回调(只支持软件解码)
- (int)registerGetVideoRawDataCB:(NELPVideoFormatE)neVFormat and:(NELPVideoRawDataCB)videoRawDataCB
Parameters
neVFormat |
回调的视频数据格式 |
---|---|
videoRawDataCB |
获取视频数据的回调函数 |
Return Value
< 0 获取失败
Declared In
NELivePlayer.h
– registerGetAudioRawDataCB:
required method
注册获取音频帧数据的回调
- (int)registerGetAudioRawDataCB:(NELPAudioRawDataCB)audioRawDataCB
Parameters
audioRawDataCB |
获取音频数据的回调函数 |
---|
Return Value
< 0 获取失败
Declared In
NELivePlayer.h
– setAudioPcmDataConfig:
required method
设置音频PCM数据配置 (必须在prepared之前调用)
- (int)setAudioPcmDataConfig:(NELivePlayerPcmConfig *)config
Parameters
config |
配置 |
---|
Return Value
设置是否成功
Discussion
设置音频PCM数据配置 (必须在prepared之前调用)
Declared In
NELivePlayer.h
duration
required method
获取多媒体文件总时长(单位: 秒) (只读)
@property (nonatomic, readonly) NSTimeInterval duration
Discussion
1) 调用prepareToPlay方法后,不能立即获得duration值。只有在播放器发送NELivePlayerDidPreparedToPlayNotification通知后,获取的duration值才有效。\\n 2) isPreparedToPlay值为YES时,duration值才有效。\\n 3) 如果播放的是直播视频,则duration值为0。
Declared In
NELivePlayer.h
playableDuration
required method
获取当前可播放的视频时长(单位:秒) (只读)
@property (nonatomic, readonly) NSTimeInterval playableDuration
Discussion
当播放网络视频时,该值表示已经缓冲的视频的最大时长,若此时网络端开,则只能播放到该时刻为止。
Declared In
NELivePlayer.h
isPreparedToPlay
required method
当前视频文件是否完成初始化(只读)
@property (nonatomic, readonly) BOOL isPreparedToPlay
Discussion
调用prepareToPlay方法后,如果播放器完成视频文件的初始化,会发送NELivePlayerDidPreparedToPlayNotification通知,并将isPreparedToPlay置为YES。
Declared In
NELivePlayer.h
playbackState
required method
获取当前播放状态 (只读)
@property (nonatomic, readonly) NELPMoviePlaybackState playbackState
Discussion
播放状态的变换如下:1) 播放器调用initWithContentURL方法后处于NELPMoviePlaybackStatePaused状态。 2) 调用prepareToPlay方法,如果完成对视频文件的初始化则进入NELPMoviePlaybackStatePlaying状态。 3) 当调用setCurrentPlaybackTime方法时转成NELPMoviePlaybackStateSeeking状态。 4) 调用pause方法转NELPMoviePlaybackStatePaused状态,调用stop方法转到NELPMoviePlaybackStateStopped状态。
Declared In
NELivePlayer.h
loadState
required method
获取当前加载状态 (只读)
@property (nonatomic, readonly) NELPMovieLoadState loadState
Discussion
加载状态的变换如下: 1) 调用prepareToPlay方法,当视频文件初始化完成后,播放器会收到NELivePlayerLoadStateChangedNotification通知,此时的加载状态为 NELPMovieLoadStatePlayable。 2) 当播放器需要缓冲的时候,缓冲开始时,播放会暂停,此时播放器会收到NELivePlayerLoadStateChangedNotification通知,此时的加载状态为 NEPMovieLoadStateStalled。 3) 当缓冲结束时,播放会继续,此时播放器会收到NELivePlayerLoadStateChangedNotification通知,此时的加载状态为 NELPMovieLoadStatePlaythroughOK
Declared In
NELivePlayer.h
shouldAutoplay
required method
设置播放器初始化视频文件完成后是否自动播放,默认自动播放
@property (nonatomic) BOOL shouldAutoplay
Discussion
1) YES:自动播放 NO:手动播放。 2) 当设置为YES后,则在调用prepareToPlay初始化视频文件完成后会自动调用play方法进行播放。
Declared In
NELivePlayer.h
– currentPlaybackTime
required method
查询当前播放时间点(单位:秒)
- (NSTimeInterval)currentPlaybackTime
Discussion
需要在播放器发送NELivePlayerDidPreparedToPlayNotification通知后,才能调用该get方法设置到某一时间点播放,此时isPreparedToPlay的值为 YES
Declared In
NELivePlayer.h
– setCurrentPlaybackTime:
required method
设置当前播放时间点(单位:秒)(用于seek操作)以及获取当前播放的时间点
- (void)setCurrentPlaybackTime:(NSTimeInterval)currentPlaybackTime
Discussion
需要在播放器发送NELivePlayerDidPreparedToPlayNotification通知后,才能调用该set方法设置到某一时间点播放,此时isPreparedToPlay的值为 YES
Declared In
NELivePlayer.h
– setPlaybackTimeListenerWithIntervalMS:callback:
required method
当前播放器时间监听
- (void)setPlaybackTimeListenerWithIntervalMS:(NSTimeInterval)intervalMS callback:(NELPTimestampCallCB)callback
Parameters
intervalMS |
查询间隔,单位毫秒 |
---|---|
callback |
查询结果 |
Declared In
NELivePlayer.h
currentPlaybackRealTime
required method
真实时间戳(只读)
@property (nonatomic, readonly) NSTimeInterval currentPlaybackRealTime
Declared In
NELivePlayer.h
– setRealTimeListenerWithIntervalMS:callback:
required method
真实时间戳监听
- (void)setRealTimeListenerWithIntervalMS:(NSTimeInterval)intervalMS callback:(NELPTimestampCallCB)callback
Parameters
intervalMS |
查询间隔,单位毫秒 |
---|---|
callback |
查询结果 |
Declared In
NELivePlayer.h
currentSyncTimestamp
required method
同步时间戳(只读)
@property (nonatomic, readonly) int64_t currentSyncTimestamp
Declared In
NELivePlayer.h
– setSyncTimestampListenerWithIntervalMS:callback:
required method
同步时间戳监听
- (void)setSyncTimestampListenerWithIntervalMS:(NSTimeInterval)intervalMS callback:(NELPTimestampCallCB)callback
Parameters
intervalMS |
查询间隔,单位毫秒 |
---|---|
callback |
查询结果 |
Declared In
NELivePlayer.h
– setOpenReceiveSyncData:
required method
接收同步数据的开关
- (void)setOpenReceiveSyncData:(BOOL)isOpen
Parameters
isOpen |
YES: 开 NO:关 默认:NO |
---|
Declared In
NELivePlayer.h
– registerSyncContentCB:
required method
设置自定义的透传信息回调
- (void)registerSyncContentCB:(NELPSyncContentCB)contentCB
Parameters
contentCB |
回调的信息 |
---|
Declared In
NELivePlayer.h
– setBufferSize:
required method
缓冲长度
- (void)setBufferSize:(int)size
Parameters
bufferSize |
大小 (510241024 - 15010241024)(仅在缓冲模式为:NELPAntiJitter 时有效) |
---|
Declared In
NELivePlayer.h
– setAccurateSeek:
required method
精确seek开关
- (void)setAccurateSeek:(BOOL)isOpen
Parameters
isOpen |
是否打开。默认:Y。需要在Prepare之前设置。 |
---|
Declared In
NELivePlayer.h
– setRetryConfig:
required method
设置重试
- (void)setRetryConfig:(nullable NELPRetryConfig *)config
Parameters
config |
重试相关配置。需要在Prepare之前设置. |
---|
Discussion
在播放出错时自动进行重试配置
Declared In
NELivePlayer.h
– getMediaRealTimeInfo
required method
获取文件播放的实时信息
- (NELivePlayerRealTimeInfo *)getMediaRealTimeInfo
Return Value
信息结构体
Declared In
NELivePlayer.h
– setLocalSubtitleFile:
required method
设置外挂字幕文件(仅支持点播,格式SRT)
- (NSError *)setLocalSubtitleFile:(NSURL *)file
Parameters
file |
文件路径URL.请务必传入 [ |
---|
Return Value
设置成功返回nil 失败返回具体错误类型
Discussion
可以通过传递不同的文件路径完成字幕切换,设置为NULL时清空字幕。
Declared In
NELivePlayer.h
– registSubtitleStatBlock:
required method
设置字幕文件显示状态回调(仅支持点播)
- (void)registSubtitleStatBlock:(NELivePlayerSubtitleBlock)block
Parameters
block |
回调 |
---|
Discussion
字幕回调的信息不处理字幕中的格式信息,需要应用层根据业务需求自行处理。
Declared In
NELivePlayer.h
– syncClockToPlayer:
required method
设置主同步播放器,使用主同步播放器的时钟进行同步,主同步播放器需要setOpenReceiveSyncData:YES
- (void)syncClockToPlayer:(id<NELivePlayer>)player
Parameters
player |
player |
---|
Discussion
该接口请务必在主播放器收到prepared通知之后再设置
Declared In
NELivePlayer.h
– currentPlayGslbAddress
required method
当前播放的gslb地址
- (NSString *)currentPlayGslbAddress
Return Value
当前播放的gslb地址
Discussion
当前播放的gslb地址
Declared In
NELivePlayer.h