docs/doc/reference/com/google/android/exoplayer2/upstream/DefaultBandwidthMeter.html
Package com.google.android.exoplayer2.upstream
All Implemented Interfaces:BandwidthMeter, TransferListener
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classDefaultBandwidthMeterextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[BandwidthMeter](BandwidthMeter.html "interface in com.google.android.exoplayer2.upstream"),[TransferListener](TransferListener.html "interface in com.google.android.exoplayer2.upstream")
Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
Estimates bandwidth by listening to data transfers.
The bandwidth estimate is calculated using a SlidingPercentile and is updated each time a transfer ends. The initial estimate is based on the current operator's network country code or the locale of the user, as well as the network connection type. This can be configured in the DefaultBandwidthMeter.Builder.
Nested Classes | Modifier and Type | Class | Description |
| --- | --- | --- |
| static class | DefaultBandwidthMeter.Builder |
Deprecated.
Builder for a bandwidth meter. |
-
BandwidthMeter.EventListener
Fields | Modifier and Type | Field | Description |
| --- | --- | --- |
| static long | DEFAULT_INITIAL_BITRATE_ESTIMATE |
Deprecated.
Default initial bitrate estimate used when the device is offline or the network type cannot be determined, in bits per second.
|
| static ImmutableList<Long> | DEFAULT_INITIAL_BITRATE_ESTIMATES_2G |
Deprecated.
Default initial 2G bitrate estimates in bits per second.
|
| static ImmutableList<Long> | DEFAULT_INITIAL_BITRATE_ESTIMATES_3G |
Deprecated.
Default initial 3G bitrate estimates in bits per second.
|
| static ImmutableList<Long> | DEFAULT_INITIAL_BITRATE_ESTIMATES_4G |
Deprecated.
Default initial 4G bitrate estimates in bits per second.
|
| static ImmutableList<Long> | DEFAULT_INITIAL_BITRATE_ESTIMATES_5G_NSA |
Deprecated.
Default initial 5G-NSA bitrate estimates in bits per second.
|
| static ImmutableList<Long> | DEFAULT_INITIAL_BITRATE_ESTIMATES_5G_SA |
Deprecated.
Default initial 5G-SA bitrate estimates in bits per second.
|
| static ImmutableList<Long> | DEFAULT_INITIAL_BITRATE_ESTIMATES_WIFI |
Deprecated.
Default initial Wifi bitrate estimate in bits per second.
|
| static int | DEFAULT_SLIDING_WINDOW_MAX_WEIGHT |
Deprecated.
Default maximum weight for the sliding window. |
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| void | addEventListener(Handler eventHandler, BandwidthMeter.EventListener eventListener) |
Deprecated.
Adds an BandwidthMeter.EventListener.
|
| long | getBitrateEstimate() |
Deprecated.
Returns the estimated bitrate.
|
| static DefaultBandwidthMeter | getSingletonInstance(Context context) |
Deprecated.
Returns a singleton instance of a DefaultBandwidthMeter with default configuration.
|
| TransferListener | getTransferListener() |
Deprecated.
Returns the TransferListener that this instance uses to gather bandwidth information from data transfers.
|
| void | onBytesTransferred(DataSource source, DataSpec dataSpec, boolean isNetwork, int bytesTransferred) |
Deprecated.
Called incrementally during a transfer.
|
| void | onTransferEnd(DataSource source, DataSpec dataSpec, boolean isNetwork) |
Deprecated.
Called when a transfer ends.
|
| void | onTransferInitializing(DataSource source, DataSpec dataSpec, boolean isNetwork) |
Deprecated.
Called when a transfer is being initialized.
|
| void | onTransferStart(DataSource source, DataSpec dataSpec, boolean isNetwork) |
Deprecated.
Called when a transfer starts.
|
| void | removeEventListener(BandwidthMeter.EventListener eventListener) |
Deprecated.
Removes an BandwidthMeter.EventListener.
|
| void | setNetworkTypeOverride(@com.google.android.exoplayer2.C.NetworkType int networkType) |
Deprecated.
Overrides the network type. |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
getTimeToFirstByteEstimateUs
-
public static final[ImmutableList](https://guava.dev/releases/31.1-android/api/docs/com/google/common/collect/ImmutableList.html?is-external=true "class or interface in com.google.common.collect")<[Long](https://developer.android.com/reference/java/lang/Long.html "class or interface in java.lang")> DEFAULT_INITIAL_BITRATE_ESTIMATES_WIFI
Deprecated.
Default initial Wifi bitrate estimate in bits per second.
-
public static final[ImmutableList](https://guava.dev/releases/31.1-android/api/docs/com/google/common/collect/ImmutableList.html?is-external=true "class or interface in com.google.common.collect")<[Long](https://developer.android.com/reference/java/lang/Long.html "class or interface in java.lang")> DEFAULT_INITIAL_BITRATE_ESTIMATES_2G
Deprecated.
Default initial 2G bitrate estimates in bits per second.
-
public static final[ImmutableList](https://guava.dev/releases/31.1-android/api/docs/com/google/common/collect/ImmutableList.html?is-external=true "class or interface in com.google.common.collect")<[Long](https://developer.android.com/reference/java/lang/Long.html "class or interface in java.lang")> DEFAULT_INITIAL_BITRATE_ESTIMATES_3G
Deprecated.
Default initial 3G bitrate estimates in bits per second.
-
public static final[ImmutableList](https://guava.dev/releases/31.1-android/api/docs/com/google/common/collect/ImmutableList.html?is-external=true "class or interface in com.google.common.collect")<[Long](https://developer.android.com/reference/java/lang/Long.html "class or interface in java.lang")> DEFAULT_INITIAL_BITRATE_ESTIMATES_4G
Deprecated.
Default initial 4G bitrate estimates in bits per second.
-
public static final[ImmutableList](https://guava.dev/releases/31.1-android/api/docs/com/google/common/collect/ImmutableList.html?is-external=true "class or interface in com.google.common.collect")<[Long](https://developer.android.com/reference/java/lang/Long.html "class or interface in java.lang")> DEFAULT_INITIAL_BITRATE_ESTIMATES_5G_NSA
Deprecated.
Default initial 5G-NSA bitrate estimates in bits per second.
-
public static final[ImmutableList](https://guava.dev/releases/31.1-android/api/docs/com/google/common/collect/ImmutableList.html?is-external=true "class or interface in com.google.common.collect")<[Long](https://developer.android.com/reference/java/lang/Long.html "class or interface in java.lang")> DEFAULT_INITIAL_BITRATE_ESTIMATES_5G_SA
Deprecated.
Default initial 5G-SA bitrate estimates in bits per second.
-
public static final long DEFAULT_INITIAL_BITRATE_ESTIMATE
Deprecated.
Default initial bitrate estimate used when the device is offline or the network type cannot be determined, in bits per second. See Also:Constant Field Values
-
public static final int DEFAULT_SLIDING_WINDOW_MAX_WEIGHT
Deprecated.
Default maximum weight for the sliding window. See Also:Constant Field Values
-
public static[DefaultBandwidthMeter](DefaultBandwidthMeter.html "class in com.google.android.exoplayer2.upstream")getSingletonInstance([Context](https://developer.android.com/reference/android/content/Context.html "class or interface in android.content")context)
Deprecated.
Returns a singleton instance of a DefaultBandwidthMeter with default configuration.
Parameters:context - A Context.Returns:The singleton instance.
-
public void setNetworkTypeOverride([@NetworkType](../C.NetworkType.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.C.NetworkType int networkType)
Deprecated.
Overrides the network type. Handled in the same way as if the meter had detected a change from the current network type to the specified network type internally.
Applications should not normally call this method. It is intended for testing purposes.
Parameters:networkType - The overriding network type.
-
public long getBitrateEstimate()
Deprecated.
Description copied from interface: BandwidthMeter
Returns the estimated bitrate.
Specified by:getBitrateEstimate in interface BandwidthMeter
-
public[TransferListener](TransferListener.html "interface in com.google.android.exoplayer2.upstream")getTransferListener()
Deprecated.
Description copied from interface: BandwidthMeter
Returns the TransferListener that this instance uses to gather bandwidth information from data transfers. May be null if the implementation does not listen to data transfers.
Specified by:getTransferListener in interface BandwidthMeter
-
public void addEventListener([Handler](https://developer.android.com/reference/android/os/Handler.html "class or interface in android.os")eventHandler,[BandwidthMeter.EventListener](BandwidthMeter.EventListener.html "interface in com.google.android.exoplayer2.upstream")eventListener)
Deprecated.
Description copied from interface: BandwidthMeter
Adds an BandwidthMeter.EventListener.
Specified by:addEventListener in interface BandwidthMeterParameters:eventHandler - A handler for events.eventListener - A listener of events.
-
public void removeEventListener([BandwidthMeter.EventListener](BandwidthMeter.EventListener.html "interface in com.google.android.exoplayer2.upstream")eventListener)
Deprecated.
Description copied from interface: BandwidthMeter
Removes an BandwidthMeter.EventListener.
Specified by:removeEventListener in interface BandwidthMeterParameters:eventListener - The listener to be removed.
-
public void onTransferInitializing([DataSource](DataSource.html "interface in com.google.android.exoplayer2.upstream")source,[DataSpec](DataSpec.html "class in com.google.android.exoplayer2.upstream")dataSpec,
boolean isNetwork)
Deprecated.
Description copied from interface: TransferListener
Called when a transfer is being initialized.
Specified by:onTransferInitializing in interface TransferListenerParameters:source - The source performing the transfer.dataSpec - Describes the data for which the transfer is initialized.isNetwork - Whether the data is transferred through a network.
-
public void onTransferStart([DataSource](DataSource.html "interface in com.google.android.exoplayer2.upstream")source,[DataSpec](DataSpec.html "class in com.google.android.exoplayer2.upstream")dataSpec,
boolean isNetwork)
Deprecated.
Description copied from interface: TransferListener
Called when a transfer starts.
Specified by:onTransferStart in interface TransferListenerParameters:source - The source performing the transfer.dataSpec - Describes the data being transferred.isNetwork - Whether the data is transferred through a network.
-
public void onBytesTransferred([DataSource](DataSource.html "interface in com.google.android.exoplayer2.upstream")source,[DataSpec](DataSpec.html "class in com.google.android.exoplayer2.upstream")dataSpec,
boolean isNetwork,
int bytesTransferred)
Deprecated.
Description copied from interface: TransferListener
Called incrementally during a transfer.
Specified by:onBytesTransferred in interface TransferListenerParameters:source - The source performing the transfer.dataSpec - Describes the data being transferred.isNetwork - Whether the data is transferred through a network.bytesTransferred - The number of bytes transferred since the previous call to this method.
-
public void onTransferEnd([DataSource](DataSource.html "interface in com.google.android.exoplayer2.upstream")source,[DataSpec](DataSpec.html "class in com.google.android.exoplayer2.upstream")dataSpec,
boolean isNetwork)
Deprecated.
Description copied from interface: TransferListener
Called when a transfer ends.
Specified by:onTransferEnd in interface TransferListenerParameters:source - The source performing the transfer.dataSpec - Describes the data being transferred.isNetwork - Whether the data is transferred through a network.