# ExperimentalBandwidthMeter.Builder

Artifact: [androidx.media3:media3-exoplayer](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.java+class:androidx.media3.exoplayer.upstream.experimental.ExperimentalBandwidthMeter.Builder)

*** ** * ** ***


```
class ExperimentalBandwidthMeter.Builder
```

<br />

*** ** * ** ***

Builder for a bandwidth meter.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.Builder#Builder(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html!)` Creates a builder with default parameters and without listener. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.Builder#build()()` Builds the bandwidth meter. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.Builder#setBandwidthEstimator(androidx.media3.exoplayer.upstream.experimental.BandwidthEstimator)(bandwidthEstimator: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/BandwidthEstimator!)` Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/BandwidthEstimator` used. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.Builder#setInitialBitrateEstimate(java.lang.String)(countryCode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Sets the initial bitrate estimates to the default values of the specified country. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.Builder#setInitialBitrateEstimate(long)(initialBitrateEstimate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the initial bitrate estimate in bits per second that should be assumed when a bandwidth estimate is unavailable. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.Builder#setInitialBitrateEstimate(int,long)( @https://developer.android.com/reference/kotlin/androidx/media3/common/C.NetworkType networkType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, initialBitrateEstimate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html )` 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. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.Builder#setResetOnNetworkTypeChange(boolean)(resetOnNetworkTypeChange: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether to reset if the network type changes. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.Builder#setTimeToFirstByteEstimator(androidx.media3.exoplayer.upstream.TimeToFirstByteEstimator)( timeToFirstByteEstimator: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/TimeToFirstByteEstimator! )` Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/TimeToFirstByteEstimator` to be used. |

## Public constructors

### Builder

```
Builder(context: Context!)
```

Creates a builder with default parameters and without listener.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html!` | A context. |

## Public functions

### build

```
fun build(): ExperimentalBandwidthMeter!
```

Builds the bandwidth meter.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter!` | A bandwidth meter with the configured properties. |

### setBandwidthEstimator

```
@CanIgnoreReturnValue
fun setBandwidthEstimator(bandwidthEstimator: BandwidthEstimator!): ExperimentalBandwidthMeter.Builder!
```

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/BandwidthEstimator` used. By default, this is set to a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/SplitParallelSampleBandwidthEstimator` using a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/SlidingWeightedAverageBandwidthStatistic`.

### setInitialBitrateEstimate

```
@CanIgnoreReturnValue
fun setInitialBitrateEstimate(countryCode: String!): ExperimentalBandwidthMeter.Builder!
```

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: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | The ISO 3166-1 alpha-2 country code of the country whose default bitrate estimates should be used. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.Builder!` | This builder. |

### setInitialBitrateEstimate

```
@CanIgnoreReturnValue
fun setInitialBitrateEstimate(initialBitrateEstimate: Long): ExperimentalBandwidthMeter.Builder!
```

Sets the initial bitrate estimate in bits per second that should be assumed when a bandwidth estimate is unavailable.

| Parameters |
|---|---|
| `initialBitrateEstimate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The initial bitrate estimate in bits per second. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.Builder!` | This builder. |

### setInitialBitrateEstimate

```
@CanIgnoreReturnValue
fun setInitialBitrateEstimate(
    @C.NetworkType networkType: Int,
    initialBitrateEstimate: Long
): ExperimentalBandwidthMeter.Builder!
```

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 |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.NetworkType networkType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/C.NetworkType` this initial estimate is for. |
| `initialBitrateEstimate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The initial bitrate estimate in bits per second. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.Builder!` | This builder. |

### setResetOnNetworkTypeChange

```
@CanIgnoreReturnValue
fun setResetOnNetworkTypeChange(resetOnNetworkTypeChange: Boolean): ExperimentalBandwidthMeter.Builder!
```

Sets whether to reset if the network type changes. The default value is `true`.

| Parameters |
|---|---|
| `resetOnNetworkTypeChange: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether to reset if the network type changes. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.Builder!` | This builder. |

### setTimeToFirstByteEstimator

```
@CanIgnoreReturnValue
fun setTimeToFirstByteEstimator(
    timeToFirstByteEstimator: TimeToFirstByteEstimator!
): ExperimentalBandwidthMeter.Builder!
```

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/TimeToFirstByteEstimator` to be used.

Default is `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/PercentileTimeToFirstByteEstimator` with a sliding window size of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter#DEFAULT_TIME_TO_FIRST_BYTE_SAMPLES()` that uses a percentile of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter#DEFAULT_TIME_TO_FIRST_BYTE_PERCENTILE()`.

| Parameters |
|---|---|
| `timeToFirstByteEstimator: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/TimeToFirstByteEstimator!` | The `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/TimeToFirstByteEstimator` to be used. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.Builder!` | This builder. |