DKVideoPlayer
DKVideoPlayer copied to clipboard
PreloadTask 内无法添加 header
在 start 方法内,无法定义 header,我应该怎么处理?
//获取HttpProxyCacheServer的代理地址
proxyUrl = mCacheServer!!.getProxyUrl(mRawUrl)
val url = URL(proxyUrl)
connection = url.openConnection() as HttpURLConnection
connection.addRequestProperty("Referer", "test.com")
private static HttpProxyCacheServer newProxy(Context context) {
return new HttpProxyCacheServer.Builder(context)
.maxCacheSize(512 * 1024 * 1024) // 512MB for cache
//缓存路径,不设置默认在sd_card/Android/data/[app_package_name]/cache中
// .cacheDirectory()
// 加请求头
.headerInjector()
.build();
}