You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then in code just change: DataSource.Factory mDataSourceFactory = new DefaultDataSourceFactory(mContext, RemoteGateway.getUserAgent(), bandwidthMeter);
to:
DataSource.Factory mDataSourceFactory = new DefaultDataSourceFactory(
mContext,
bandwidthMeter,
new CronetDataSourceFactory(
new CronetEngineWrapper(mContext),
Executors.newSingleThreadExecutor(),
null,
bandwidthMeter,
RemoteGateway.getUserAgent()));
What happens is that the stream works without any issues when using HttpDataSource but fails with CronetDataSource. After debugging it turns out that CronetDataSource doesn't process Set-Cookie header(s) return by my streaming CDN (Amazon CloudFront) on master playlist response and doesn't pass those cookies on subsequent requests for AES key and/or chunklists.
I search for ExoPlayer documentation and wasn't able to find info how to correctly configure cookie management when Cronet extension is used.
Here is my ExoPlayer info:
D/CronetEngineWrapper: CronetEngine built using App-Packaged-Cronet-Provider
I/ExoPlayerImpl: Init ef5675b [ExoPlayerLib/2.10.1] [generic_x86, sdk_google_atv_x86, unknown, 25]
Cronet doesn't store cookies, as per this issue. I think the best approach here would be to:
Define a simple CookieStore interface in the Cronet extension, and allow an implementation to be injected from app code.
App code would be responsible for injecting an implementation. We'd design CookieStore to trivially map onto OkHttp's CookieJar or the platform CookieHandler, so developers can easily implement CookieStore as a wrapper around one of these APIs. It would probably just define:
Comment 4 on the issue above has a few changed references that show how easy the mapping is, and how the interface would be used from inside CronetDataSource.
We wont be treating this as high priority, but would accept a pull request if you're able to help ;).
Activity
ojw28 commentedon May 30, 2019
Cronet doesn't store cookies, as per this issue. I think the best approach here would be to:
CookieStoreinterface in the Cronet extension, and allow an implementation to be injected from app code.CookieStoreto trivially map ontoOkHttp'sCookieJaror the platformCookieHandler, so developers can easily implementCookieStoreas a wrapper around one of these APIs. It would probably just define:Comment 4 on the issue above has a few changed references that show how easy the mapping is, and how the interface would be used from inside
CronetDataSource.We wont be treating this as high priority, but would accept a pull request if you're able to help ;).
[-]Cronet extension doesn't set cookies[/-][+]Cronet extension: Support cookie storage[/+]drayan85 commentedon May 5, 2021
I have used this additional method to add the Cookie Header every time for the existing
httpDataSourceFactorymanually and works for me.private static HttpDataSource.@MonotonicNonNull Factory httpDataSourceFactory;Add full cookie handling to CronetDataSource
Feat/migrate media3 1.8 (#43)