ExperimentalBandwidthMeter.Builder


class ExperimentalBandwidthMeter.Builder


Builder for a bandwidth meter.

Summary

Public constructors

Builder(context: Context!)

Creates a builder with default parameters and without listener.

Public functions

ExperimentalBandwidthMeter!

Builds the bandwidth meter.

ExperimentalBandwidthMeter.Builder!

Sets the BandwidthEstimator used.

ExperimentalBandwidthMeter.Builder!

Sets the initial bitrate estimates to the default values of the specified country.

ExperimentalBandwidthMeter.Builder!

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

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

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!

Sets whether to reset if the network type changes.

ExperimentalBandwidthMeter.Builder!

Sets the TimeToFirstByteEstimator to be used.

Public constructors

Builder

Builder(context: Context!)

Creates a builder with default parameters and without listener.

Parameters
context: Context!

A context.

Public functions

build

fun build(): ExperimentalBandwidthMeter!

Builds the bandwidth meter.

Returns
ExperimentalBandwidthMeter!

A bandwidth meter with the configured properties.

setBandwidthEstimator

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

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

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: String!

The ISO 3166-1 alpha-2 country code of the country whose default bitrate estimates should be used.

Returns
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: Long

The initial bitrate estimate in bits per second.

Returns
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
@C.NetworkType networkType: Int

The C.NetworkType this initial estimate is for.

initialBitrateEstimate: Long

The initial bitrate estimate in bits per second.

Returns
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: Boolean

Whether to reset if the network type changes.

Returns
ExperimentalBandwidthMeter.Builder!

This builder.

setTimeToFirstByteEstimator

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

Sets the TimeToFirstByteEstimator to be used.

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

Parameters
timeToFirstByteEstimator: TimeToFirstByteEstimator!

The TimeToFirstByteEstimator to be used.

Returns
ExperimentalBandwidthMeter.Builder!

This builder.