Skip to content

Commit

Permalink
Fix for seek functionality. - TheWidlarzGroup#1320
Browse files Browse the repository at this point in the history
  • Loading branch information
NickAVolpe committed Feb 3, 2020
1 parent 367031b commit b65461c
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -69,19 +70,15 @@ private static DataSource.Factory buildRawDataSourceFactory(ReactContext context

private static DataSource.Factory buildDataSourceFactory(ReactContext context, DefaultBandwidthMeter bandwidthMeter, Map<String, String> requestHeaders) {
return new DefaultDataSourceFactory(context, bandwidthMeter,
buildHttpDataSourceFactory(context, bandwidthMeter, requestHeaders));
buildHttpDataSourceFactory(context, requestHeaders));
}

private static HttpDataSource.Factory buildHttpDataSourceFactory(ReactContext context, DefaultBandwidthMeter bandwidthMeter, Map<String, String> 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<String, String> requestHeaders) {
DefaultHttpDataSourceFactory factory = new DefaultHttpDataSourceFactory(getUserAgent(context));

if (requestHeaders != null)
okHttpDataSourceFactory.getDefaultRequestProperties().set(requestHeaders);
factory.getDefaultRequestProperties().set(requestHeaders);

return okHttpDataSourceFactory;
return factory;
}
}

2 comments on commit b65461c

@kaseru
Copy link

@kaseru kaseru commented on b65461c Jan 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. You save my life <3

@jwebcat
Copy link

@jwebcat jwebcat commented on b65461c Apr 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much for this 🎉

Please sign in to comment.