評估成效
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
在 Android 8.0 (API 級別 26) 以上版本中,部分媒體類別可以使用 getMetrics()
方法。這個方法會傳回包含設定和效能資訊的 PersistableBundle
物件,並以屬性和值對應的方式表示。已針對以下媒體類別定義 getMetrics()
方法:
系統會針對每個執行個體分別收集指標,並在執行個體的生命週期中保留指標。如果沒有可用的指標,這個方法會傳回空值。實際傳回的指標取決於 類別。
使用 ExoPlayer 分析功能
ExoPlayer 提供多項工具,可協助您收集及處理播放資料。詳情請參閱數據分析的開發人員指南。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],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)."]]