本文档提供了使用 C++SDK 的操作步骤及代码示例,通过本文您可以快速了解如何使用 SDK 提供的功能。您也可以通过 Demo 中的示例进行了解和自有业务开发。
class Record{
public:
Record(void){
}, userdata);
}, userdata);
}
int SetPreventRecord(void* window, bool enable){
}
};
PLAYERSDK_API int PLAYERSDK_CALL PLVSetPluginInjectHandler(bool enable, OnPluginInjectHandler handler, void *data)
设置恶意软件录制的回调通知, 如果有恶意软件录制播放窗口, 会触发回调通知.
PLAYERSDK_API int PLAYERSDK_CALL PLVGetPreventRecord(void *window, bool *enable)
获取播放窗口是否开启软件防录制.
PLAYERSDK_API int PLAYERSDK_CALL PLVSetHDMIDeviceChangedHandler(bool enable, OnHDMIDeviceChangedHandler handler, void *data)
设置 HDMI 设备插拔变动的回调通知.
class Download{
private:
public:
Download(void){
}, userdata);
}, userdata);
}, userdata);
}
~Download(void){
downolader = nullptr;
}
int SetVideo(const char* vid, const char* path, int rate){
}
int Start(bool autoDownRate){
}
int Stop(void){
}
int Pause(void){
}
int Delete(void){
}
};
PLAYERSDK_API PLVDownloadPtr PLAYERSDK_CALL PLVDownloadCreate()
创建下载对象并返回对象指针. 在使用下载接口对象前, 必须先调用此接口创建对象.
PLAYERSDK_API int PLAYERSDK_CALL PLVDownloadDelete(PLVDownloadPtr download)
删除视频文件. 如果视频正在下载中时, 会中断下载, 并删除所有临时文件.
void * PLVDownloadPtr
下载对象, 每一个下载任务对应一个下载对象, 可以创建多个下载对象.
PLAYERSDK_API int PLAYERSDK_CALL PLVDownloadSetErrorHandler(PLVDownloadPtr download, OnDownloadErrorHandler handler, void *data)
设置下载错误的回调通知.
PLAYERSDK_API int PLAYERSDK_CALL PLVDownloadPause(PLVDownloadPtr download)
暂停下载, 此时线程进入休眠, 不会退出, 区别于停止下载. 再开始下载时会更快些.
PLAYERSDK_API int PLAYERSDK_CALL PLVDownloadSetVideo(PLVDownloadPtr download, const char *vid, const char *path, int rate)
设置视频信息. 在调用下载前, 必须先设置视频的相关信息, 否则会报错.
PLAYERSDK_API int PLAYERSDK_CALL PLVDownloadSetResultHandler(PLVDownloadPtr download, OnDownloadResultHandler handler, void *data)
设置下载结果的回调通知.
PLAYERSDK_API int PLAYERSDK_CALL PLVDownloadStop(PLVDownloadPtr download)
停止下载, 此时线程会回收退出, 区别于暂停下载. 再开始下载时会慢些.
PLAYERSDK_API int PLAYERSDK_CALL PLVDownloadStart(PLVDownloadPtr download, bool autoDownRate)
开始下载.
PLAYERSDK_API void PLAYERSDK_CALL PLVDownloadDestroy(PLVDownloadPtr download)
销毁下载对象. 不再使用创建的对象后, 必须调用此接口回收.
PLAYERSDK_API int PLAYERSDK_CALL PLVDownloadSetProgressHandler(PLVDownloadPtr download, OnDownloadProgressHandler handler, void *data)
设置下载进度的回调通知.
class Player{
private:
PLVPlayer mediaPlayer = nullptr;
public:
Player((void*)window){
}, userdata);
}, userdata);
}, userdata);
}, userdata);
}, userdata);
}
~Player(void){
mediaPlayer = nullptr;
}
}
}
int SetCache(bool enable, int maxCacheBytes, int maxCacheSeconds);
int GetCache(int* maxCacheBytes, int* maxCacheSeconds);
int SetVideo(const char* vid, const char* path, int rate);
int Play(const char* token, int seekMillisecond, bool sync);
int PlayLocal(int seekMillisecond);
int LoadLocal(int seekMillisecond);
int Pause(bool pause);
int Stop(void);
int SetMute(bool mute);
int SetSeek(int millisecond, bool exactSeek);
int SeekToEnd(void);
int SetVolume(int volume);
int SetVolumeMax(int volume);
int SetSpeed(double speed);
int Screenshot(const char* filename);
int GetAudioDeviceCount();
int ReloadAudio();
};
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetPropertyHandler(PLVPlayerPtr player, OnPlayerPropertyHandler handler, void *data)
设置播放属性值的回调通知.
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetOSDConfig(PLVPlayerPtr player, bool enable, const OSDConfigInfo *config)
设置跑马灯信息
PLAYERSDK_API PLVPlayerPtr PLAYERSDK_CALL PLVPlayerCreate(void *window)
创建播放对象并返回对象指针. 在使用播放接口对象前, 必须先调用此接口创建对象.
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetProgressHandler(PLVPlayerPtr player, OnPlayerProgressHandler handler, void *data)
设置播放进度的回调通知.
PLAYERSDK_API void PLAYERSDK_CALL PLVPlayerDestroy(PLVPlayerPtr player)
销毁播放对象. 不再使用创建的对象后, 必须调用此接口回收.
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetStateHandler(PLVPlayerPtr player, OnPlayerStateHandler handler, void *data)
设置播放状态的回调通知.
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetAudioDeviceHandler(PLVPlayerPtr player, OnPlayerAudioDeviceHandler handler, void *data)
设置扬声器热插拔的回调通知.
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerSetRateChangeHandler(PLVPlayerPtr player, OnPlayerRateChangeHandler handler, void *data)
设置清晰度变化的回调通知. 只有输入清度为 VIDEO_RATE_AUTO 才会触发此回调.
PLAYERSDK_API int PLAYERSDK_CALL PLVPlayerGetOSDConfig(PLVPlayerPtr player, OSDConfigInfo &config)
获取跑马灯信息.
const int PLV_MAX_DEVICE_ID_LENGTH