Class NetworkConfiguration
-
- All Implemented Interfaces:
public final class NetworkConfigurationConfiguration for the player's network stack and retry mechanisms.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classNetworkConfiguration.BuilderThe builder for the network and retry configuration.
-
Field Summary
Fields Modifier and Type Field Description private final IntegermaxRetriesprivate final LongminimumBackOffprivate final LongmaximumBackOffprivate final BooleanuseHttpEngine
-
Method Summary
Modifier and Type Method Description final IntegergetMaxRetries()The maximum amount of retries before the player throws a fatal error. final LonggetMinimumBackOff()Sets the initial delay in milliseconds before a retry request occurs. final LonggetMaximumBackOff()Sets the maximum amount of delay in milliseconds between retry requests. final BooleangetUseHttpEngine()Whether the player should use android.net.http.HttpEngine or Cronet for its network stack, if available. final NetworkConfiguration.BuilderbuildUpon()Creates a builder initialized with the values as this NetworkConfiguration. -
-
Method Detail
-
getMaxRetries
final Integer getMaxRetries()
The maximum amount of retries before the player throws a fatal error.
Default:
Integer.MAX_VALUE.
-
getMinimumBackOff
final Long getMinimumBackOff()
Sets the initial delay in milliseconds before a retry request occurs. Exponential backoff will be applied on this value.
Default:
200.
-
getMaximumBackOff
final Long getMaximumBackOff()
Sets the maximum amount of delay in milliseconds between retry requests.
Default:
30000.
-
getUseHttpEngine
final Boolean getUseHttpEngine()
Whether the player should use android.net.http.HttpEngine or Cronet for its network stack, if available.
By default, the player uses java.net.HttpURLConnection for all its network requests. However, on most Android devices, this implementation only supports HTTP/1.1, which is suboptimal for media streaming. This option allows the player to select a more modern network stack that supports HTTP/2 and/or HTTP/3, which can be more efficient.
When set to
true, the player will attempt to use either android.net.http.HttpEngine (on Android 14 and higher) or Cronet (when added as a library to your app) for its network requests.When set to
false, the player will always use java.net.HttpURLConnection.When set to
null, the player will use its default value. The default value is currentlyfalse, so an opt-in is needed to use the new network stack. In a future major version, this default value will change totrue, so an opt-out will be needed to use the old network stack.
Note: Some APIs such as com.theoplayer.android.api.settings.SslSettings.setKeyStore are not supported when using the modern network stack.
Default:
null(equivalent tofalse)- Since:
v9.10.0
-
buildUpon
final NetworkConfiguration.Builder buildUpon()
Creates a builder initialized with the values as this NetworkConfiguration.
- Since:
v9.10.0
-
-
-
-