plv player sdk doc
|
类型定义 | |
typedef void * | PLVPlayerPtr |
播放对象, 每一个播放对象同时只能播放一个视频, 可以创建多个播放对象. | |
typedef bool(* | OnPlayerVideoFrameHandler) (const char *vid, PLVVideoFrame *frame, void *data) |
播放视频帧的回调通知. | |
typedef void(* | OnPlayerStateHandler) (const char *vid, int state, void *data) |
播放状态的回调通知. | |
typedef void(* | OnPlayerPropertyHandler) (const char *vid, int property, int format, const char *value, void *data) |
播放属性值的回调通知. | |
typedef void(* | OnPlayerRateChangeHandler) (const char *vid, int inputRate, int realRate, void *data) |
播放清晰度的回调通知. 此回调的场景在: | |
typedef void(* | OnPlayerProgressHandler) (const char *vid, int millisecond, void *data) |
播放进度的回调通知. | |
typedef void(* | OnPlayerAudioPlayErrorHandler) (const char *vid, void *data) |
音频播放错误回调. | |
typedef void(* | OnPlayerAudioDeviceHandler) (int audioDeviceCount, void *data) |
播放扬声器设备的回调通知. | |
函数 | |
PLAYERSDK_API PLVPlayerPtr PLAYERSDK_CALL | PLVPlayerCreate (void *window) |
创建播放对象并返回对象指针. 在使用播放接口对象前, 必须先调用此接口创建对象. | |
PLAYERSDK_API void PLAYERSDK_CALL | PLVPlayerDestroy (PLVPlayerPtr player) |
销毁播放对象. 不再使用创建的对象后, 必须调用此接口回收. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerSetVideoFrameHandler (PLVPlayerPtr player, OnPlayerVideoFrameHandler lockHandler, OnPlayerVideoFrameHandler unlockHandler, void *data) |
设置播放视频帧的回调通知. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerSetStateHandler (PLVPlayerPtr player, OnPlayerStateHandler handler, void *data) |
设置播放状态的回调通知. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerSetPropertyHandler (PLVPlayerPtr player, OnPlayerPropertyHandler handler, void *data) |
设置播放属性值的回调通知. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerSetRateChangeHandler (PLVPlayerPtr player, OnPlayerRateChangeHandler handler, void *data) |
设置清晰度变化的回调通知. 只有输入清度为 VIDEO_RATE_AUTO 才会触发此回调. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerSetProgressHandler (PLVPlayerPtr player, OnPlayerProgressHandler handler, void *data) |
设置播放进度的回调通知. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerSetAudioPlayErrorHandler (PLVPlayerPtr player, OnPlayerAudioPlayErrorHandler handler, void *data) |
设置音频播放错误回调. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerSetAudioDeviceHandler (PLVPlayerPtr player, OnPlayerAudioDeviceHandler handler, void *data) |
设置扬声器热插拔的回调通知. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerResetHandler (PLVPlayerPtr player) |
重置所有回调通知, 会请空所有的回调函数地址. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerSetOSDConfig (PLVPlayerPtr player, bool enable, const PLVOsdConfigInfo *config) |
设置跑马灯信息 | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerGetOSDConfig (PLVPlayerPtr player, PLVOsdConfigInfo &config) |
获取跑马灯信息. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerSetLogoText (PLVPlayerPtr player, bool enable, const PLVLogoTextInfo *config) |
设置 LOGO 信息 | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerGetLogoText (PLVPlayerPtr player, PLVLogoTextInfo &config) |
获取 LOGO 信息. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerSetCacheConfig (PLVPlayerPtr player, bool enable, int maxCacheBytes, int maxCacheSeconds) |
设置播放缓存信息. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerGetCacheConfig (PLVPlayerPtr player, int *maxCacheBytes, int *maxCacheSeconds) |
获取缓存信息. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerSetInfo (PLVPlayerPtr player, const char *vid, const char *path, int rate) |
设置视频信息. 在调用播放前, 必须先设置视频的相关信息, 否则会报错. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerPlay (PLVPlayerPtr player, const char *token, int seekMillisecond, bool autoDownRate, bool traceVideo, bool sync) |
播放视频. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerPlayLocal (PLVPlayerPtr player, int seekMillisecond, bool autoDownRate) |
离线播放. 调用前必须设置视频的存放地址. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerLoadLocal (PLVPlayerPtr player, int seekMillisecond, bool autoDownRate) |
离线加载视频, 不自动播放. 调用前必须设置视频的存放地址. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerPause (PLVPlayerPtr player, bool pause) |
设置是否暂停状态. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerStop (PLVPlayerPtr player) |
停止播放. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerSetMute (PLVPlayerPtr player, bool mute) |
设置是否静音状态. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerSetSeek (PLVPlayerPtr player, int millisecond) |
跳转到指定的播放位置. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerSeekToEnd (PLVPlayerPtr player) |
停止在最后一帧. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerSetVolume (PLVPlayerPtr player, int volume) |
设置播放声音. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerSetVolumeMax (PLVPlayerPtr player, int volume) |
设置声音增益. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerScreenshot (PLVPlayerPtr player, const char *filename) |
视频截屏. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerSetSpeed (PLVPlayerPtr player, double speed) |
倍速播放, 通过作为参数给定的系数来减慢或加快播放速度. | |
PLAYERSDK_API bool PLAYERSDK_CALL | PLVPlayerIsMute (PLVPlayerPtr player) |
判断是否静音状态. | |
PLAYERSDK_API bool PLAYERSDK_CALL | PLVPlayerIsValid (PLVPlayerPtr player) |
判断是否加载还是空闲状态. | |
PLAYERSDK_API bool PLAYERSDK_CALL | PLVPlayerIsPause (PLVPlayerPtr player) |
判断是否暂停状态. | |
PLAYERSDK_API bool PLAYERSDK_CALL | PLVPlayerIsPlaying (PLVPlayerPtr player) |
判断是否播放中. | |
PLAYERSDK_API bool PLAYERSDK_CALL | PLVPlayerIsLoaded (PLVPlayerPtr player) |
判断视频是否加载. | |
PLAYERSDK_API bool PLAYERSDK_CALL | PLVPlayerIsLoading (PLVPlayerPtr player) |
判断视频是否加载中. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerGetCurrentRateCount (PLVPlayerPtr player) |
获取视频的清晰度总数. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerGetCurrentRate (PLVPlayerPtr player) |
当前视频的清晰度. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerGetVolume (PLVPlayerPtr player) |
获取当前音量值. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerGetDuration (PLVPlayerPtr player) |
获取视频的时长. | |
PLAYERSDK_API double PLAYERSDK_CALL | PLVPlayerGetSpeed (PLVPlayerPtr player) |
获取视频播放倍数. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerGetAudioDeviceCount (PLVPlayerPtr player) |
获取扬声器设备总数. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerGetAudioDeviceInfo (PLVPlayerPtr player, int index, char deviceId[PLV_MAX_DEVICE_ID_LENGTH], char deviceName[PLV_MAX_DEVICE_ID_LENGTH]) |
获取扬声器设备信息. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerGetCurrentAudioDevice (PLVPlayerPtr player, char deviceId[PLV_MAX_DEVICE_ID_LENGTH]) |
获取当前扬声器设备标识. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerSetCurrentAudioDevice (PLVPlayerPtr player, const char deviceId[PLV_MAX_DEVICE_ID_LENGTH]) |
设置当前扬声器设备标识. | |
PLAYERSDK_API int PLAYERSDK_CALL | PLVPlayerReloadAudioDevice (PLVPlayerPtr player) |
重置扬声器设备. 使用场景, 可以在收到设备变动回调, 再调用此接口即可. | |
typedef void(* OnPlayerAudioDeviceHandler) (int audioDeviceCount, void *data) |
播放扬声器设备的回调通知.
[out] | audioDeviceCount | 扬声器总的个数. |
[out] | data | 用户自定义上下文数据. |
在文件 plv-player-core-CN.h 第 407 行定义.
typedef void(* OnPlayerAudioPlayErrorHandler) (const char *vid, void *data) |
typedef void(* OnPlayerProgressHandler) (const char *vid, int millisecond, void *data) |
播放进度的回调通知.
[out] | vid | 视频标识. |
[out] | millisecond | 时间进度. |
[out] | data | 用户自定义上下文数据. |
在文件 plv-player-core-CN.h 第 393 行定义.
typedef void(* OnPlayerPropertyHandler) (const char *vid, int property, int format, const char *value, void *data) |
播放属性值的回调通知.
[out] | vid | 视频标识. |
[out] | property | 属性类型. |
[out] | format | 属性数据类型. |
[out] | value | 属性值. |
[out] | data | 用户自定义上下文数据. |
在文件 plv-player-core-CN.h 第 373 行定义.
typedef void(* OnPlayerRateChangeHandler) (const char *vid, int inputRate, int realRate, void *data) |
播放清晰度的回调通知. 此回调的场景在:
[out] | vid | 视频标识. |
[out] | inputRate | 用户输入的清晰度. |
[out] | realRate | 真正播放的清晰度. |
[out] | data | 用户自定义上下文数据. |
在文件 plv-player-core-CN.h 第 384 行定义.
typedef void(* OnPlayerStateHandler) (const char *vid, int state, void *data) |
播放状态的回调通知.
[out] | vid | 视频标识. |
[out] | state | 播放状态. |
[out] | data | 用户自定义上下文数据. |
在文件 plv-player-core-CN.h 第 364 行定义.
typedef bool(* OnPlayerVideoFrameHandler) (const char *vid, PLVVideoFrame *frame, void *data) |
播放视频帧的回调通知.
[out] | vid | 视频标识. |
[out] | frame | 视频帧. |
[out] | data | 用户自定义上下文数据. |
在文件 plv-player-core-CN.h 第 357 行定义.
typedef void* PLVPlayerPtr |
播放对象, 每一个播放对象同时只能播放一个视频, 可以创建多个播放对象.
在文件 plv-player-core-CN.h 第 350 行定义.
PLAYERSDK_API PLVPlayerPtr PLAYERSDK_CALL PLVPlayerCreate | ( | void * | window | ) |
创建播放对象并返回对象指针. 在使用播放接口对象前, 必须先调用此接口创建对象.
window | 绑定播放窗口的句柄. |
PLAYERSDK_API void PLAYERSDK_CALL PLVPlayerDestroy | ( | PLVPlayerPtr | player | ) |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerGetAudioDeviceCount | ( | PLVPlayerPtr | player | ) |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerGetAudioDeviceInfo | ( | PLVPlayerPtr | player, |
int | index, | ||
char | deviceId[PLV_MAX_DEVICE_ID_LENGTH], | ||
char | deviceName[PLV_MAX_DEVICE_ID_LENGTH] ) |
获取扬声器设备信息.
player | 播放对象. |
index | 扬声器设备索引. | |
[out] | deviceId | 扬声器设备标识. |
[out] | deviceName | 扬声器设备名称. |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerGetCacheConfig | ( | PLVPlayerPtr | player, |
int * | maxCacheBytes, | ||
int * | maxCacheSeconds ) |
获取缓存信息.
player | 播放对象. |
[out] | maxCacheBytes | 缓存字节数. |
[out] | maxCacheSeconds | 缓存时间数. |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerGetCurrentAudioDevice | ( | PLVPlayerPtr | player, |
char | deviceId[PLV_MAX_DEVICE_ID_LENGTH] ) |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerGetCurrentRate | ( | PLVPlayerPtr | player | ) |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerGetCurrentRateCount | ( | PLVPlayerPtr | player | ) |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerGetDuration | ( | PLVPlayerPtr | player | ) |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerGetLogoText | ( | PLVPlayerPtr | player, |
PLVLogoTextInfo & | config ) |
获取 LOGO 信息.
player | 播放对象. |
[out] | config | LOGO 信息. |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerGetOSDConfig | ( | PLVPlayerPtr | player, |
PLVOsdConfigInfo & | config ) |
获取跑马灯信息.
player | 播放对象. |
[out] | config | 跑马灯信息. |
PLAYERSDK_API double PLAYERSDK_CALL PLVPlayerGetSpeed | ( | PLVPlayerPtr | player | ) |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerGetVolume | ( | PLVPlayerPtr | player | ) |
PLAYERSDK_API bool PLAYERSDK_CALL PLVPlayerIsLoaded | ( | PLVPlayerPtr | player | ) |
PLAYERSDK_API bool PLAYERSDK_CALL PLVPlayerIsLoading | ( | PLVPlayerPtr | player | ) |
PLAYERSDK_API bool PLAYERSDK_CALL PLVPlayerIsMute | ( | PLVPlayerPtr | player | ) |
PLAYERSDK_API bool PLAYERSDK_CALL PLVPlayerIsPause | ( | PLVPlayerPtr | player | ) |
PLAYERSDK_API bool PLAYERSDK_CALL PLVPlayerIsPlaying | ( | PLVPlayerPtr | player | ) |
PLAYERSDK_API bool PLAYERSDK_CALL PLVPlayerIsValid | ( | PLVPlayerPtr | player | ) |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerLoadLocal | ( | PLVPlayerPtr | player, |
int | seekMillisecond, | ||
bool | autoDownRate ) |
离线加载视频, 不自动播放. 调用前必须设置视频的存放地址.
player | 播放对象. |
seekMillisecond | 指定开始播放的位置. |
autoDownRate | 如果不存在清晰度是否自动降低清晰度. 使用场景是, 如果用户指定要播放的清晰度为超清时, 此清晰度不存在时:
|
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerPause | ( | PLVPlayerPtr | player, |
bool | pause ) |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerPlay | ( | PLVPlayerPtr | player, |
const char * | token, | ||
int | seekMillisecond, | ||
bool | autoDownRate, | ||
bool | traceVideo, | ||
bool | sync ) |
播放视频.
player | 播放对象. |
token | 加密视频必须使用它. |
seekMillisecond | 指定开始播放的位置. |
autoDownRate | 如果不存在清晰度是否自动降低清晰度. 使用场景是, 如果用户指定要播放的清晰度为超清时, 此清晰度不存在时:
|
traceVideo | 仅在溯源视频下需要设置为true. |
sync | 是否同步播放.
|
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerPlayLocal | ( | PLVPlayerPtr | player, |
int | seekMillisecond, | ||
bool | autoDownRate ) |
离线播放. 调用前必须设置视频的存放地址.
player | 播放对象. |
seekMillisecond | 指定开始播放的位置. |
autoDownRate | 如果不存在清晰度是否自动降低清晰度. 使用场景是, 如果用户指定要播放的清晰度为超清时, 此清晰度不存在时:
|
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerReloadAudioDevice | ( | PLVPlayerPtr | player | ) |
重置扬声器设备. 使用场景, 可以在收到设备变动回调, 再调用此接口即可.
player | 播放对象. |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerResetHandler | ( | PLVPlayerPtr | player | ) |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerScreenshot | ( | PLVPlayerPtr | player, |
const char * | filename ) |
视频截屏.
player | 播放对象. |
filename | png/jpg 截屏文件, 包含路径, 使用 UTF8. |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSeekToEnd | ( | PLVPlayerPtr | player | ) |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetAudioDeviceHandler | ( | PLVPlayerPtr | player, |
OnPlayerAudioDeviceHandler | handler, | ||
void * | data ) |
设置扬声器热插拔的回调通知.
player | 播放对象. |
handler | 回调函数地址. |
data | 用户自定义上下文数据. |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetAudioPlayErrorHandler | ( | PLVPlayerPtr | player, |
OnPlayerAudioPlayErrorHandler | handler, | ||
void * | data ) |
设置音频播放错误回调.
player | 播放对象. |
handler | 回调函数地址. |
data | 用户自定义上下文数据. |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetCacheConfig | ( | PLVPlayerPtr | player, |
bool | enable, | ||
int | maxCacheBytes, | ||
int | maxCacheSeconds ) |
设置播放缓存信息.
player | 播放对象. |
enable | 使用或不使用缓存, 决定是否使用网络缓存设置(默认: 自动). |
maxCacheBytes | 默认值为 30MB(30*1024*1024),一般默认即可.设置-1无效 |
deprecated | MaxCacheSeconds: 过时的参数,设置为-1即可 |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetCurrentAudioDevice | ( | PLVPlayerPtr | player, |
const char | deviceId[PLV_MAX_DEVICE_ID_LENGTH] ) |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetInfo | ( | PLVPlayerPtr | player, |
const char * | vid, | ||
const char * | path, | ||
int | rate ) |
设置视频信息. 在调用播放前, 必须先设置视频的相关信息, 否则会报错.
player | 播放对象. |
vid | 视频标识. |
path | 视频存放的路径, 如果是离线播放, 则必须使用它, 使用 UTF8. |
rate | 视频清晰度. |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetLogoText | ( | PLVPlayerPtr | player, |
bool | enable, | ||
const PLVLogoTextInfo * | config ) |
设置 LOGO 信息
player | 播放对象. |
enable | 是否使用 LOGO. |
config | LOGO 信息. |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetMute | ( | PLVPlayerPtr | player, |
bool | mute ) |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetOSDConfig | ( | PLVPlayerPtr | player, |
bool | enable, | ||
const PLVOsdConfigInfo * | config ) |
设置跑马灯信息
player | 播放对象. |
enable | 是否使用跑马灯. |
config | 跑马灯信息. |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetProgressHandler | ( | PLVPlayerPtr | player, |
OnPlayerProgressHandler | handler, | ||
void * | data ) |
设置播放进度的回调通知.
player | 播放对象. |
handler | 回调函数地址. |
data | 用户自定义上下文数据. |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetPropertyHandler | ( | PLVPlayerPtr | player, |
OnPlayerPropertyHandler | handler, | ||
void * | data ) |
设置播放属性值的回调通知.
player | 播放对象. |
handler | 回调函数地址. |
data | 用户自定义上下文数据. |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetRateChangeHandler | ( | PLVPlayerPtr | player, |
OnPlayerRateChangeHandler | handler, | ||
void * | data ) |
设置清晰度变化的回调通知. 只有输入清度为 VIDEO_RATE_AUTO 才会触发此回调.
player | 播放对象. |
handler | 回调函数地址. |
data | 用户自定义上下文数据. |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetSeek | ( | PLVPlayerPtr | player, |
int | millisecond ) |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetSpeed | ( | PLVPlayerPtr | player, |
double | speed ) |
倍速播放, 通过作为参数给定的系数来减慢或加快播放速度.
player | 播放对象. |
speed | <0.01 - 100> 倍速范转, 1.0 正常播放. |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetStateHandler | ( | PLVPlayerPtr | player, |
OnPlayerStateHandler | handler, | ||
void * | data ) |
设置播放状态的回调通知.
player | 播放对象. |
handler | 回调函数地址. |
data | 用户自定义上下文数据. |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetVideoFrameHandler | ( | PLVPlayerPtr | player, |
OnPlayerVideoFrameHandler | lockHandler, | ||
OnPlayerVideoFrameHandler | unlockHandler, | ||
void * | data ) |
设置播放视频帧的回调通知.
player | 播放对象. |
lockHandler | 锁定缓存回调函数地址. |
unlockHandler | 解锁缓存回调函数地址. |
data | 用户自定义上下文数据. |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetVolume | ( | PLVPlayerPtr | player, |
int | volume ) |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetVolumeMax | ( | PLVPlayerPtr | player, |
int | volume ) |
设置声音增益.
player | 播放对象. |
volume | <100-1000> 增益范转, 超过 1000 返回失败. |
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerStop | ( | PLVPlayerPtr | player | ) |