|
plv player sdk doc
|
类型定义 | |
| typedef void * | PLVLivePlayerPtr |
| 播放对象, 每一个播放对象同时只能播放一个频道视频, 可以创建多个播放对象. | |
| typedef bool(* | OnLivePlayerVideoFrameHandler) (PLVVideoFrame *frame, void *data) |
| 播放视频帧的回调通知. | |
| typedef void(* | OnLivePlayerStateHandler) (int state, void *data) |
| 播放状态的回调通知. | |
| typedef void(* | OnLivePlayerPropertyHandler) (int property, int format, const char *value, void *data) |
| 播放属性值的回调通知. | |
| typedef void(* | OnLivePlayerAudioPlayErrorHandler) (void *data) |
| 音频播放错误回调. | |
| typedef void(* | OnLivePlayerChannelStateHandler) (int state, void *data) |
| 频道直播状态回调. | |
| typedef void(* | OnLivePlayerChannelInfoHandler) (const PLVChannelInfo *info, void *data) |
| 频道信息回调. | |
函数 | |
| PLAYERSDK_API PLVLivePlayerPtr PLAYERSDK_CALL | PLVLivePlayerCreate (void *window) |
| 创建直播播放对象并返回对象指针. | |
| PLAYERSDK_API void PLAYERSDK_CALL | PLVLivePlayerDestroy (PLVLivePlayerPtr player) |
| 销毁播放对象. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerSetVideoFrameHandler (PLVLivePlayerPtr player, OnLivePlayerVideoFrameHandler lockHandler, OnLivePlayerVideoFrameHandler unlockHandler, void *data) |
| 设置播放视频帧的回调通知. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerSetStateHandler (PLVLivePlayerPtr player, OnLivePlayerStateHandler handler, void *data) |
| 设置播放状态的回调通知. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerSetPropertyHandler (PLVLivePlayerPtr player, OnLivePlayerPropertyHandler handler, void *data) |
| 设置播放属性值的回调通知. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerSetAudioPlayErrorHandler (PLVLivePlayerPtr player, OnLivePlayerAudioPlayErrorHandler handler, void *data) |
| 设置音频播放错误回调. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerSetChannelStateHandler (PLVLivePlayerPtr player, OnLivePlayerChannelStateHandler handler, void *data) |
| 设置频道直播状态改变回调. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerSetChannelInfoHandler (PLVLivePlayerPtr player, OnLivePlayerChannelInfoHandler handler, void *data) |
| 设置频道信息回调. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerSetOSDConfig (PLVLivePlayerPtr player, bool enable, const PLVOsdConfigInfo *config) |
| 设置跑马灯信息 | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerGetOSDConfig (PLVLivePlayerPtr player, PLVOsdConfigInfo *config) |
| 获取跑马灯信息. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerSetLogoText (PLVLivePlayerPtr player, bool enable, const PLVLogoTextInfo *config) |
| 设置 LOGO 信息 | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerGetLogoText (PLVLivePlayerPtr player, PLVLogoTextInfo *config) |
| 获取 LOGO 信息. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerSetCacheConfig (PLVLivePlayerPtr player, int cacheMs, bool speedTrackingEnable, bool seekTrackingEnable) |
| 设置播放缓存信息. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerGetCacheConfig (PLVLivePlayerPtr player, int *cacheMs, bool *speedTrackingEnable, bool *seekTrackingEnable) |
| 获取播放缓存信息. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerSetLine (PLVLivePlayerPtr player, int lineIndex) |
| 设置播放线路,通过频道信息回调获取频道线路信息. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerSetQuality (PLVLivePlayerPtr player, int qualityIndex) |
| 设置播放清晰度,通过频道信息回调获取频道清晰度信息. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerSetPlayMode (PLVLivePlayerPtr player, int playMode) |
| 设置播放模式,通过频道信息回调获取频道是否支持音视频播放模式. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerSetToken (PLVLivePlayerPtr player, const char *token) |
| 保留接口 | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerPlay (PLVLivePlayerPtr player, const char *channelId) |
| 播放频道直播,始终采用异步模式,中途可随时停止. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerPause (PLVLivePlayerPtr player, bool pause) |
| 暂停或继续播放. | |
| PLAYERSDK_API bool PLAYERSDK_CALL | PLVLivePlayerIsPause (PLVLivePlayerPtr player) |
| 判断是否暂停状态. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerStop (PLVLivePlayerPtr player) |
| 停止播放. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerMute (PLVLivePlayerPtr player, bool mute) |
| 设置是否静音状态. | |
| PLAYERSDK_API bool PLAYERSDK_CALL | PLVLivePlayerIsMute (PLVLivePlayerPtr player) |
| 判断是否静音状态. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerSetVolume (PLVLivePlayerPtr player, int volume) |
| 设置播放声音. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerSetVolumeMax (PLVLivePlayerPtr player, int volume) |
| 设置声音增益. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerGetVolume (PLVLivePlayerPtr player) |
| 获取当前音量值. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerScreenshot (PLVLivePlayerPtr player, const char *filename) |
| 视频截屏. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerGetCurrentAudioDevice (PLVLivePlayerPtr player, char deviceId[PLV_MAX_DEVICE_ID_LENGTH]) |
| 获取当前扬声器设备标识. | |
| PLAYERSDK_API int PLAYERSDK_CALL | PLVLivePlayerSetCurrentAudioDevice (PLVLivePlayerPtr player, const char deviceId[PLV_MAX_DEVICE_ID_LENGTH]) |
| 设置当前扬声器设备标识. | |
| typedef void(* OnLivePlayerAudioPlayErrorHandler) (void *data) |
| typedef void(* OnLivePlayerChannelInfoHandler) (const PLVChannelInfo *info, void *data) |
频道信息回调.
| [out] | info | 频道信息. |
| [out] | data | 用户自定义上下文数据. |
在文件 plv-player-live-CN.h 第 52 行定义.
| typedef void(* OnLivePlayerChannelStateHandler) (int state, void *data) |
| typedef void(* OnLivePlayerPropertyHandler) (int property, int format, const char *value, void *data) |
播放属性值的回调通知.
| [out] | property | 属性类型. |
| [out] | format | 属性数据类型. |
| [out] | value | 属性值. |
| [out] | data | 用户自定义上下文数据. |
在文件 plv-player-live-CN.h 第 31 行定义.
| typedef void(* OnLivePlayerStateHandler) (int state, void *data) |
| typedef bool(* OnLivePlayerVideoFrameHandler) (PLVVideoFrame *frame, void *data) |
| typedef void* PLVLivePlayerPtr |
播放对象, 每一个播放对象同时只能播放一个频道视频, 可以创建多个播放对象.
在文件 plv-player-live-CN.h 第 8 行定义.
| PLAYERSDK_API PLVLivePlayerPtr PLAYERSDK_CALL PLVLivePlayerCreate | ( | void * | window | ) |
创建直播播放对象并返回对象指针.
| window | 绑定播放窗口的句柄. |
| PLAYERSDK_API void PLAYERSDK_CALL PLVLivePlayerDestroy | ( | PLVLivePlayerPtr | player | ) |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerGetCacheConfig | ( | PLVLivePlayerPtr | player, |
| int * | cacheMs, | ||
| bool * | speedTrackingEnable, | ||
| bool * | seekTrackingEnable ) |
获取播放缓存信息.
| player | 播放对象. |
| cacheMs[out] | 播放缓存时长(ms) |
| speedTrackingEnable[out] | 是否通过变速进行追帧 |
| seekTrackingEnable[out] | 当数据累积过大时,是否通过自动向前定位进行追帧 |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerGetCurrentAudioDevice | ( | PLVLivePlayerPtr | player, |
| char | deviceId[PLV_MAX_DEVICE_ID_LENGTH] ) |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerGetLogoText | ( | PLVLivePlayerPtr | player, |
| PLVLogoTextInfo * | config ) |
获取 LOGO 信息.
| player | 播放对象. |
| [out] | config | LOGO 信息. |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerGetOSDConfig | ( | PLVLivePlayerPtr | player, |
| PLVOsdConfigInfo * | config ) |
获取跑马灯信息.
| player | 播放对象. |
| [out] | config | 跑马灯信息. |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerGetVolume | ( | PLVLivePlayerPtr | player | ) |
| PLAYERSDK_API bool PLAYERSDK_CALL PLVLivePlayerIsMute | ( | PLVLivePlayerPtr | player | ) |
| PLAYERSDK_API bool PLAYERSDK_CALL PLVLivePlayerIsPause | ( | PLVLivePlayerPtr | player | ) |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerMute | ( | PLVLivePlayerPtr | player, |
| bool | mute ) |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerPause | ( | PLVLivePlayerPtr | player, |
| bool | pause ) |
暂停或继续播放.
| player | 播放对象. |
| pause | 是否暂停. |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerPlay | ( | PLVLivePlayerPtr | player, |
| const char * | channelId ) |
播放频道直播,始终采用异步模式,中途可随时停止.
| player | 播放对象. |
| channelId | 频道ID. |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerScreenshot | ( | PLVLivePlayerPtr | player, |
| const char * | filename ) |
视频截屏.
| player | 播放对象. |
| filename | png/jpg 截屏文件, 包含路径, 使用 UTF8. |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetAudioPlayErrorHandler | ( | PLVLivePlayerPtr | player, |
| OnLivePlayerAudioPlayErrorHandler | handler, | ||
| void * | data ) |
设置音频播放错误回调.
| player | 播放对象. |
| handler | 回调函数地址. |
| data | 用户自定义上下文数据. |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetCacheConfig | ( | PLVLivePlayerPtr | player, |
| int | cacheMs, | ||
| bool | speedTrackingEnable, | ||
| bool | seekTrackingEnable ) |
设置播放缓存信息.
| player | 播放对象. |
| cacheMs | 播放缓存时长(ms),默认2000ms. |
| speedTrackingEnable | 是否通过变速进行追帧来保持播放实时性,默认启用. |
| seekTrackingEnable | 当数据累积过大时,是否通过自动向前定位进行追帧来保持播放实时性,默认启用. |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetChannelInfoHandler | ( | PLVLivePlayerPtr | player, |
| OnLivePlayerChannelInfoHandler | handler, | ||
| void * | data ) |
设置频道信息回调.
| player | 播放对象. |
| handler | 回调函数地址. |
| data | 用户自定义上下文数据. |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetChannelStateHandler | ( | PLVLivePlayerPtr | player, |
| OnLivePlayerChannelStateHandler | handler, | ||
| void * | data ) |
设置频道直播状态改变回调.
| player | 播放对象. |
| handler | 回调函数地址. |
| data | 用户自定义上下文数据. |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetCurrentAudioDevice | ( | PLVLivePlayerPtr | player, |
| const char | deviceId[PLV_MAX_DEVICE_ID_LENGTH] ) |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetLine | ( | PLVLivePlayerPtr | player, |
| int | lineIndex ) |
设置播放线路,通过频道信息回调获取频道线路信息.
| player | 播放对象. |
| lineIndex | 线路索引,默认0 |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetLogoText | ( | PLVLivePlayerPtr | player, |
| bool | enable, | ||
| const PLVLogoTextInfo * | config ) |
设置 LOGO 信息
| player | 播放对象. |
| enable | 是否使用 LOGO. |
| config | LOGO 信息. |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetOSDConfig | ( | PLVLivePlayerPtr | player, |
| bool | enable, | ||
| const PLVOsdConfigInfo * | config ) |
设置跑马灯信息
| player | 播放对象. |
| enable | 是否使用跑马灯. |
| config | 跑马灯信息. |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetPlayMode | ( | PLVLivePlayerPtr | player, |
| int | playMode ) |
设置播放模式,通过频道信息回调获取频道是否支持音视频播放模式.
| player | 播放对象. |
| playMode | 播放模式. |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetPropertyHandler | ( | PLVLivePlayerPtr | player, |
| OnLivePlayerPropertyHandler | handler, | ||
| void * | data ) |
设置播放属性值的回调通知.
| player | 播放对象. |
| handler | 回调函数地址. |
| data | 用户自定义上下文数据. |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetQuality | ( | PLVLivePlayerPtr | player, |
| int | qualityIndex ) |
设置播放清晰度,通过频道信息回调获取频道清晰度信息.
| player | 播放对象. |
| qualityIndex | 清晰度索引,默认0 |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetStateHandler | ( | PLVLivePlayerPtr | player, |
| OnLivePlayerStateHandler | handler, | ||
| void * | data ) |
设置播放状态的回调通知.
| player | 播放对象. |
| handler | 回调函数地址. |
| data | 用户自定义上下文数据. |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetToken | ( | PLVLivePlayerPtr | player, |
| const char * | token ) |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetVideoFrameHandler | ( | PLVLivePlayerPtr | player, |
| OnLivePlayerVideoFrameHandler | lockHandler, | ||
| OnLivePlayerVideoFrameHandler | unlockHandler, | ||
| void * | data ) |
设置播放视频帧的回调通知.
| player | 播放对象. |
| lockHandler | 锁定缓存回调函数地址. |
| unlockHandler | 解锁缓存回调函数地址. |
| data | 用户自定义上下文数据. |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetVolume | ( | PLVLivePlayerPtr | player, |
| int | volume ) |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetVolumeMax | ( | PLVLivePlayerPtr | player, |
| int | volume ) |
设置声音增益.
| player | 播放对象. |
| volume | <100-1000> 增益范转, 超过 1000 返回失败. |
| PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerStop | ( | PLVLivePlayerPtr | player | ) |