Cronet

data class Cronet(val cronetEngine: CronetEngine) : NetworkEngine

Specify a Cronet engine to support HTTP/2 (and HTTP/3 over QUIC if enabled).

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.

Resources

Constructors

Link copied to clipboard
constructor(cronetEngine: CronetEngine)

Properties

Link copied to clipboard
val cronetEngine: CronetEngine