Class ExperimentalBandwidthMeter
- java.lang.Object
-
- com.google.android.exoplayer2.upstream.experimental.ExperimentalBandwidthMeter
-
- All Implemented Interfaces:
BandwidthMeter
,TransferListener
@Deprecated public final class ExperimentalBandwidthMeter extends Object implements BandwidthMeter, TransferListener
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.An experimentalBandwidthMeter
that estimates bandwidth by listening to data transfers.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
ExperimentalBandwidthMeter.Builder
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExperimentalBandwidthMeter.Builder
Deprecated.Builder for a bandwidth meter.-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.upstream.BandwidthMeter
BandwidthMeter.EventListener
-
-
Field Summary
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 float
DEFAULT_TIME_TO_FIRST_BYTE_PERCENTILE
Deprecated.Default percentile for estimating the time to first byte.static int
DEFAULT_TIME_TO_FIRST_BYTE_SAMPLES
Deprecated.Default number of samples to keep in the sliding window for estimating the time to first byte.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addEventListener(Handler eventHandler, BandwidthMeter.EventListener eventListener)
Deprecated.Adds anBandwidthMeter.EventListener
.long
getBitrateEstimate()
Deprecated.Returns the estimated bitrate.long
getTimeToFirstByteEstimateUs()
Deprecated.Returns the estimated time to first byte, in microseconds, orC.TIME_UNSET
if no estimate is available.TransferListener
getTransferListener()
Deprecated.Returns theTransferListener
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 anBandwidthMeter.EventListener
.void
setNetworkTypeOverride(@com.google.android.exoplayer2.C.NetworkType int networkType)
Deprecated.Overrides the network type.
-
-
-
Field Detail
-
DEFAULT_INITIAL_BITRATE_ESTIMATES_WIFI
public static final ImmutableList<Long> DEFAULT_INITIAL_BITRATE_ESTIMATES_WIFI
Deprecated.Default initial Wifi bitrate estimate in bits per second.
-
DEFAULT_INITIAL_BITRATE_ESTIMATES_2G
public static final ImmutableList<Long> DEFAULT_INITIAL_BITRATE_ESTIMATES_2G
Deprecated.Default initial 2G bitrate estimates in bits per second.
-
DEFAULT_INITIAL_BITRATE_ESTIMATES_3G
public static final ImmutableList<Long> DEFAULT_INITIAL_BITRATE_ESTIMATES_3G
Deprecated.Default initial 3G bitrate estimates in bits per second.
-
DEFAULT_INITIAL_BITRATE_ESTIMATES_4G
public static final ImmutableList<Long> DEFAULT_INITIAL_BITRATE_ESTIMATES_4G
Deprecated.Default initial 4G bitrate estimates in bits per second.
-
DEFAULT_INITIAL_BITRATE_ESTIMATES_5G_NSA
public static final ImmutableList<Long> DEFAULT_INITIAL_BITRATE_ESTIMATES_5G_NSA
Deprecated.Default initial 5G-NSA bitrate estimates in bits per second.
-
DEFAULT_INITIAL_BITRATE_ESTIMATES_5G_SA
public static final ImmutableList<Long> DEFAULT_INITIAL_BITRATE_ESTIMATES_5G_SA
Deprecated.Default initial 5G-SA bitrate estimates in bits per second.
-
DEFAULT_TIME_TO_FIRST_BYTE_SAMPLES
public static final int DEFAULT_TIME_TO_FIRST_BYTE_SAMPLES
Deprecated.Default number of samples to keep in the sliding window for estimating the time to first byte.- See Also:
- Constant Field Values
-
DEFAULT_TIME_TO_FIRST_BYTE_PERCENTILE
public static final float DEFAULT_TIME_TO_FIRST_BYTE_PERCENTILE
Deprecated.Default percentile for estimating the time to first byte.- See Also:
- Constant Field Values
-
DEFAULT_INITIAL_BITRATE_ESTIMATE
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
-
-
Method Detail
-
setNetworkTypeOverride
public void setNetworkTypeOverride(@NetworkType @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.
-
getBitrateEstimate
public long getBitrateEstimate()
Deprecated.Description copied from interface:BandwidthMeter
Returns the estimated bitrate.- Specified by:
getBitrateEstimate
in interfaceBandwidthMeter
-
getTimeToFirstByteEstimateUs
public long getTimeToFirstByteEstimateUs()
Deprecated.Description copied from interface:BandwidthMeter
Returns the estimated time to first byte, in microseconds, orC.TIME_UNSET
if no estimate is available.- Specified by:
getTimeToFirstByteEstimateUs
in interfaceBandwidthMeter
-
getTransferListener
public TransferListener getTransferListener()
Deprecated.Description copied from interface:BandwidthMeter
Returns theTransferListener
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 interfaceBandwidthMeter
-
addEventListener
public void addEventListener(Handler eventHandler, BandwidthMeter.EventListener eventListener)
Deprecated.Description copied from interface:BandwidthMeter
Adds anBandwidthMeter.EventListener
.- Specified by:
addEventListener
in interfaceBandwidthMeter
- Parameters:
eventHandler
- A handler for events.eventListener
- A listener of events.
-
removeEventListener
public void removeEventListener(BandwidthMeter.EventListener eventListener)
Deprecated.Description copied from interface:BandwidthMeter
Removes anBandwidthMeter.EventListener
.- Specified by:
removeEventListener
in interfaceBandwidthMeter
- Parameters:
eventListener
- The listener to be removed.
-
onTransferInitializing
public void onTransferInitializing(DataSource source, DataSpec dataSpec, boolean isNetwork)
Deprecated.Description copied from interface:TransferListener
Called when a transfer is being initialized.- Specified by:
onTransferInitializing
in interfaceTransferListener
- Parameters:
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.
-
onTransferStart
public void onTransferStart(DataSource source, DataSpec dataSpec, boolean isNetwork)
Deprecated.Description copied from interface:TransferListener
Called when a transfer starts.- Specified by:
onTransferStart
in interfaceTransferListener
- Parameters:
source
- The source performing the transfer.dataSpec
- Describes the data being transferred.isNetwork
- Whether the data is transferred through a network.
-
onBytesTransferred
public void onBytesTransferred(DataSource source, DataSpec dataSpec, boolean isNetwork, int bytesTransferred)
Deprecated.Description copied from interface:TransferListener
Called incrementally during a transfer.- Specified by:
onBytesTransferred
in interfaceTransferListener
- Parameters:
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.
-
onTransferEnd
public void onTransferEnd(DataSource source, DataSpec dataSpec, boolean isNetwork)
Deprecated.Description copied from interface:TransferListener
Called when a transfer ends.- Specified by:
onTransferEnd
in interfaceTransferListener
- Parameters:
source
- The source performing the transfer.dataSpec
- Describes the data being transferred.isNetwork
- Whether the data is transferred through a network.
-
-