Measuring performance
Stay organized with collections
Save and categorize content based on your preferences.
In Android 8.0 (API level 26) and later, the getMetrics()
method is available
for some media classes. It returns a
PersistableBundle
object containing configuration
and performance information, expressed as a map of attributes and values.
The getMetrics()
method is defined for these media classes:
Metrics are collected separately for each instance and persist for the
lifetime of the instance. If no metrics are available the method returns
null. The actual metrics returned depend on the class.
Analytics with ExoPlayer
ExoPlayer includes tools to help you collect and process playback data. Learn
more in the developer guide for
analytics.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2023-08-23 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-08-23 UTC."],[],[],null,["# Measuring performance\n\nIn Android 8.0 (API level 26) and later, the `getMetrics()` method is available\nfor some media classes. It returns a\n[PersistableBundle](/reference/android/os/PersistableBundle)\nobject containing configuration\nand performance information, expressed as a map of attributes and values.\nThe `getMetrics()` method is defined for these media classes:\n\n- [MediaPlayer.getMetrics()](/reference/android/media/MediaPlayer#getMetrics())\n- [MediaRecorder.getMetrics()](/reference/android/media/MediaRecorder#getMetrics())\n- [MediaCodec.getMetrics()](/reference/android/media/MediaCodec#getMetrics())\n- [MediaExtractor.getMetrics()](/reference/android/media/MediaExtractor#getMetrics())\n\nMetrics are collected separately for each instance and persist for the\nlifetime of the instance. If no metrics are available the method returns\nnull. The actual metrics returned depend on the class.\n\nAnalytics with ExoPlayer\n------------------------\n\nExoPlayer includes tools to help you collect and process playback data. Learn\nmore in the developer guide for\n[analytics](/guide/topics/media/exoplayer/analytics)."]]