Playing Audio and Video
Simple media playback in Android.
Beyond Images: Media Playback
Coil shows images beautifully, but apps also play sound and video: a notification chime, a podcast, a background clip, a video feed. Android has dedicated APIs for media.
The modern recommended library is Media3 (ExoPlayer). It handles streaming, formats, buffering, and playback controls far better than the old MediaPlayer. In this lesson you'll play simple audio and video in a Compose app.
Adding Media3 Dependencies
Media3 is split into modules. For most apps you want media3-exoplayer (the player engine) and media3-ui (ready-made player views). For Compose video you can also use the PlayerView via AndroidView.
// build.gradle.kts (module level)
dependencies {
implementation("androidx.media3:media3-exoplayer:1.5.0")
implementation("androidx.media3:media3-ui:1.5.0")
}All lessons in this course
- Loading Images with Coil
- Placeholders and Error States
- Caching and Performance
- Playing Audio and Video