cronetEngine
Specify a Cronet engine to support HTTP/2 (and HTTP/3 over QUIC if enabled).
If 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 of the networking performed by your app. This allows resources (such as sockets) to be efficiently pooled and shared 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
CronetEngine
implementation CronetProviderInstaller.PROVIDER_NAME, provided by the Google Player Service is recommended as it is automatically updated.
Alternatively, a full Cronet implementation can be bundled in your app (CronetProvider.PROVIDER_NAME_APP_PACKAGED), but as it is of significant size (~8MB), it is not recommend except if:
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
Lastly, we do not recommend using the Cronet fallback implementation (CronetProvider.PROVIDER_NAME_FALLBACK) (from org.chromium.net:cronet-fallback
) implementation 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.
Limitations: Some requests do not yet use Cronet and always use HttpURLConnection (thus HTTP/1):
OfflineContentManager requests to download content for offline playback
Widevine DRM requests