Quick Query of the Advanced Player Interface
Last Updated:2021-09-15
Information Related to Advanced Player
BDCloudMediaPlayer class
Interface name | Description |
---|---|
long getCurrentPosition() | Get the current play position, with the unit of millisecond |
String getDataSource() | Get play path |
int getDecodeMode() | Get the decoding mode set beforehand |
long getDownloadSpeed() | Access network download speed |
long getDuration() | Get the duration of audio and video, with the unit of millisecond |
static String getSdkVersion() | Get sdk version, with the form of xx.xx.xx |
BDCloudTrackInfo[] getTrackInfo() | Get the AV track information |
int getVideoHeight() | Get the video height |
int getVideoWidth() | Get the video width |
boolean isLooping() | Loop playback or not |
boolean isPlaying() | Whether it is playing |
boolean isUseApmDetect() | Whether to enable APM monitoring |
void pause() | Pause play |
void prepareAsync() | Asynchronous preparation, the player only supports asynchronous calling preparation. |
void release() | Release the resource |
void reset() | Reset, reset the state to IDLE. After resetting, you have to reset the playback source. |
void seekTo(long msec) | Switch to a certain time point quickly for playback |
static void setAK(String akOfBDCloud) | Set Access Key |
void setBufferSizeInBytes(int size) | Set the byte length of the starting play data during the process of buffering |
void setBufferTimeInMs(int time) | Set start data duration during buffering |
void setTimeoutInUs(int timeout) | Set overtime duration during the process of connection establishment and data download, with the unit of microsecond and the default value of 15 seconds |
void setDataSource(Context context, Uri uri) | Set the play source |
void setDataSource(Context context, Uri uri, Map<String,String> headers) | Set play source, which can set request header information |
void setDataSource(String path) | Set the play source (file-path or http/rtsp URL) |
void setDataSource(String path, Map<String,String> headers) | Set the play source (file-path or http/rtsp URL),The network header information can be set. |
void setDecodeMode(int mode) | Set up soft and hard solution mode, which is set as auto mode by default (automatic detection, and hard solution preferred). |
void setDisplay(SurfaceHolder sh) | Set SurfaceHolder to display videos |
void setInitPlayPosition(long positionInMilliSeconds) | Set the default play position, which should call before prepareAsync |
void setLogEnabled(boolean enable) | Whether to display debug message |
static void setLocalCacheEnabled(boolean isEnable, String cachePath) | Whether to enable locally caching while playing; introduce the cache path if yes |
static void setPcdnEnabled(boolean pcdnEnable, boolean p2pEnable, long networkSoHandle) | Whether Pcdn feature is enable, or whether P2P is enabled, if Pcdn is enabled, it is required to pass in the network database handles |
public void muteOrUnmuteAudio(boolean flag) | Whether to play in mute |
void setLooping(boolean looping) | Set whether to execute loop playback |
void setMaxCacheSizeInBytes(int size) | Set the maximum buffer zone length |
void setScreenOnWhilePlaying(boolean screenOn) | Set screen maintenance when playing, only effective after setting SurfaceHolder. |
void setSurface(android.view.Surface surface) | Set Surface to display videos. It is similar to interface setDisplay (SurfaceHolder) feature but does not support to set the setScreenOnWhilePlaying (boolean) interface. |
void setUseApmDetect(boolean useApmDetect) | Set whether to enable APM monitoring; after enabling, APM SDK should be additionally inserted |
void setVolume(float leftVolume, float rightVolume) | Set the volume of the left and right sound tracks |
void setWakeMode(android.content.Context context, int mode) | Set to keep the wakeup mode |
void start() | Activate play, the play source should be prepared |
void stop() | Stop play |
setAudioDataCallback(OnReceiveAudioDataCallback callback) | Set the audio data callback (used by recording function). |
BDCloudPlayerManager class
Interface name | Description |
---|---|
static boolean libsPreLoad(Context context) | Pre-load the playback-related database, if you use the prefetch feature before the player is instantiated, you need to preload the playback database |
static void prefetch(String url, String ua, String header, int prepareType, int prefetchSize,CyberPlayerManager.HttpDNS httpDns, String businessType) | Video file prefetch |
static void stopPrefetch(String url) | Stop prefetching a video file |
void forceCleanFilecache() | Empty the file cache region forcibly |
IMediaPlayer interface
Interface name | Description |
---|---|
IMediaPlayer.OnBufferingUpdateListener | interface,General buffer progress monitor |
IMediaPlayer.OnCompletionListener | interface,Play completion monitor |
IMediaPlayer.OnErrorListener | interface,Play failure monitor |
IMediaPlayer.OnInfoListener | interface,Message notification listener |
IMediaPlayer.OnPreparedListener | interface,Prepare to finish monitoring |
IMediaPlayer.OnSeekCompleteListener | interface,Seek terminate sound monitor |
IMediaPlayer.OnVideoSizeChangedListener | interface,Video size modification monitor |
IMediaPlayer.OnMetadataListener | interface,Live video metainformation callback |
Static variable name | Description |
---|---|
MEDIA_INFO_AUDIO_RENDERING_START | 10002,Start to play the audio |
MEDIA_INFO_BAD_INTERLEAVING | 800,The audio and video are packaged in a cross manner, which is not standard |
MEDIA_INFO_BUFFERING_END | 702,Stop buffering |
MEDIA_INFO_BUFFERING_START | 701,Start buffering |
MEDIA_INFO_METADATA_UPDATE | 802,Metamessage update |
MEDIA_INFO_NOT_SEEKABLE | 801,You cannot seek |
MEDIA_INFO_UNKNOWN | 1,Unknown notification |
MEDIA_INFO_VIDEO_RENDERING_START | 3,The video starts rendering. |
MEDIA_INFO_VIDEO_ROTATION_CHANGED | 10001,Video direction notification |
MEDIA_INFO_VIDEO_TRACK_LAGGING | 700,Video lagging |
Information Related to the Downloader
VideoDownloadManager class
Method | Description |
---|---|
void changeMaxDownloadingItems(int maxItems) | Change the maximum number of parallel download, which defaults to be 5, and ranges (1, 10)]. |
void deleteDownloader(String url) | Delete download |
HashMap<String,DownloadableVideoItem> getAllDownloadableVideoItems() | Get all the download items(The hashMap is the mirroring list of all the download items) |
DownloadableVideoItem getDownloadableVideoItemByUrl(String url) | Get single download item information |
static VideoDownloadManager getInstance(Context context, String userName) | Get the downloader single instance |
String getUserName() | Get and set the username |
void pauseDownloader(String url) | Stop downloading |
void startOrResumeDownloader(String url, DownloadObserver observer) | Start download or resume download |
void startOrResumeDownloaderWithToken(String url, String token, DownloadObserver observer) | Start download or resume download |
void stopAll() | Stop all the download tasks |
DownloadableVideoItem class
Method | Description |
---|---|
int getErrorCode() | Get the error code; when the status of DownloadStatus is ERROR, get the error code through the interface |
String getFailReason() | Get the error description, getErrorCode interface is recommended to be used |
String getLocalAbsolutePath() | Get the full path name of the local file |
float getProgress() | Get the current download progress |
DownloadableVideoItem.DownloadStatus getStatus() | Get download status |
String getUrl() | Get url |
Error code | Description |
---|---|
ERROR_CODE_NO_ERROR | 0,Error free |
ERROR_CODE_INVALID_URL | 1,Address invalid |
ERROR_CODE_NETWORK_FAILED | 2, Network problems |
ERROR_CODE_SDCARD_UNMOUNTED | 3,Local storage problem |
ERROR_CODE_M3U8_INVALID_FORMAT | 4,m3u8 format problem |
ERROR_CODE_M3U8_SAVE_FAILED | 5,m3u8 storage problem |
ERROR_CODE_M3U8_DRM_INVALID | 6,Invalid key or token related to drm protection |
ERROR_CODE_TS_SAVE_FAILED | 7,Fail to save ts files |
DownloadableVideoItem.DownloadStatus Class
Enumerate members | Description |
---|---|
DownloadStatus.NONE | Initial state, short |
DownloadStatus.PENDING | When it reaches the maximum concurrent download number, the newly added downloads will be pending |
DownloadStatus.DOWNLOADING | Downloading |
DownloadStatus.PAUSED | Download suspend |
DownloadStatus.ERROR | Download error |
DownloadStatus.COMPLETED | Downloaded successfully |
DownloadStatus.DELETED | Delete status. Short: After deletion, the status calls back the update of observer, followed by the deletion of the record. |
Online Video Agent Cache
ProxyCacheManager class
Method | Description |
---|---|
static synchronized ProxyCacheManager getInstance() | Get cache agent manager single instance |
void setCacheDir(File cacheDir) | Set the video cache path; if the path is invalid, the default path is used |
void setProxy(HttpProxyCacheServer proxy) | Set the network proxy service |
void setCacheAvailableListener(CacheListener listener) | Set video progress monitor |
String getProxyUrl(Context context,String url) | Get the agent play link and the player plays based on the link |
void cleanVideoCacheDir(Context context) | Wipe cache partition |
void release() | Unregister registration cache monitoring, and release resources |
Player Recording
RecordController class
Method | Description |
---|---|
void init(SurfaceTexture surfaceTexture, int framerate, int videoBitrate) | Initial recording |
void setRecordListener(IRecordListener listener) | Set the record listener. |
void setRecordSize(int width, int height) | Set the record size. |
void startRecord(String filePath) | Start recording |
void onUpdateAudioData(byte[] bytes, int byteSize) | Update the playing audio data (set after calling BDCloudMediaPlayer#setAudioDataCallback) |
boolean isRecording() | Is it recording |
void stopRecord() | Stop the record |
void onDestroy() | Destruction |