2020-11-30 17:00:06 +00:00
diff --git a/node_modules/expo-av/android/src/main/java/expo/modules/av/player/datasource/SharedCookiesDataSourceFactory.java b/node_modules/expo-av/android/src/main/java/expo/modules/av/player/datasource/SharedCookiesDataSourceFactory.java
2023-05-18 21:09:33 +00:00
index 19818bc..7a7053b 100644
2020-11-30 17:00:06 +00:00
--- a/node_modules/expo-av/android/src/main/java/expo/modules/av/player/datasource/SharedCookiesDataSourceFactory.java
+++ b/node_modules/expo-av/android/src/main/java/expo/modules/av/player/datasource/SharedCookiesDataSourceFactory.java
2023-05-18 21:09:33 +00:00
@@ -16,13 +16,26 @@ import okhttp3.OkHttpClient;
2020-11-30 17:00:06 +00:00
public class SharedCookiesDataSourceFactory implements DataSource.Factory {
private final DataSource.Factory mDataSourceFactory;
+ public static OkHttpClient client;
+
+ public static void setOkHttpClient(OkHttpClient okHttpClient) {
+ client = okHttpClient;
+ }
+
public SharedCookiesDataSourceFactory(Context reactApplicationContext, ModuleRegistry moduleRegistry, String userAgent, Map<String, Object> requestHeaders, TransferListener transferListener) {
CookieHandler cookieHandler = moduleRegistry.getModule(CookieHandler.class);
- OkHttpClient.Builder builder = new OkHttpClient.Builder();
- if (cookieHandler != null) {
- builder.cookieJar(new JavaNetCookieJar(cookieHandler));
2023-05-18 21:09:33 +00:00
+ // OkHttpClient.Builder builder = new OkHttpClient.Builder();
+ // if (cookieHandler != null) {
+ // builder.cookieJar(new JavaNetCookieJar(cookieHandler));
+ // }
+ // OkHttpClient client = builder.build();
2020-11-30 17:00:06 +00:00
+ if (this.client == null) {
+ OkHttpClient.Builder builder = new OkHttpClient.Builder();
+ if (cookieHandler != null) {
+ builder.cookieJar(new JavaNetCookieJar(cookieHandler));
+ }
+ this.client = builder.build();
}
- OkHttpClient client = builder.build();
mDataSourceFactory = new DefaultDataSourceFactory(reactApplicationContext, transferListener, new CustomHeadersOkHttpDataSourceFactory(client, userAgent, requestHeaders));
}