plv player sdk doc
Loading...
Searching...
No Matches
Typedefs | Functions
Live Player Api

Typedefs

typedef void * PLVLivePlayerPtr
 live player object type.
 
typedef bool(* OnLivePlayerVideoFrameHandler) (PLVVideoFrame *frame, void *data)
 player video frame.
 
typedef void(* OnLivePlayerStateHandler) (int state, void *data)
 player media state.
 
typedef void(* OnLivePlayerPropertyHandler) (int property, int format, const char *value, void *data)
 player media property value.
 
typedef void(* OnLivePlayerAudioPlayErrorHandler) (void *data)
 the player play audio error.
 
typedef void(* OnLivePlayerChannelStateHandler) (int state, void *data)
 channel live state.
 
typedef void(* OnLivePlayerChannelInfoHandler) (const PLVChannelInfo *info, void *data)
 channel info.
 

Functions

PLAYERSDK_API PLVLivePlayerPtr PLAYERSDK_CALL PLVLivePlayerCreate (void *window)
 Creates the PLVLivePlayerPtr object and returns the pointer.
 
PLAYERSDK_API void PLAYERSDK_CALL PLVLivePlayerDestroy (PLVLivePlayerPtr player)
 Destory the PLVLivePlayerPtr object.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetVideoFrameHandler (PLVLivePlayerPtr player, OnLivePlayerVideoFrameHandler lockHandler, OnLivePlayerVideoFrameHandler unlockHandler, void *data)
 for video frame callback.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetStateHandler (PLVLivePlayerPtr player, OnLivePlayerStateHandler handler, void *data)
 for state change callback.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetPropertyHandler (PLVLivePlayerPtr player, OnLivePlayerPropertyHandler handler, void *data)
 for property change callback.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetAudioPlayErrorHandler (PLVLivePlayerPtr player, OnLivePlayerAudioPlayErrorHandler handler, void *data)
 for audio play error callback.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetChannelStateHandler (PLVLivePlayerPtr player, OnLivePlayerChannelStateHandler handler, void *data)
 for channel state change callback.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetChannelInfoHandler (PLVLivePlayerPtr player, OnLivePlayerChannelInfoHandler handler, void *data)
 for channel info callback.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetOSDConfig (PLVLivePlayerPtr player, bool enable, const PLVOsdConfigInfo *config)
 set the video OSD config info
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerGetOSDConfig (PLVLivePlayerPtr player, PLVOsdConfigInfo *config)
 get the video OSD config info.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetLogoText (PLVLivePlayerPtr player, bool enable, const PLVLogoTextInfo *config)
 set the video Logo text info
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerGetLogoText (PLVLivePlayerPtr player, PLVLogoTextInfo *config)
 get the video Logo text info.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetCacheConfig (PLVLivePlayerPtr player, int cacheMs, bool speedTrackingEnable, bool seekTrackingEnable)
 set player cache config.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerGetCacheConfig (PLVLivePlayerPtr player, int *cacheMs, bool *speedTrackingEnable, bool *seekTrackingEnable)
 get player cache config.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetLine (PLVLivePlayerPtr player, int lineIndex)
 set live play line, you can get line info after channel info callback.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetQuality (PLVLivePlayerPtr player, int qualityIndex)
 set live play quality, you can get quality info after channel info callback.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetPlayMode (PLVLivePlayerPtr player, int playMode)
 set live play mode, you can get mode info after channel info callback.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetToken (PLVLivePlayerPtr player, const char *token)
 reserved
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerPlay (PLVLivePlayerPtr player, const char *channelId)
 play the channel living.Always asynchronously.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerPause (PLVLivePlayerPtr player, bool pause)
 pause or resume the video.
 
PLAYERSDK_API bool PLAYERSDK_CALL PLVLivePlayerIsPause (PLVLivePlayerPtr player)
 the video play state or pause.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerStop (PLVLivePlayerPtr player)
 stop the play.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerMute (PLVLivePlayerPtr player, bool mute)
 set the video mute state.
 
PLAYERSDK_API bool PLAYERSDK_CALL PLVLivePlayerIsMute (PLVLivePlayerPtr player)
 the video mute state.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetVolume (PLVLivePlayerPtr player, int volume)
 set the video volume.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetVolumeMax (PLVLivePlayerPtr player, int volume)
 set the video volume gain.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerGetVolume (PLVLivePlayerPtr player)
 the video volume.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerScreenshot (PLVLivePlayerPtr player, const char *filename)
 screenshot the play video picture.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerGetCurrentAudioDevice (PLVLivePlayerPtr player, char deviceId[PLV_MAX_DEVICE_ID_LENGTH])
 the current audio device id.
 
PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetCurrentAudioDevice (PLVLivePlayerPtr player, const char deviceId[PLV_MAX_DEVICE_ID_LENGTH])
 set the current audio device.
 

Detailed Description

Typedef Documentation

◆ OnLivePlayerAudioPlayErrorHandler

typedef void(* OnLivePlayerAudioPlayErrorHandler) (void *data)

the player play audio error.

Parameters
[out]datauser context data.

Definition at line 37 of file plv-player-live.h.

◆ OnLivePlayerChannelInfoHandler

typedef void(* OnLivePlayerChannelInfoHandler) (const PLVChannelInfo *info, void *data)

channel info.

Parameters
[out]infothe channel info.
See also
PLVChannelInfo.
Parameters
[out]datauser context data.
Note
: This callback may be called multiple times

Definition at line 52 of file plv-player-live.h.

◆ OnLivePlayerChannelStateHandler

typedef void(* OnLivePlayerChannelStateHandler) (int state, void *data)

channel live state.

Parameters
[out]statethe channel state.
See also
LIVE_PLAYER_CHANNEL_STATE.
Parameters
[out]datauser context data.

Definition at line 44 of file plv-player-live.h.

◆ OnLivePlayerPropertyHandler

typedef void(* OnLivePlayerPropertyHandler) (int property, int format, const char *value, void *data)

player media property value.

Parameters
[out]propertythe property type.
See also
PLAYER_MEDIA_PROPERTY.
Parameters
[out]formatthe value type.
See also
PLAYER_MEDIA_FORMAT.
Parameters
[out]valueproperty value.
[out]datauser context data.

Definition at line 31 of file plv-player-live.h.

◆ OnLivePlayerStateHandler

typedef void(* OnLivePlayerStateHandler) (int state, void *data)

player media state.

Parameters
[out]statethe player state.
See also
PLAYER_MEDIA_STATE.
Parameters
[out]datauser context data.

Definition at line 22 of file plv-player-live.h.

◆ OnLivePlayerVideoFrameHandler

typedef bool(* OnLivePlayerVideoFrameHandler) (PLVVideoFrame *frame, void *data)

player video frame.

Parameters
[out]framevideo frame.
[out]datauser context data.

Definition at line 15 of file plv-player-live.h.

◆ PLVLivePlayerPtr

typedef void* PLVLivePlayerPtr

live player object type.

Definition at line 8 of file plv-player-live.h.

Function Documentation

◆ PLVLivePlayerCreate()

PLAYERSDK_API PLVLivePlayerPtr PLAYERSDK_CALL PLVLivePlayerCreate ( void * window)

Creates the PLVLivePlayerPtr object and returns the pointer.

Parameters
windowfor the window handler.
Returns
  • Pointer: to the PLVLivePlayerPtr object.
Note
If the window handler is NULL, will use custom rendering mode.

◆ PLVLivePlayerDestroy()

PLAYERSDK_API void PLAYERSDK_CALL PLVLivePlayerDestroy ( PLVLivePlayerPtr player)

Destory the PLVLivePlayerPtr object.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.

◆ PLVLivePlayerGetCacheConfig()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerGetCacheConfig ( PLVLivePlayerPtr player,
int * cacheMs,
bool * speedTrackingEnable,
bool * seekTrackingEnable )

get player cache config.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
cacheMs[out]the cache duration(ms) of the player
speedTrackingEnable[out]Whether frame tracking through control play speed
seekTrackingEnable[out]Whether seek forword when cache buffer too large
Returns
  • 0: Success.
  • > 0: Failure.

◆ PLVLivePlayerGetCurrentAudioDevice()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerGetCurrentAudioDevice ( PLVLivePlayerPtr player,
char deviceId[PLV_MAX_DEVICE_ID_LENGTH] )

the current audio device id.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
[out]deviceIdaudio device id.
Returns
  • 0: Success.
  • > 0: Failure.

◆ PLVLivePlayerGetLogoText()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerGetLogoText ( PLVLivePlayerPtr player,
PLVLogoTextInfo * config )

get the video Logo text info.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
[out]configLogo info.
See also
PLVLogoTextInfo.
Returns
  • 0: Success.
  • > 0: Failure.

◆ PLVLivePlayerGetOSDConfig()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerGetOSDConfig ( PLVLivePlayerPtr player,
PLVOsdConfigInfo * config )

get the video OSD config info.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
[out]configOSD info.
See also
PLVOsdConfigInfo.
Returns
  • 0: Success.
  • > 0: Failure.

◆ PLVLivePlayerGetVolume()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerGetVolume ( PLVLivePlayerPtr player)

the video volume.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Returns
  • 0: error.
  • >0: the video current volume.

◆ PLVLivePlayerIsMute()

PLAYERSDK_API bool PLAYERSDK_CALL PLVLivePlayerIsMute ( PLVLivePlayerPtr player)

the video mute state.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Returns
  • true: mute state.
  • false: unmute state.

◆ PLVLivePlayerIsPause()

PLAYERSDK_API bool PLAYERSDK_CALL PLVLivePlayerIsPause ( PLVLivePlayerPtr player)

the video play state or pause.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Returns
  • true: the video is pause state.
  • false: unpause or is idle state.

◆ PLVLivePlayerMute()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerMute ( PLVLivePlayerPtr player,
bool mute )

set the video mute state.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
muteplay state.
Returns
  • 0: Success.
  • > 0: Failure.

◆ PLVLivePlayerPause()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerPause ( PLVLivePlayerPtr player,
bool pause )

pause or resume the video.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
pauseplay state.
Returns
  • 0: Success.
  • > 0: Failure.
Note
: Resume play will reload stream.

◆ PLVLivePlayerPlay()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerPlay ( PLVLivePlayerPtr player,
const char * channelId )

play the channel living.Always asynchronously.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
channelIdchannel Id.
Returns
  • 0: Success.
  • > 0: Failure.
Note
1.If the player has already started, it needs to be stopped first
2.The pause,line,and quality settings will be reset after play
3.If the channel live has not started, the player will poll and wait play untill the following two situations:
¢Ù.User manually stops
¢Ú.Fatal error occurred, such as incorrect channel information, the player will callback failed.
See also
MEDIA_STATE_FAIL

◆ PLVLivePlayerScreenshot()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerScreenshot ( PLVLivePlayerPtr player,
const char * filename )

screenshot the play video picture.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
filenamepng/jpg file, use UTF8.
Returns
  • 0: Success.
  • > 0: Failure.
Attention
path must use UTF8

◆ PLVLivePlayerSetAudioPlayErrorHandler()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetAudioPlayErrorHandler ( PLVLivePlayerPtr player,
OnLivePlayerAudioPlayErrorHandler handler,
void * data )

for audio play error callback.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
handlercallback function.
datauser context data.
Returns
  • 0: Success.
  • > 0: Failure.

◆ PLVLivePlayerSetCacheConfig()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetCacheConfig ( PLVLivePlayerPtr player,
int cacheMs,
bool speedTrackingEnable,
bool seekTrackingEnable )

set player cache config.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
cacheMsthe cache duration(ms) of the player, Default 2000ms.
speedTrackingEnableWhether frame tracking through control play speed, Default true
seekTrackingEnableWhether seek forword when cache buffer too large, Default true
Returns
  • 0: Success.
  • > 0: Failure.
Note
Don't set cacheMs too small to prevent video lag, suggest between 1000-5000.
This setting only applies to http-flv real-time streams.

◆ PLVLivePlayerSetChannelInfoHandler()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetChannelInfoHandler ( PLVLivePlayerPtr player,
OnLivePlayerChannelInfoHandler handler,
void * data )

for channel info callback.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
handlercallback function.
datauser context data.
Returns
  • 0: Success.
  • > 0: Failure.

◆ PLVLivePlayerSetChannelStateHandler()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetChannelStateHandler ( PLVLivePlayerPtr player,
OnLivePlayerChannelStateHandler handler,
void * data )

for channel state change callback.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
handlercallback function.
datauser context data.
Returns
  • 0: Success.
  • > 0: Failure.

◆ PLVLivePlayerSetCurrentAudioDevice()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetCurrentAudioDevice ( PLVLivePlayerPtr player,
const char deviceId[PLV_MAX_DEVICE_ID_LENGTH] )

set the current audio device.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
deviceIdaudio device id.
Returns
  • 0: Success.
  • > 0: Failure.

◆ PLVLivePlayerSetLine()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetLine ( PLVLivePlayerPtr player,
int lineIndex )

set live play line, you can get line info after channel info callback.

See also
OnLivePlayerChannelInfoHandler
Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
lineIndexline index, Default 0.
Returns
  • 0: Success.
  • > 0: Failure.
Note
If the index out of range, the nearest line index will be used.
PLVLivePlayerPlay will reset this setting.
After set lines, the default quality index will be selected.

◆ PLVLivePlayerSetLogoText()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetLogoText ( PLVLivePlayerPtr player,
bool enable,
const PLVLogoTextInfo * config )

set the video Logo text info

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
enableuse or not logo text.
configLogo info.
See also
PLVLogoTextInfo.
Returns
  • 0: Success.
  • > 0: Failure.

◆ PLVLivePlayerSetOSDConfig()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetOSDConfig ( PLVLivePlayerPtr player,
bool enable,
const PLVOsdConfigInfo * config )

set the video OSD config info

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
enableuse or not OSD.
configOSD info.
See also
PLVOsdConfigInfo.
Returns
  • 0: Success.
  • > 0: Failure.

◆ PLVLivePlayerSetPlayMode()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetPlayMode ( PLVLivePlayerPtr player,
int playMode )

set live play mode, you can get mode info after channel info callback.

See also
OnLivePlayerChannelInfoHandler
Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
playModeplay mode.
See also
LIVE_PLAYER_PLAY_MODE
Returns
  • 0: Success.
  • > 0: Failure.
Note
If isOnlyAudio has been set in PLVChannelInfo, the player will only play audio.
PLVLivePlayerPlay will reset this setting.

◆ PLVLivePlayerSetPropertyHandler()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetPropertyHandler ( PLVLivePlayerPtr player,
OnLivePlayerPropertyHandler handler,
void * data )

for property change callback.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
handlercallback function.
datauser context data.
Returns
  • 0: Success.
  • > 0: Failure.

◆ PLVLivePlayerSetQuality()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetQuality ( PLVLivePlayerPtr player,
int qualityIndex )

set live play quality, you can get quality info after channel info callback.

See also
OnLivePlayerChannelInfoHandler
Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
qualityIndexquality index, Default 0.
Returns
  • 0: Success.
  • > 0: Failure.
Note
If the index out of range, the nearest quality index will be used.
PLVLivePlayerPlay will reset this setting.

◆ PLVLivePlayerSetStateHandler()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetStateHandler ( PLVLivePlayerPtr player,
OnLivePlayerStateHandler handler,
void * data )

for state change callback.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
handlercallback function.
datauser context data.
Returns
  • 0: Success.
  • > 0: Failure.

◆ PLVLivePlayerSetToken()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetToken ( PLVLivePlayerPtr player,
const char * token )

reserved

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
tokenplay token
Returns
  • 0: Success.
  • > 0: Failure.

◆ PLVLivePlayerSetVideoFrameHandler()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetVideoFrameHandler ( PLVLivePlayerPtr player,
OnLivePlayerVideoFrameHandler lockHandler,
OnLivePlayerVideoFrameHandler unlockHandler,
void * data )

for video frame callback.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
lockHandlercallback function for lock buffer.
unlockHandlercallback function for unlock buffer.
datauser context data.
Returns
  • 0: Success.
  • > 0: Failure.

◆ PLVLivePlayerSetVolume()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetVolume ( PLVLivePlayerPtr player,
int volume )

set the video volume.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
volume<0-100> if 0 will mute.
Returns
  • 0: Success.
  • > 0: Failure.

◆ PLVLivePlayerSetVolumeMax()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerSetVolumeMax ( PLVLivePlayerPtr player,
int volume )

set the video volume gain.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Parameters
volume<100-1000> if big 1000 will return failure.
Returns
  • 0: Success.
  • > 0: Failure.

◆ PLVLivePlayerStop()

PLAYERSDK_API int PLAYERSDK_CALL PLVLivePlayerStop ( PLVLivePlayerPtr player)

stop the play.

Parameters
playerthe player object, for PLVLivePlayerCreate return.
See also
PLVLivePlayerCreate.
Returns
  • 0: Success.
  • > 0: Failure.