Monitor AndroidX Media3 | Mux

Monitor AndroidX Media3

Connect Mux Data to AndroidX Media3 to collect playback performance metrics. Use this guide when your Android application plays video with a Media3 Player, such as ExoPlayer.

In this guide:

  1. Features
  2. Install the Mux Data SDK
  3. Integrate this SDK with Media 3 in your app
  4. Add Metadata
  5. Advanced Features
  6. Migrating from the Mux Data SDK for ExoPlayer
  7. Release notes

Mux Data collects playback performance metrics from AndroidX Media3. Use this guide when your Android application plays video with a Media3 Player and you want to monitor the playback experience of your viewers. You do not need Mux Video to use Mux Data.

The Mux Data SDK for Media3 integrates Mux Data with Google's AndroidX Media3 SDK. This guide will walk you through a basic integration with Mux Data and your Media3 app. You will add the Mux Data SDK to your project, integrate the SDK with your Media3 Player and if necessary, learn to customize our SDK's functionality based on your specific needs.

Features

The following data can be collected by the Mux Data SDK when you use the AndroidX Media3 SDK:
Supported Features:

Notes:
Request Latency is not available.

1. Install the Mux Data SDK

Add our repository to your Gradle project

Add Mux's maven repository to your gradle files. Newer projects require declaring this in settings.gradle, and older projects require it to be set in the project-level build.gradle.

gradle_kts gradle_groovy

Add a dependency for Mux Data

Add our library to the dependencies block for your app. Replace the string [Current Version] with the current version of the SDK from the releases page.

gradle_kts gradle_groovy

Officially Supported Media3 Versions

We try to support all production versions of media3. Currently, we support the following versions:

2. Integrate this SDK with Media 3 in your app

Get your ENV_KEY from the Mux environments dashboard.

Env Key is different than your API token
ENV_KEY is a client-side key used for Mux Data monitoring. These are not to be confused with API tokens which are created in the admin settings dashboard and meant to access the Mux API from a trusted server.

To monitor a Player, monitor it using monitorWithMuxData(). You must initialize your Mux Data integration with a valid Environment Key.

3. Add Metadata

You can make your data more informative and actionable by supplementing it with data of your own. To supply this data, you can use the CustomerData object you created in Step 2.

Those examples contain only a few of the fields available. For more information, see the Metadata Guide.

All metadata details are optional, however you'll be able to compare and see more interesting results as you include more details.

4. Advanced Features

Changing the video

There are two cases where the underlying tracking of the video view needs to be reset: first, when you load a new source URL into an existing player, and second, when the program within a single media stream changes.

5. Migrating from the Mux Data SDK for ExoPlayer

If you are updating from our ExoPlayer SDK, you have to do a short migration. The migration steps below should get you building again:

  1. Change your Mux Data SDK dependency to implementation "com.mux.stats.sdk.muxstats:data-media3:1.0.0"
  2. Change all mentions of MuxStatsExoPlayer to MuxStatsSdkMedia3<ExoPlayer>
  3. If you are using java, add new ExoPlayerBinding() to the end of the parameters you set when creating your muxStats.

6. Release notes

Current release

v1.13.2

Updates:

Previous releases

v1.13.1

Fixes:

v1.13.0

New: