Back to Exoplayer

ExperimentalBandwidthMeter.Builder (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/upstream/experimental/ExperimentalBandwidthMeter.Builder.html

latest7.9 KB
Original Source

Package com.google.android.exoplayer2.upstream.experimental

Class ExperimentalBandwidthMeter.Builder


public static final classExperimentalBandwidthMeter.Builderextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")

Builder for a bandwidth meter.

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | Builder​(Context context) | Creates a builder with default parameters and without listener. |

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 the BandwidthEstimator 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 the TimeToFirstByteEstimator to be used. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

- 

Builder

public Builder​([Context](https://developer.android.com/reference/android/content/Context.html "class or interface in android.content")context)

Creates a builder with default parameters and without listener. Parameters:context - A context.

Method Detail

- 

setInitialBitrateEstimate

@CanIgnoreReturnValue
public[ExperimentalBandwidthMeter.Builder](ExperimentalBandwidthMeter.Builder.html "class in com.google.android.exoplayer2.upstream.experimental")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](ExperimentalBandwidthMeter.Builder.html "class in com.google.android.exoplayer2.upstream.experimental")setInitialBitrateEstimate​([@NetworkType](../../C.NetworkType.html "annotation in com.google.android.exoplayer2")@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 - The C.NetworkType this initial estimate is for.initialBitrateEstimate - The initial bitrate estimate in bits per second.Returns:This builder.

- 

setInitialBitrateEstimate

@CanIgnoreReturnValue
public[ExperimentalBandwidthMeter.Builder](ExperimentalBandwidthMeter.Builder.html "class in com.google.android.exoplayer2.upstream.experimental")setInitialBitrateEstimate​([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")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](ExperimentalBandwidthMeter.Builder.html "class in com.google.android.exoplayer2.upstream.experimental")setTimeToFirstByteEstimator​([TimeToFirstByteEstimator](../TimeToFirstByteEstimator.html "interface in com.google.android.exoplayer2.upstream")timeToFirstByteEstimator)

Sets the TimeToFirstByteEstimator to be used.

Default is PercentileTimeToFirstByteEstimator with a sliding window size of ExperimentalBandwidthMeter.DEFAULT_TIME_TO_FIRST_BYTE_SAMPLES that uses a percentile of ExperimentalBandwidthMeter.DEFAULT_TIME_TO_FIRST_BYTE_PERCENTILE.

Parameters:timeToFirstByteEstimator - The TimeToFirstByteEstimator to be used.Returns:This builder.

- 

setBandwidthEstimator

@CanIgnoreReturnValue
public[ExperimentalBandwidthMeter.Builder](ExperimentalBandwidthMeter.Builder.html "class in com.google.android.exoplayer2.upstream.experimental")setBandwidthEstimator​([BandwidthEstimator](BandwidthEstimator.html "interface in com.google.android.exoplayer2.upstream.experimental")bandwidthEstimator)

Sets the BandwidthEstimator used. By default, this is set to a SplitParallelSampleBandwidthEstimator using a SlidingWeightedAverageBandwidthStatistic.

- 

setResetOnNetworkTypeChange

@CanIgnoreReturnValue
public[ExperimentalBandwidthMeter.Builder](ExperimentalBandwidthMeter.Builder.html "class in com.google.android.exoplayer2.upstream.experimental")setResetOnNetworkTypeChange​(boolean resetOnNetworkTypeChange)

Sets whether to reset if the network type changes. The default value is true. Parameters:resetOnNetworkTypeChange - Whether to reset if the network type changes.Returns:This builder.

- 

build

public[ExperimentalBandwidthMeter](ExperimentalBandwidthMeter.html "class in com.google.android.exoplayer2.upstream.experimental")build()

Builds the bandwidth meter. Returns:A bandwidth meter with the configured properties.