diff --git a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/DataSourceUtil.java b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/DataSourceUtil.java index 4140fa100d..360aaa6932 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/DataSourceUtil.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/DataSourceUtil.java @@ -11,6 +11,7 @@ import com.google.android.exoplayer2.upstream.DataSource; import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory; +import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory; import com.google.android.exoplayer2.upstream.HttpDataSource; import com.google.android.exoplayer2.util.Util; @@ -69,19 +70,15 @@ private static DataSource.Factory buildRawDataSourceFactory(ReactContext context private static DataSource.Factory buildDataSourceFactory(ReactContext context, DefaultBandwidthMeter bandwidthMeter, Map requestHeaders) { return new DefaultDataSourceFactory(context, bandwidthMeter, - buildHttpDataSourceFactory(context, bandwidthMeter, requestHeaders)); + buildHttpDataSourceFactory(context, requestHeaders)); } - private static HttpDataSource.Factory buildHttpDataSourceFactory(ReactContext context, DefaultBandwidthMeter bandwidthMeter, Map requestHeaders) { - OkHttpClient client = OkHttpClientProvider.getOkHttpClient(); - CookieJarContainer container = (CookieJarContainer) client.cookieJar(); - ForwardingCookieHandler handler = new ForwardingCookieHandler(context); - container.setCookieJar(new JavaNetCookieJar(handler)); - OkHttpDataSourceFactory okHttpDataSourceFactory = new OkHttpDataSourceFactory(client, getUserAgent(context), bandwidthMeter); + private static HttpDataSource.Factory buildHttpDataSourceFactory(ReactContext context, Map requestHeaders) { + DefaultHttpDataSourceFactory factory = new DefaultHttpDataSourceFactory(getUserAgent(context)); if (requestHeaders != null) - okHttpDataSourceFactory.getDefaultRequestProperties().set(requestHeaders); + factory.getDefaultRequestProperties().set(requestHeaders); - return okHttpDataSourceFactory; + return factory; } }