DKVideoPlayer icon indicating copy to clipboard operation
DKVideoPlayer copied to clipboard

PreloadTask 内无法添加 header

Open cipchk opened this issue 3 years ago • 1 comments

start 方法内,无法定义 header,我应该怎么处理?

//获取HttpProxyCacheServer的代理地址
proxyUrl = mCacheServer!!.getProxyUrl(mRawUrl)
val url = URL(proxyUrl)
connection = url.openConnection() as HttpURLConnection
connection.addRequestProperty("Referer", "test.com")

cipchk avatar Aug 17 '22 14:08 cipchk

    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();
    }

Doikki avatar Aug 18 '22 02:08 Doikki