# 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)

*** ** * ** ***


```
public final class ExperimentalBandwidthMeter.Builder
```

<br />

*** ** * ** ***

Builder for a bandwidth meter.

## Summary

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

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

## Public constructors

### Builder

```
public Builder(Context context)
```

Creates a builder with default parameters and without listener.

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

## Public methods

### build

```
public ExperimentalBandwidthMeter build()
```

Builds the bandwidth meter.

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

### setBandwidthEstimator

```
@CanIgnoreReturnValue
public ExperimentalBandwidthMeter.Builder setBandwidthEstimator(BandwidthEstimator bandwidthEstimator)
```

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

### 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 |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html countryCode` | The ISO 3166-1 alpha-2 country code of the country whose default bitrate estimates should be used. |

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

### 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 |
|---|---|
| `long initialBitrateEstimate` | The initial bitrate estimate in bits per second. |

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

### setInitialBitrateEstimate

```
@CanIgnoreReturnValue
public ExperimentalBandwidthMeter.Builder setInitialBitrateEstimate(
    @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 |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/C.NetworkType int networkType` | The `https://developer.android.com/reference/androidx/media3/common/C.NetworkType` this initial estimate is for. |
| `long initialBitrateEstimate` | The initial bitrate estimate in bits per second. |

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

### setResetOnNetworkTypeChange

```
@CanIgnoreReturnValue
public ExperimentalBandwidthMeter.Builder setResetOnNetworkTypeChange(boolean resetOnNetworkTypeChange)
```

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

| Parameters |
|---|---|
| `boolean resetOnNetworkTypeChange` | Whether to reset if the network type changes. |

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

### setTimeToFirstByteEstimator

```
@CanIgnoreReturnValue
public ExperimentalBandwidthMeter.Builder setTimeToFirstByteEstimator(
    TimeToFirstByteEstimator timeToFirstByteEstimator
)
```

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

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

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

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