Back to Exoplayer

TransferListener (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/upstream/TransferListener.html

latest5.5 KB
Original Source

Package com.google.android.exoplayer2.upstream

Interface TransferListener

  • All Known Implementing Classes:DataSourceContractTest.FakeTransferListener, DefaultBandwidthMeter, ExperimentalBandwidthMeter

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public interfaceTransferListener

Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.

A listener of data transfer events.

A transfer usually progresses through multiple steps:

  1. Initializing the underlying resource (e.g. opening a HTTP connection). onTransferInitializing(DataSource, DataSpec, boolean) is called before the initialization starts.
  2. Starting the transfer after successfully initializing the resource. onTransferStart(DataSource, DataSpec, boolean) is called. Note that this only happens if the initialization was successful.
  3. Transferring data. onBytesTransferred(DataSource, DataSpec, boolean, int) is called frequently during the transfer to indicate progress.
  4. Closing the transfer and the underlying resource. onTransferEnd(DataSource, DataSpec, boolean) is called. Note that each onTransferStart(DataSource, DataSpec, boolean) will have exactly one corresponding call to onTransferEnd(DataSource, DataSpec, boolean).

Method Summary

All Methods Instance Methods Abstract Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | void | onBytesTransferred​(DataSource source, DataSpec dataSpec, boolean isNetwork, int bytesTransferred) | Deprecated.

Called incrementally during a transfer. | | void | onTransferEnd​(DataSource source, DataSpec dataSpec, boolean isNetwork) | Deprecated.

Called when a transfer ends. | | void | onTransferInitializing​(DataSource source, DataSpec dataSpec, boolean isNetwork) | Deprecated.

Called when a transfer is being initialized. | | void | onTransferStart​(DataSource source, DataSpec dataSpec, boolean isNetwork) | Deprecated.

Called when a transfer starts. |

Method Detail

- 

onTransferInitializing

void onTransferInitializing​([DataSource](DataSource.html "interface in com.google.android.exoplayer2.upstream")source,[DataSpec](DataSpec.html "class in com.google.android.exoplayer2.upstream")dataSpec,
                            boolean isNetwork)

Deprecated.

Called when a transfer is being initialized. Parameters:source - The source performing the transfer.dataSpec - Describes the data for which the transfer is initialized.isNetwork - Whether the data is transferred through a network.

- 

onTransferStart

void onTransferStart​([DataSource](DataSource.html "interface in com.google.android.exoplayer2.upstream")source,[DataSpec](DataSpec.html "class in com.google.android.exoplayer2.upstream")dataSpec,
                     boolean isNetwork)

Deprecated.

Called when a transfer starts. Parameters:source - The source performing the transfer.dataSpec - Describes the data being transferred.isNetwork - Whether the data is transferred through a network.

- 

onBytesTransferred

void onBytesTransferred​([DataSource](DataSource.html "interface in com.google.android.exoplayer2.upstream")source,[DataSpec](DataSpec.html "class in com.google.android.exoplayer2.upstream")dataSpec,
                        boolean isNetwork,
                        int bytesTransferred)

Deprecated.

Called incrementally during a transfer. Parameters:source - The source performing the transfer.dataSpec - Describes the data being transferred.isNetwork - Whether the data is transferred through a network.bytesTransferred - The number of bytes transferred since the previous call to this method.

- 

onTransferEnd

void onTransferEnd​([DataSource](DataSource.html "interface in com.google.android.exoplayer2.upstream")source,[DataSpec](DataSpec.html "class in com.google.android.exoplayer2.upstream")dataSpec,
                   boolean isNetwork)

Deprecated.

Called when a transfer ends. Parameters:source - The source performing the transfer.dataSpec - Describes the data being transferred.isNetwork - Whether the data is transferred through a network.