PlayerBandwidthMeter

Provides an implementation of BandwidthMeter that tracks the total number of bytes transferred. By default all work will be delegated to DefaultBandwidthMeter. The caller may override the delegate to another instance any time.

Author

rsubramaniam

Constructors

Link copied to clipboard
constructor()
Constructs a new instance of the bandwidth meter that will use DefaultBandwidthMeter internally to delegate the work.
constructor(eventHandler: Handler, eventListener: EventListener)
Constructs a new instance of the bandwidth meter that will use DefaultBandwidthMeter internally to delegate the work.
constructor(context: Context, eventHandler: Handler, eventListener: EventListener)
Constructs a new instance of the bandwidth meter that will use DefaultBandwidthMeter internally to delegate the work.
constructor(bandwidthMeter: BandwidthMeter)
Constructs a new instance of the bandwidth meter that will use given bandwidth meter to delegate the work.

Properties

Link copied to clipboard
open var NO_ESTIMATE: Long
Indicates no bandwidth estimate is available.

Functions

Link copied to clipboard
open fun addEventListener(eventHandler: Handler, eventListener: EventListener)
Link copied to clipboard
Link copied to clipboard
open fun getDelegate(): BandwidthMeter
Gets reference to actual bandwidth meter that is currently being delegated to handle bitrate estimate calculations.
Link copied to clipboard
Gets the total number of bytes transferred so far.
Link copied to clipboard
open fun getTransferListener(): TransferListener
Link copied to clipboard
open fun onBytesTransferred(source: DataSource, dataSpec: DataSpec, isNetwork: Boolean, bytesTransferred: Int)
Link copied to clipboard
open fun onTransferEnd(source: DataSource, dataSpec: DataSpec, isNetwork: Boolean)
Link copied to clipboard
open fun onTransferInitializing(source: DataSource, dataSpec: DataSpec, isNetwork: Boolean)
Link copied to clipboard
open fun onTransferStart(source: DataSource, dataSpec: DataSpec, isNetwork: Boolean)
Link copied to clipboard
open fun removeEventListener(eventListener: EventListener)
Link copied to clipboard
Resets the counter for total number of bytes transferred.
Link copied to clipboard
open fun setDelegate(bandwidthMeter: BandwidthMeter)
Sets reference to actual bandwidth meter that must be used to handle bitrate estimate calculations.