BaseDataSource
@UnstableApi
public abstract class BaseDataSource implements DataSource
AssetDataSource |
A |
ByteArrayDataSource |
A |
ContentDataSource |
A |
CronetDataSource |
DataSource without intermediate buffer based on Cronet API set using UrlRequest. |
DataSchemeDataSource |
A |
DefaultHttpDataSource |
An |
FakeDataSource |
A fake |
FileDataSource |
A |
FileDescriptorDataSource |
A |
HttpEngineDataSource |
DataSource without intermediate buffer based on |
KtorDataSource |
An |
MediaDataSourceAdapter |
A |
OkHttpDataSource |
An |
RawResourceDataSource |
A |
RtmpDataSource |
A Real-Time Messaging Protocol (RTMP) |
UdpDataSource |
A UDP |
Base DataSource implementation to keep a list of TransferListeners.
Subclasses must call transferInitializing, transferStarted, bytesTransferred, and transferEnded to inform listeners of data transfers.
Summary
Protected constructors |
|---|
BaseDataSource(boolean isNetwork)Creates base data source. |
Public methods |
|
|---|---|
final void |
@UnstableApiAdds a |
Protected methods |
|
|---|---|
final void |
bytesTransferred(int bytesTransferred)Notifies listeners that bytes were transferred. |
final void |
Notifies listeners that a transfer ended. |
final void |
transferInitializing(DataSpec dataSpec)Notifies listeners that data transfer for the specified |
final void |
transferStarted(DataSpec dataSpec)Notifies listeners that data transfer for the specified |
Inherited methods |
||||||||
|---|---|---|---|---|---|---|---|---|
|
||||||||
|
Protected constructors
BaseDataSource
protected BaseDataSource(boolean isNetwork)
Creates base data source.
| Parameters | |
|---|---|
boolean isNetwork |
Whether the data source loads data through a network. |
Public methods
addTransferListener
@UnstableApi
public final void addTransferListener(TransferListener transferListener)
Adds a TransferListener to listen to data transfers. This method is not thread-safe.
| Parameters | |
|---|---|
TransferListener transferListener |
Protected methods
bytesTransferred
protected final void bytesTransferred(int bytesTransferred)
Notifies listeners that bytes were transferred.
| Parameters | |
|---|---|
int bytesTransferred |
The number of bytes transferred since the previous call to this method (or if the first call, since the transfer was started). |
transferInitializing
protected final void transferInitializing(DataSpec dataSpec)
Notifies listeners that data transfer for the specified DataSpec is being initialized.
transferStarted
protected final void transferStarted(DataSpec dataSpec)
Notifies listeners that data transfer for the specified DataSpec started.