@UnstableApi
public interface BandwidthMeter

Known direct subclasses
DefaultBandwidthMeter

Estimates bandwidth by listening to data transfers.

ExperimentalBandwidthMeter

An experimental BandwidthMeter that estimates bandwidth by listening to data transfers.


Provides estimates of the currently available bandwidth.

Summary

Nested types

A listener of BandwidthMeter events.

Event dispatcher which allows listener registration.

Public methods

abstract void
addEventListener(
    Handler eventHandler,
    BandwidthMeter.EventListener eventListener
)

Adds an EventListener.

abstract long

Returns the estimated bitrate.

default long

Returns the estimated time to first byte, in microseconds, or TIME_UNSET if no estimate is available.

abstract @Nullable TransferListener

Returns the TransferListener that this instance uses to gather bandwidth information from data transfers.

abstract void

Removes an EventListener.

Public methods

addEventListener

abstract void addEventListener(
    Handler eventHandler,
    BandwidthMeter.EventListener eventListener
)

Adds an EventListener.

Parameters
Handler eventHandler

A handler for events.

BandwidthMeter.EventListener eventListener

A listener of events.

getBitrateEstimate

abstract long getBitrateEstimate()

Returns the estimated bitrate.

getTimeToFirstByteEstimateUs

default long getTimeToFirstByteEstimateUs()

Returns the estimated time to first byte, in microseconds, or TIME_UNSET if no estimate is available.

getTransferListener

abstract @Nullable TransferListener getTransferListener()

Returns the TransferListener that this instance uses to gather bandwidth information from data transfers. May be null if the implementation does not listen to data transfers.

removeEventListener

abstract void removeEventListener(BandwidthMeter.EventListener eventListener)

Removes an EventListener.

Parameters
BandwidthMeter.EventListener eventListener

The listener to be removed.