Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

CallbackDataSourceDesc.Builder

public static class CallbackDataSourceDesc.Builder
extends BuilderBase<CallbackDataSourceDesc.Builder>

java.lang.Object
   ↳ android.media.DataSourceDesc.BuilderBase<android.media.CallbackDataSourceDesc.Builder>
     ↳ android.media.CallbackDataSourceDesc.Builder


Builder class for CallbackDataSourceDesc objects.

Here is an example where Builder is used to define the CallbackDataSourceDesc to be used by a MediaPlayer2 instance:

 CallbackDataSourceDesc newDSD = new CallbackDataSourceDesc.Builder()
         .setDataSource(media2DataSource)
         .setStartPosition(1000)
         .setEndPosition(15000)
         .build();
 mediaplayer2.setDataSourceDesc(newDSD);
 

Summary

Public constructors

CallbackDataSourceDesc.Builder()

Constructs a new Builder with the defaults.

CallbackDataSourceDesc.Builder(CallbackDataSourceDesc dsd)

Constructs a new Builder from a given CallbackDataSourceDesc instance

Public methods

CallbackDataSourceDesc build()

Combines all of the fields that have been set and return a new CallbackDataSourceDesc object.

CallbackDataSourceDesc.Builder setDataSource(DataSourceCallback dscb)

Sets the data source (DataSourceCallback) to use.

Inherited methods

Public constructors

CallbackDataSourceDesc.Builder

public CallbackDataSourceDesc.Builder ()

Constructs a new Builder with the defaults.

CallbackDataSourceDesc.Builder

public CallbackDataSourceDesc.Builder (CallbackDataSourceDesc dsd)

Constructs a new Builder from a given CallbackDataSourceDesc instance

Parameters
dsd CallbackDataSourceDesc: the CallbackDataSourceDesc object whose data will be reused in the new Builder.

Public methods

build

public CallbackDataSourceDesc build ()

Combines all of the fields that have been set and return a new CallbackDataSourceDesc object. IllegalStateException will be thrown if there is conflict between fields.

Returns
CallbackDataSourceDesc a new CallbackDataSourceDesc object This value will never be null.

setDataSource

public CallbackDataSourceDesc.Builder setDataSource (DataSourceCallback dscb)

Sets the data source (DataSourceCallback) to use.

Parameters
dscb DataSourceCallback: the DataSourceCallback for the media to play This value must never be null.

Returns
CallbackDataSourceDesc.Builder the same Builder instance.

Throws
NullPointerException if dscb is null.