Class ExperimentalBandwidthMeter.Builder
- java.lang.Object
-
- com.google.android.exoplayer2.upstream.experimental.ExperimentalBandwidthMeter.Builder
-
- Enclosing class:
- ExperimentalBandwidthMeter
public static final class ExperimentalBandwidthMeter.Builder extends Object
Builder for a bandwidth meter.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExperimentalBandwidthMeter
build()
Builds the bandwidth meter.ExperimentalBandwidthMeter.Builder
setBandwidthEstimator(BandwidthEstimator bandwidthEstimator)
Sets theBandwidthEstimator
used.ExperimentalBandwidthMeter.Builder
setInitialBitrateEstimate(@com.google.android.exoplayer2.C.NetworkType int networkType, long initialBitrateEstimate)
Sets the initial bitrate estimate in bits per second that should be assumed when a bandwidth estimate is unavailable and the current network connection is of the specified type.ExperimentalBandwidthMeter.Builder
setInitialBitrateEstimate(long initialBitrateEstimate)
Sets the initial bitrate estimate in bits per second that should be assumed when a bandwidth estimate is unavailable.ExperimentalBandwidthMeter.Builder
setInitialBitrateEstimate(String countryCode)
Sets the initial bitrate estimates to the default values of the specified country.ExperimentalBandwidthMeter.Builder
setResetOnNetworkTypeChange(boolean resetOnNetworkTypeChange)
Sets whether to reset if the network type changes.ExperimentalBandwidthMeter.Builder
setTimeToFirstByteEstimator(TimeToFirstByteEstimator timeToFirstByteEstimator)
Sets theTimeToFirstByteEstimator
to be used.
-
-
-
Constructor Detail
-
Builder
public Builder(Context context)
Creates a builder with default parameters and without listener.- Parameters:
context
- A context.
-
-
Method Detail
-
setInitialBitrateEstimate
@CanIgnoreReturnValue public ExperimentalBandwidthMeter.Builder setInitialBitrateEstimate(long initialBitrateEstimate)
Sets the initial bitrate estimate in bits per second that should be assumed when a bandwidth estimate is unavailable.- Parameters:
initialBitrateEstimate
- The initial bitrate estimate in bits per second.- Returns:
- This builder.
-
setInitialBitrateEstimate
@CanIgnoreReturnValue public ExperimentalBandwidthMeter.Builder setInitialBitrateEstimate(@NetworkType @com.google.android.exoplayer2.C.NetworkType int networkType, long initialBitrateEstimate)
Sets the initial bitrate estimate in bits per second that should be assumed when a bandwidth estimate is unavailable and the current network connection is of the specified type.- Parameters:
networkType
- TheC.NetworkType
this initial estimate is for.initialBitrateEstimate
- The initial bitrate estimate in bits per second.- Returns:
- This builder.
-
setInitialBitrateEstimate
@CanIgnoreReturnValue public ExperimentalBandwidthMeter.Builder setInitialBitrateEstimate(String countryCode)
Sets the initial bitrate estimates to the default values of the specified country. The initial estimates are used when a bandwidth estimate is unavailable.- Parameters:
countryCode
- The ISO 3166-1 alpha-2 country code of the country whose default bitrate estimates should be used.- Returns:
- This builder.
-
setTimeToFirstByteEstimator
@CanIgnoreReturnValue public ExperimentalBandwidthMeter.Builder setTimeToFirstByteEstimator(TimeToFirstByteEstimator timeToFirstByteEstimator)
Sets theTimeToFirstByteEstimator
to be used.Default is
PercentileTimeToFirstByteEstimator
with a sliding window size ofExperimentalBandwidthMeter.DEFAULT_TIME_TO_FIRST_BYTE_SAMPLES
that uses a percentile ofExperimentalBandwidthMeter.DEFAULT_TIME_TO_FIRST_BYTE_PERCENTILE
.- Parameters:
timeToFirstByteEstimator
- TheTimeToFirstByteEstimator
to be used.- Returns:
- This builder.
-
setBandwidthEstimator
@CanIgnoreReturnValue public ExperimentalBandwidthMeter.Builder setBandwidthEstimator(BandwidthEstimator bandwidthEstimator)
Sets theBandwidthEstimator
used. By default, this is set to aSplitParallelSampleBandwidthEstimator
using aSlidingWeightedAverageBandwidthStatistic
.
-
setResetOnNetworkTypeChange
@CanIgnoreReturnValue public ExperimentalBandwidthMeter.Builder setResetOnNetworkTypeChange(boolean resetOnNetworkTypeChange)
Sets whether to reset if the network type changes. The default value istrue
.- Parameters:
resetOnNetworkTypeChange
- Whether to reset if the network type changes.- Returns:
- This builder.
-
build
public ExperimentalBandwidthMeter build()
Builds the bandwidth meter.- Returns:
- A bandwidth meter with the configured properties.
-
-