Package io.agora.mediaplayer
Interface IMediaPlayerCacheManager
public interface IMediaPlayerCacheManager
-
Method Summary
Modifier and TypeMethodDescriptionintenableAutoRemoveCache(boolean enable) intintlongintintremoveCacheByUri(String uri) intintsetCacheDir(String path) intsetMaxCacheFileCount(int count) intsetMaxCacheFileSize(long cacheSize)
-
Method Details
-
removeAllCaches
int removeAllCaches()- Returns:
- - 0: Success. - < 0: Failure. See `MediaPlayerReason`.
-
removeOldCache
int removeOldCache()- Returns:
- - 0: Success. - < 0: Failure. See `MediaPlayerReason`.
-
removeCacheByUri
- Parameters:
uri- The URI (Uniform Resource Identifier) of the media file to be deleted.- Returns:
- - 0: Success. - < 0: Failure. See `MediaPlayerReason`.
-
setCacheDir
- Parameters:
path- The absolute path of the media files to be cached. Ensure that the directory for the media files exists and is writable.- Returns:
- - 0: Success. - < 0: Failure. See `MediaPlayerReason`.
-
setMaxCacheFileCount
int setMaxCacheFileCount(int count) - Parameters:
count- The maximum number of media files that can be cached. The default value is 1,000.- Returns:
- - 0: Success. - < 0: Failure. See `MediaPlayerReason`.
-
setMaxCacheFileSize
int setMaxCacheFileSize(long cacheSize) - Parameters:
cacheSize- The maximum size (bytes) of the aggregate storage space for cached media files. The default value is 1 GB.- Returns:
- - 0: Success. - < 0: Failure. See `MediaPlayerReason`.
-
enableAutoRemoveCache
int enableAutoRemoveCache(boolean enable) - Parameters:
enable- Whether to enable the SDK to delete cached media files automatically: - `true`: Delete cached media files automatically. - `false`: (Default) Do not delete cached media files automatically.- Returns:
- - 0: Success. - < 0: Failure. See `MediaPlayerReason`.
-
getCacheDir
String getCacheDir()- Returns:
- - The call succeeds, and the SDK returns the storage path of the cached media files. - < 0: Failure. See `MediaPlayerReason`.
-
getMaxCacheFileCount
int getMaxCacheFileCount()- Returns:
- - > 0: The call succeeds and returns the maximum number of media files that can be cached. - < 0: Failure. See `MediaPlayerReason`.
-
getMaxCacheFileSize
long getMaxCacheFileSize()- Returns:
- - > 0: The call succeeds and returns the maximum size (in bytes) of the aggregate storage space for cached media files. - < 0: Failure. See `MediaPlayerReason`.
-
getCacheFileCount
int getCacheFileCount()- Returns:
- - ≥ 0: The call succeeds and returns the number of media files that are cached. - < 0: Failure. See `MediaPlayerReason`.
-