Back to Exoplayer

DefaultBandwidthMeter.Builder (ExoPlayer library)

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

latest6.3 KB
Original Source

Package com.google.android.exoplayer2.upstream

Class DefaultBandwidthMeter.Builder


public static final classDefaultBandwidthMeter.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 | | --- | --- | --- | | DefaultBandwidthMeter | build() | Builds the bandwidth meter. | | DefaultBandwidthMeter.Builder | setClock​(Clock clock) | Sets the clock used to estimate bandwidth from data transfers. | | DefaultBandwidthMeter.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. | | DefaultBandwidthMeter.Builder | setInitialBitrateEstimate​(long initialBitrateEstimate) | Sets the initial bitrate estimate in bits per second that should be assumed when a bandwidth estimate is unavailable. | | DefaultBandwidthMeter.Builder | setInitialBitrateEstimate​(String countryCode) | Sets the initial bitrate estimates to the default values of the specified country. | | DefaultBandwidthMeter.Builder | setResetOnNetworkTypeChange​(boolean resetOnNetworkTypeChange) | Sets whether to reset if the network type changes. | | DefaultBandwidthMeter.Builder | setSlidingWindowMaxWeight​(int slidingWindowMaxWeight) | Sets the maximum weight for the sliding window. |

- 

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

- 

setSlidingWindowMaxWeight

@CanIgnoreReturnValue
public[DefaultBandwidthMeter.Builder](DefaultBandwidthMeter.Builder.html "class in com.google.android.exoplayer2.upstream")setSlidingWindowMaxWeight​(int slidingWindowMaxWeight)

Sets the maximum weight for the sliding window. Parameters:slidingWindowMaxWeight - The maximum weight for the sliding window.Returns:This builder.

- 

setInitialBitrateEstimate

@CanIgnoreReturnValue
public[DefaultBandwidthMeter.Builder](DefaultBandwidthMeter.Builder.html "class in com.google.android.exoplayer2.upstream")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[DefaultBandwidthMeter.Builder](DefaultBandwidthMeter.Builder.html "class in com.google.android.exoplayer2.upstream")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[DefaultBandwidthMeter.Builder](DefaultBandwidthMeter.Builder.html "class in com.google.android.exoplayer2.upstream")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.

- 

setClock

@CanIgnoreReturnValue
public[DefaultBandwidthMeter.Builder](DefaultBandwidthMeter.Builder.html "class in com.google.android.exoplayer2.upstream")setClock​([Clock](../util/Clock.html "interface in com.google.android.exoplayer2.util")clock)

Sets the clock used to estimate bandwidth from data transfers. Should only be set for testing purposes. Parameters:clock - The clock used to estimate bandwidth from data transfers.Returns:This builder.

- 

setResetOnNetworkTypeChange

@CanIgnoreReturnValue
public[DefaultBandwidthMeter.Builder](DefaultBandwidthMeter.Builder.html "class in com.google.android.exoplayer2.upstream")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[DefaultBandwidthMeter](DefaultBandwidthMeter.html "class in com.google.android.exoplayer2.upstream")build()

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