cronetEngine
Specify a Cronet engine to support HTTP/2 (and HTTP/3 over QUIC if enabled).
If null
or cronetEngine.get()
returns null
, HttpURLConnection is used, which only supports HTTP/1.
The default value is null
.
It is recommended to use a single network engine for all networking performed by your app. This enables efficient resource pooling (e.g., sockets) between the Player and other app components. This means that the same CronetEngine
should be used for all Player instances and throughout the app.
CronetEngine implementations
We recommend the CronetEngine
implementation provided by the Google Play services as it is automatically updated and has a small bundled size. To use it, add a dependency to com.google.android.gms:play-services-cronet
.
Alternatively, a full Cronet implementation can be bundled in your app using org.chromium.net:cronet-embedded
. Due to its significant size (~8MB), we do not recommend it unless:
A significant part of your users are in markets where Google Play services is not widely available (mainly China).
An exact Cronet version is required.
We recommends against using the Cronet fallback implementation (org.chromium.net:cronet-fallback
) as it wraps HttpURLConnection and is less performant. Instead, set cronetEngine
to null
to let the Player use HttpURLConnection directly.
Limitations
Player requests will use a custom user-agent and ignore the user-agent of the CronetEngine.
OfflineContentManager requests do not yet use Cronet and always use HttpURLConnection (thus HTTP/1).