Media3

Support libraries for media use cases.
Latest Update Current Stable Release Next Release Candidate Beta Release Alpha Release
October 27, 2021 - - - 1.0.0-alpha01

Declaring dependencies

To add a dependency on Media3, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

Groovy

dependencies {
    val media3_version = "1.0.0-alpha01"

    // For media playback using ExoPlayer
    implementation "androidx.media3:media3-exoplayer:$media3_version"

    // For DASH playback support with ExoPlayer
    implementation "androidx.media3:media3-exoplayer-dash:$media3_version"
    // For HLS playback support with ExoPlayer
    implementation "androidx.media3:media3-exoplayer-hls:$media3_version"
    // For RTSP playback support with ExoPlayer
    implementation "androidx.media3:media3-exoplayer-rtsp:$media3_version"
    // For ad insertion using the Interactive Media Ads SDK with ExoPlayer
    implementation "androidx.media3:media3-exoplayer-ima:$media3_version"

    // For loading data using the Cronet network stack
    implementation "androidx.media3:media3-datasource-cronet:$media3_version"
    // For loading data using the OkHttp network stack
    implementation "androidx.media3:media3-datasource-okhttp:$media3_version"
    // For loading data using librtmp
    implementation "androidx.media3:media3-datasource-rtmp:$media3_version"

    // For building media playback UIs
    implementation "androidx.media3:media3-ui:$media3_version"
    // For building media playback UIs for Android TV using the Jetpack Leanback library
    implementation "androidx.media3:media3-ui-leanback:$media3_version"

    // For exposing and controlling media sessions
    implementation "androidx.media3:media3-session:$media3_version"

    // For extracting data from media containers
    implementation "androidx.media3:media3-extractor:$media3_version"

    // For integrating with Cast
    implementation "androidx.media3:media3-cast:$media3_version"

    // For scheduling background operations using Jetpack Work's WorkManager with ExoPlayer
    implementation "androidx.media3:media3-exoplayer-workmanager:$media3_version"

    // For transforming media files
    implementation "androidx.media3:media3-transformer:$media3_version"

    // Utilities for testing media components (including ExoPlayer components)
    implementation "androidx.media3:media3-test-utils:$media3_version"
    // Utilities for testing media components (including ExoPlayer components) via Robolectric
    implementation "androidx.media3:media3-test-utils-robolectric:$media3_version"

    // Common functionality for media database components
    implementation "androidx.media3:media3-database:$media3_version"
    // Common functionality for media decoders
    implementation "androidx.media3:media3-decoder:$media3_version"
    // Common functionality for loading data
    implementation "androidx.media3:media3-datasource:$media3_version"
    // Common functionality used across multiple media libraries
    implementation "androidx.media3:media3-common:$media3_version"
}

Kotlin

dependencies {
    val media3_version = "1.0.0-alpha01"

    // For media playback using ExoPlayer
    implementation("androidx.media3:media3-exoplayer:$media3_version")

    // For DASH playback support with ExoPlayer
    implementation("androidx.media3:media3-exoplayer-dash:$media3_version")
    // For HLS playback support with ExoPlayer
    implementation("androidx.media3:media3-exoplayer-hls:$media3_version")
    // For RTSP playback support with ExoPlayer
    implementation("androidx.media3:media3-exoplayer-rtsp:$media3_version")
    // For ad insertion using the Interactive Media Ads SDK with ExoPlayer
    implementation("androidx.media3:media3-exoplayer-ima:$media3_version")

    // For loading data using the Cronet network stack
    implementation("androidx.media3:media3-datasource-cronet:$media3_version")
    // For loading data using the OkHttp network stack
    implementation("androidx.media3:media3-datasource-okhttp:$media3_version")
    // For loading data using librtmp
    implementation("androidx.media3:media3-datasource-rtmp:$media3_version")

    // For building media playback UIs
    implementation("androidx.media3:media3-ui:$media3_version")
    // For building media playback UIs for Android TV using the Jetpack Leanback library
    implementation("androidx.media3:media3-ui-leanback:$media3_version")

    // For exposing and controlling media sessions
    implementation("androidx.media3:media3-session:$media3_version")

    // For extracting data from media containers
    implementation("androidx.media3:media3-extractor:$media3_version")

    // For integrating with Cast
    implementation("androidx.media3:media3-cast:$media3_version")

    // For scheduling background operations using Jetpack Work's WorkManager with ExoPlayer
    implementation("androidx.media3:media3-exoplayer-workmanager:$media3_version")

    // For transforming media files
    implementation("androidx.media3:media3-transformer:$media3_version")

    // Utilities for testing media components (including ExoPlayer components)
    implementation("androidx.media3:media3-test-utils:$media3_version")
    // Utilities for testing media components (including ExoPlayer components) via Robolectric
    implementation("androidx.media3:media3-test-utils-robolectric:$media3_version")

    // Common functionality for media database components
    implementation("androidx.media3:media3-database:$media3_version")
    // Common functionality for media decoders
    implementation("androidx.media3:media3-decoder:$media3_version")
    // Common functionality for loading data
    implementation("androidx.media3:media3-datasource:$media3_version")
    // Common functionality used across multiple media libraries
    implementation("androidx.media3:media3-common:$media3_version")
}

For more information about dependencies, see Add Build Dependencies.

Feedback

Your feedback helps make Jetpack better. You can use the Media3 issue tracker to find answers to questions, known issues and feature requests, and to file new issues.

Version 1.0.0

Version 1.0.0-alpha01

October 27, 2021

androidx.media3:media3-*:1.0.0-alpha01 is released. Version 1.0.0-alpha01 contains these commits.

New features

Media3 is the new home for media support libraries, including ExoPlayer. The first alpha contains early, functional implementations of libraries for implementing media use cases, including: - ExoPlayer, an application-level media player for Android that is easy to customize and extend. - Media session functionality, for exposing and controlling playbacks. This new session module uses the same Player interface as ExoPlayer. - UI components for building media playback user interfaces. - Modules wrapping functionality in other libraries for use with ExoPlayer, for example, ad insertion via the IMA SDK.

For more information, see the Media3 GitHub project.

ExoPlayer was previously hosted in a separate ExoPlayer GitHub project. In Media3 its package name is androidx.media3.exoplayer. We plan to continue to maintain and release the ExoPlayer GitHub project for a while to give apps time to migrate to Media3. Media3 has replacements for all the ExoPlayer modules, except for the legacy media2 and mediasession extensions, which are replaced by the new media3-session module. This provides direct integration between players and media sessions without needing to use an adapter/connector class.