# SplitParallelSampleBandwidthEstimator

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/SplitParallelSampleBandwidthEstimator.java+class:androidx.media3.exoplayer.upstream.experimental.SplitParallelSampleBandwidthEstimator)

*** ** * ** ***


```
@UnstableApi
public class SplitParallelSampleBandwidthEstimator implements BandwidthEstimator
```

<br />

*** ** * ** ***

A `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/experimental/BandwidthEstimator` that captures a transfer sample each time a transfer ends. When parallel transfers are happening at the same time, the transferred bytes are aggregated in a single sample.

## Summary

| ### Nested types |
|---|
| `public class https://developer.android.com/reference/androidx/media3/exoplayer/upstream/experimental/SplitParallelSampleBandwidthEstimator.Builder` A builder to create `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/experimental/SplitParallelSampleBandwidthEstimator` instances. |

| ### Public fields |
|---|---|
| `long` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/experimental/SplitParallelSampleBandwidthEstimator#bandwidthEstimate()` |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/experimental/SplitParallelSampleBandwidthEstimator#addEventListener(android.os.Handler,androidx.media3.exoplayer.upstream.BandwidthMeter.EventListener)( https://developer.android.com/reference/android/os/Handler.html eventHandler, https://developer.android.com/reference/androidx/media3/exoplayer/upstream/BandwidthMeter.EventListener eventListener )` Adds an `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/BandwidthMeter.EventListener`. |
| `long` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/experimental/SplitParallelSampleBandwidthEstimator#getBandwidthEstimate()()` Returns the bandwidth estimate in bits per second, or `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/experimental/BandwidthEstimator#ESTIMATE_NOT_AVAILABLE()` if there is no estimate available yet. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/experimental/SplitParallelSampleBandwidthEstimator#onBytesTransferred(androidx.media3.datasource.DataSource,int)(https://developer.android.com/reference/androidx/media3/datasource/DataSource source, int bytesTransferred)` Called incrementally during a transfer. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/experimental/SplitParallelSampleBandwidthEstimator#onNetworkTypeChange(long)(long newBandwidthEstimate)` Notifies this estimator that a network change has been detected. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/experimental/SplitParallelSampleBandwidthEstimator#onTransferEnd(androidx.media3.datasource.DataSource)(https://developer.android.com/reference/androidx/media3/datasource/DataSource source)` Called when a transfer ends. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/experimental/SplitParallelSampleBandwidthEstimator#onTransferInitializing(androidx.media3.datasource.DataSource)(https://developer.android.com/reference/androidx/media3/datasource/DataSource source)` Called when a transfer is being initialized. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/experimental/SplitParallelSampleBandwidthEstimator#onTransferStart(androidx.media3.datasource.DataSource)(https://developer.android.com/reference/androidx/media3/datasource/DataSource source)` Called when a transfer starts. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/experimental/SplitParallelSampleBandwidthEstimator#removeEventListener(androidx.media3.exoplayer.upstream.BandwidthMeter.EventListener)(https://developer.android.com/reference/androidx/media3/exoplayer/upstream/BandwidthMeter.EventListener eventListener)` Removes an `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/BandwidthMeter.EventListener`. |

| ### Inherited Constants |
|---|
| From [androidx.media3.exoplayer.upstream.experimental.BandwidthEstimator](https://developer.android.com/reference/androidx/media3/exoplayer/upstream/experimental/BandwidthEstimator) |---|---| | `static final long` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/experimental/BandwidthEstimator#ESTIMATE_NOT_AVAILABLE() = -9223372036854775808` | |

## Public fields

### bandwidthEstimate

```
public long bandwidthEstimate
```

## Public methods

### addEventListener

```
public void addEventListener(
    Handler eventHandler,
    BandwidthMeter.EventListener eventListener
)
```

Adds an `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/BandwidthMeter.EventListener`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/os/Handler.html eventHandler` | A handler for events. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/BandwidthMeter.EventListener eventListener` | A listener of events. |

### getBandwidthEstimate

```
public long getBandwidthEstimate()
```

Returns the bandwidth estimate in bits per second, or `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/experimental/BandwidthEstimator#ESTIMATE_NOT_AVAILABLE()` if there is no estimate available yet.

### onBytesTransferred

```
public void onBytesTransferred(DataSource source, int bytesTransferred)
```

Called incrementally during a transfer.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/datasource/DataSource source` | The `https://developer.android.com/reference/androidx/media3/datasource/DataSource` performing the transfer. |
| `int bytesTransferred` | The number of bytes transferred since the previous call to this method |

### onNetworkTypeChange

```
public void onNetworkTypeChange(long newBandwidthEstimate)
```

Notifies this estimator that a network change has been detected.

| Parameters |
|---|---|
| `long newBandwidthEstimate` | The new initial bandwidth estimate based on network type. |

### onTransferEnd

```
public void onTransferEnd(DataSource source)
```

Called when a transfer ends.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/datasource/DataSource source` | The `https://developer.android.com/reference/androidx/media3/datasource/DataSource` performing the transfer. |

### onTransferInitializing

```
public void onTransferInitializing(DataSource source)
```

Called when a transfer is being initialized.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/datasource/DataSource source` | The `https://developer.android.com/reference/androidx/media3/datasource/DataSource` performing the transfer. |

### onTransferStart

```
public void onTransferStart(DataSource source)
```

Called when a transfer starts.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/datasource/DataSource source` | The `https://developer.android.com/reference/androidx/media3/datasource/DataSource` performing the transfer. |

### removeEventListener

```
public void removeEventListener(BandwidthMeter.EventListener eventListener)
```

Removes an `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/BandwidthMeter.EventListener`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/BandwidthMeter.EventListener eventListener` | The listener to be removed. |