belongs to Maven artifact androidx.media2:media2:1.0.0-alpha01

DataSourceDesc2

public final class DataSourceDesc2
extends Object

java.lang.Object
   ↳ androidx.media2.DataSourceDesc2


Structure for data source descriptor. Used by MediaItem2.

Users should use DataSourceDesc2.Builder to change DataSourceDesc2.

See also:

Summary

Nested classes

class DataSourceDesc2.Builder

Builder class for DataSourceDesc2 objects. 

Constants

long FD_LENGTH_UNKNOWN

Used when the length of file descriptor is unknown.

long POSITION_UNKNOWN

Used when a position is unknown.

int TYPE_CALLBACK

int TYPE_FD

int TYPE_NONE

int TYPE_URI

Public methods

long getEndPosition()

Return the position in milliseconds at which the playback will end.

FileDescriptor getFileDescriptor()

Return the FileDescriptor of this data source.

long getFileDescriptorLength()

Return the content length associated with the FileDescriptor of this data source.

long getFileDescriptorOffset()

Return the offset associated with the FileDescriptor of this data source.

MediaDataSource2 getMediaDataSource2()

Return the MediaDataSource2 of this data source.

String getMediaId()

Return the media Id of data source.

long getStartPosition()

Return the position in milliseconds at which the playback will start.

int getType()

Return the type of data source.

Uri getUri()

Return the Uri of this data source.

Context getUriContext()

Return the Context used for resolving the Uri of this data source.

List<HttpCookie> getUriCookies()

Return the Uri cookies of this data source.

Map<String, String> getUriHeaders()

Return the Uri headers of this data source.

Inherited methods

Constants

FD_LENGTH_UNKNOWN

public static final long FD_LENGTH_UNKNOWN

Used when the length of file descriptor is unknown.

Constant Value: 576460752303423487 (0x07ffffffffffffff)

POSITION_UNKNOWN

public static final long POSITION_UNKNOWN

Used when a position is unknown.

See also:

Constant Value: 576460752303423487 (0x07ffffffffffffff)

TYPE_CALLBACK

public static final int TYPE_CALLBACK

Constant Value: 1 (0x00000001)

TYPE_FD

public static final int TYPE_FD

Constant Value: 2 (0x00000002)

TYPE_NONE

public static final int TYPE_NONE

Constant Value: 0 (0x00000000)

TYPE_URI

public static final int TYPE_URI

Constant Value: 3 (0x00000003)

Public methods

getEndPosition

public long getEndPosition ()

Return the position in milliseconds at which the playback will end. POSITION_UNKNOWN means ending at the end of source content.

Returns
long the position in milliseconds at which the playback will end

getFileDescriptor

public FileDescriptor getFileDescriptor ()

Return the FileDescriptor of this data source. It's meaningful only when getType returns TYPE_FD.

Returns
FileDescriptor the FileDescriptor of this data source

getFileDescriptorLength

public long getFileDescriptorLength ()

Return the content length associated with the FileDescriptor of this data source. It's meaningful only when getType returns TYPE_FD. FD_LENGTH_UNKNOWN means same as the length of source content.

Returns
long the content length associated with the FileDescriptor of this data source

getFileDescriptorOffset

public long getFileDescriptorOffset ()

Return the offset associated with the FileDescriptor of this data source. It's meaningful only when getType returns TYPE_FD and it has been set by the DataSourceDesc2.Builder.

Returns
long the offset associated with the FileDescriptor of this data source

getMediaDataSource2

public MediaDataSource2 getMediaDataSource2 ()

Return the MediaDataSource2 of this data source. It's meaningful only when getType returns TYPE_CALLBACK.

Returns
MediaDataSource2 the MediaDataSource2 of this data source

getMediaId

public String getMediaId ()

Return the media Id of data source.

Returns
String the media Id of data source

getStartPosition

public long getStartPosition ()

Return the position in milliseconds at which the playback will start.

Returns
long the position in milliseconds at which the playback will start

getType

public int getType ()

Return the type of data source.

Returns
int the type of data source

getUri

public Uri getUri ()

Return the Uri of this data source. It's meaningful only when getType returns TYPE_URI.

Returns
Uri the Uri of this data source

getUriContext

public Context getUriContext ()

Return the Context used for resolving the Uri of this data source. It's meaningful only when getType returns TYPE_URI.

Returns
Context the Context used for resolving the Uri of this data source

getUriCookies

public List<HttpCookie> getUriCookies ()

Return the Uri cookies of this data source. It's meaningful only when getType returns TYPE_URI.

Returns
List<HttpCookie> the Uri cookies of this data source

getUriHeaders

public Map<String, String> getUriHeaders ()

Return the Uri headers of this data source. It's meaningful only when getType returns TYPE_URI.

Returns
Map<String, String> the Uri headers of this data source