java.lang.Object | |
↳ | android.media.MediaDataSource |
For supplying media data to the framework. Implement this if your app has special requirements for the way media data is obtained.
Methods of this interface may be called on multiple different threads. There will be a thread synchronization point between each call to ensure that modifications to the state of your MediaDataSource are visible to future calls. This means you don't need to do your own synchronization unless you're modifying the MediaDataSource from another thread while it's being used by the framework.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Called to get the size of the data source.
| |||||||||||
Called to request data from the given position.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
java.io.Closeable
| |||||||||||
From interface
java.lang.AutoCloseable
|
Called to get the size of the data source.
IOException | on fatal errors |
---|
Called to request data from the given position.
Implementations should should write up to size
bytes into
buffer
, and return the number of bytes written.
Return 0
if size is zero (thus no bytes are read).
Return -1
to indicate that end of stream is reached.
position | the position in the data source to read from. |
---|---|
buffer | the buffer to read the data into. |
offset | the offset within buffer to read the data into. |
size | the number of bytes to read. |
IOException | on fatal errors. |
---|