提交 1ca7bbd3 编写于 作者: G guoshuyu

add max count & update exo_player2 2.12.1

上级 eb8faebc
......@@ -35,7 +35,7 @@ ext {
gsyVideoVersion = '7.1.6'
exo_player2 = '2.11.3'
exo_player2 = '2.12.1'
permissionsdispatcher = '4.3.0'
......
......@@ -26,6 +26,7 @@ import tv.danmaku.ijk.media.player.IMediaPlayer;
public class ProxyCacheManager implements ICacheManager, CacheListener {
public static int DEFAULT_MAX_SIZE = 512 * 1024 * 1024;
public static int DEFAULT_MAX_COUNT = -1;
//视频代理
protected HttpProxyCacheServer proxy;
......@@ -162,7 +163,11 @@ public class ProxyCacheManager implements ICacheManager, CacheListener {
}
HttpProxyCacheServer.Builder builder = new HttpProxyCacheServer.Builder(context);
builder.cacheDirectory(file);
builder.maxCacheSize(DEFAULT_MAX_SIZE);
if (DEFAULT_MAX_COUNT > 0) {
builder.maxCacheFilesCount(DEFAULT_MAX_COUNT);
} else {
builder.maxCacheSize(DEFAULT_MAX_SIZE);
}
builder.headerInjector(userAgentHeadersInjector);
if (fileNameGenerator != null) {
builder.fileNameGenerator(fileNameGenerator);
......@@ -179,9 +184,16 @@ public class ProxyCacheManager implements ICacheManager, CacheListener {
* 创建缓存代理服务
*/
public HttpProxyCacheServer newProxy(Context context) {
return new HttpProxyCacheServer.Builder(context.getApplicationContext())
.maxCacheSize(DEFAULT_MAX_SIZE)
.headerInjector(userAgentHeadersInjector).build();
HttpProxyCacheServer.Builder builder = new HttpProxyCacheServer
.Builder(context.getApplicationContext())
.headerInjector(userAgentHeadersInjector);
if (DEFAULT_MAX_COUNT > 0) {
builder.maxCacheFilesCount(DEFAULT_MAX_COUNT);
} else {
builder.maxCacheSize(DEFAULT_MAX_SIZE);
}
return builder.build();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册