提升效能和可靠性的最佳做法
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
媒體應用程式需要大量資源,包括記憶體、CPU、網路連線和硬體轉碼器,其中許多資源都處於短期供應狀態。此外,應用程式必須穩定地管理與其他應用程式的互動,例如控制器應用程式會傳送播放指令要求,或是在系統其他位置啟動媒體播放作業。本節將討論最佳做法,確保使用者能依賴您的應用程式效能符合預期。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[[["容易理解","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-26 (世界標準時間)。"],[],[],null,["# Best practices for performance and reliability\n\nMedia apps can demand a lot of resources including memory, CPU, network\nconnections and hardware codecs, many of which are in short supply.\nIn addition, apps have to reliably manage interacting with other apps, such as\ncontroller apps sending playback command requests or media playback starting\nelsewhere in the system. This section discusses best practices for making sure\nthat users can rely on your app to perform well and as expected.\n\n- Use testing tools like the [Media Controller Test app](/media/optimize/mct) to validate your playback use-cases\n- Use a device's [performance class](/topic/performance/performance-class) level to accurately gauge device capabilities\n- Cooperate with other apps to [manage audio focus](/media/optimize/audio-focus)\n- [Measure](/media/optimize/performance/measure) your app's performance and make decisions accordingly\n- Maintain high quality when preparing to [share videos](/media/optimize/sharing)"]]