我在我的VideoPlayer中使用OkHttp来缓存视频和预加载视频。但不幸的是,我发现OkHttp不会缓存视频。我已经在OkHttpClient中设置了缓存和NetWorkInterceptor
。谁能帮我吗?
public class VideoCacheInterceptor imlements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException{
Response originResponse = chain.proceed(chain.request());
return originResponse.newBuilder()
.removeHeader("Pragma")
.removeHeader("No-Cache")
.removeHeader("Cache-Control")
.header(Cache-Control", "public, max-age=" + INVPlayer.maxAge)
.build();
}
}