Class RawResourceDataSource

  • All Implemented Interfaces:
    DataReader, DataSource

    @Deprecated
    public final class RawResourceDataSource
    extends BaseDataSource
    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 DataSource for reading a raw resource inside the APK.

    URIs supported by this source are of one of the forms:

    • rawresource:///id, where id is the integer identifier of a raw resource.
    • android.resource:///id, where id is the integer identifier of a raw resource.
    • android.resource://[package]/[type/]name, where package is the name of the package in which the resource is located, type is the resource type and name is the resource name. The package and the type are optional. Their default value is the package of this application and "raw", respectively. Using the two other forms is more efficient.

    buildRawResourceUri(int) can be used to build supported Uris.