Agora Java API Reference for Android

Public Member Functions | List of all members
io.agora.mediaplayer.IMediaPlayerCacheManager Interface Reference

## Public Member Functions
int | removeAllCaches ()
int | removeOldCache ()
int | removeCacheByUri (String uri)
int | setCacheDir (String path)
int | setMaxCacheFileCount (int count)
int | setMaxCacheFileSize (long cacheSize)
int | enableAutoRemoveCache (boolean enable)
String | getCacheDir ()
int | getMaxCacheFileCount ()
long | getMaxCacheFileSize ()
int | getCacheFileCount ()

## Member Function Documentation

## ◆ removeAllCaches()

int io.agora.mediaplayer.IMediaPlayerCacheManager.removeAllCaches | ( |  | ) |

Remove all media resource cache files.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ removeOldCache()

int io.agora.mediaplayer.IMediaPlayerCacheManager.removeOldCache | ( |  | ) |

Remove the latest media resource cache file.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ removeCacheByUri()

int io.agora.mediaplayer.IMediaPlayerCacheManager.removeCacheByUri | ( | String | uri | ) |

Remove the cache file by uri, setting by MediaSource.

Parameters

  uri | URI，identify the uniqueness of the property, Set from `MeidaSource`

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setCacheDir()

int io.agora.mediaplayer.IMediaPlayerCacheManager.setCacheDir | ( | String | path | ) |

Set cache file path that files will be saved to.

Parameters

  path | file path.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setMaxCacheFileCount()

int io.agora.mediaplayer.IMediaPlayerCacheManager.setMaxCacheFileCount | ( | int | count | ) |

Set the maximum number of cached files.

Parameters

  count | maximum number of cached files.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setMaxCacheFileSize()

int io.agora.mediaplayer.IMediaPlayerCacheManager.setMaxCacheFileSize | ( | long | cacheSize | ) |

Set the total size of the largest cache file.

Parameters

  cacheSize | total size of the largest cache file.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ enableAutoRemoveCache()

int io.agora.mediaplayer.IMediaPlayerCacheManager.enableAutoRemoveCache | ( | boolean | enable | ) |

Set whether the player will clean up the cache in the order of resource usage.

Parameters

  enable | enable the player to automatically clear the cache.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getCacheDir()

String io.agora.mediaplayer.IMediaPlayerCacheManager.getCacheDir | ( |  | ) |

Get the cache directory.

Returns
  - not null: Success.
  - null: Failure.

## ◆ getMaxCacheFileCount()

int io.agora.mediaplayer.IMediaPlayerCacheManager.getMaxCacheFileCount | ( |  | ) |

Get the maximum number of cached files.

Returns

  > 0: file count.

  - < 0: Failure.

## ◆ getMaxCacheFileSize()

long io.agora.mediaplayer.IMediaPlayerCacheManager.getMaxCacheFileSize | ( |  | ) |

Get the total size of the largest cache file

Returns

  > 0: file size.

  - < 0: Failure.

## ◆ getCacheFileCount()

int io.agora.mediaplayer.IMediaPlayerCacheManager.getCacheFileCount | ( |  | ) |

Get the number of all cache files.

Returns

  > 0: file count.

  - < 0: Failure.