自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
總覽
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Media 提供平台,可用於建構媒體應用程式,在所有支援 Android 的車輛中提供安全、順暢且連線的資訊娛樂體驗。Media 是 Android 系統應用程式,旨在為媒體應用程式提供分心程度最佳化 (DO) 的播放和瀏覽體驗。Android 開放原始碼計畫 (AOSP) 包含了功能完整的 Media 實作項目。
圖 1. 媒體畫面範例實作。
如要瞭解媒體,請參閱下列頁面:
- 系統元件和使用者流程。
進一步瞭解與媒體互動的元件,以及最常見的使用者流程。
- 使用媒體實作電台。瞭解如何將 Radio UI 與媒體整合,讓使用者能與媒體來源和收音機互動,就像使用單一應用程式一樣。
- 自訂媒體。
瞭解如何使用在 AOSP 結構體中不同層級定義的樣式和資產。
- 實作媒體資訊卡。實作媒體資訊卡,以便顯示媒體中繼資料,例如標題、專輯封面等。媒體資訊卡也可以顯示媒體項目的佇列,例如播放清單。
術語
本節會使用這些術語。
媒體來源
實作 Android MediaBrowserService API 的 Android 應用程式,可公開媒體項目目錄的播放控制項和瀏覽功能。
媒體項目
媒體來源目錄中的元素。媒體項目可以是下列任一項:
- 可播放的媒體項目。系統可播放的音訊片段,例如歌曲、書籍章節和 Podcast 單集
- 可瀏覽的媒體項目。用於將可播放或其他可瀏覽的媒體項目 (例如歌曲類別、最近的歌曲資料夾) 分組的組織元素,以及以藝人、作者或觀眾分類的 Podcast 和可播放的媒體項目。
媒體提供這些功能。
行車期間 |
車輛停妥時 |
---|
播放控制項。
-
目前播放的媒體項目 (例如歌曲) 的呈現方式,包括標題、專輯封面、時間長度、說明和目前播放位置。
-
執行標準媒體動作 (例如播放、停止、暫停和快轉)。
-
執行自訂媒體動作 (各個媒體來源提供的自訂動作)。
-
呈現媒體應用程式提供的播放佇列。
目錄瀏覽。
|
行車期間下列所有功能,以及:
|
Tasks
下表說明各方的任務。
車輛製造商 (vOEM) |
Google |
應用程式開發人員 |
---|
- 使用 Android Automotive 建構完全符合規定的 Android CDD 資訊娛樂系統。
- 滿足 MediaSession 和 Browser API 的所有預期,以及與 Media 的互通性:
- 遵守瀏覽結構。
- 遵守自訂動作。
- 將登入、設定等工作委派給應用程式。
- 請遵守 API 明確支援的應用程式品牌元素。例如應用程式名稱。
|
- 定義及改進 Media API。
- 在 Android 開放原始碼計畫中提供媒體實作項目。
- 定義在 Play 商店發布媒體應用程式的應用程式審查程序。
- 提供 API、自訂項目、審查和認證程序等元素的文件
|
- 實作 Media API:
- 提供整體媒體瀏覽結構,並附上適當的內容。
- 視情況提供自訂動作。
- 讓系統可以使用播放狀態。
- 提供品牌宣傳元素,例如應用程式名稱。
- 視需要實作登入、註冊、設定和錯誤解決工作流程。
- 建構並發布車輛 APK 至 Play 商店。
|
自訂規範
AOSP 中包含的媒體實作會使用 Car UI 程式庫 啟用自訂功能,並提供可直接採用或根據下列限制修改的基本主題和結構。下表說明 OEM 在媒體自訂功能方面的責任。
媒體自訂 |
說明 |
---|
SHOULD |
調整整體主題和樣式,包括調色盤和大小。 |
5 月 |
修改媒體的高階結構 (例如分頁位置)。 |
不得 |
修改 Media API 合約,包括應用程式品牌:
- MediaSession 和 MediaBrowser 互通性
- 媒體來源名稱、圖示
修改下列項目的資訊架構:
|
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。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,["# Overview\n\n*Media* provides a platform on which to build media apps that provide safe,\nseamless, and connected infotainment experiences in every Android-enabled car.\nMedia is an Android system application designed to provide a\n[Distraction Optimized (DO)](/docs/automotive/driver_distraction/guidelines) playback\nand browse experience for media apps. A fully functional implementation of Media is included with\n[Android Open Source Project (AOSP)](/).\n\n\n\u003cbr /\u003e\n\n\n**Figure 1.** Media screen sample implementations.\n\nTo learn about Media, see the following pages:\n\n- **[System components and user flows](/docs/automotive/hmi/media/technical_details).** Learn more about the components that interact with Media, as well as the most common user flows.\n- **[Implement radio with media](/docs/automotive/hmi/media/radio).** Read how to integrate the Radio UI with Media to provide enable users to interact with media sources and radio as if they were a single application.\n- **[Customize media](/docs/automotive/hmi/media/customization).** Learn how to work with styles and assets defined at different levels in the AOSP structure.\n- **[Implement a media card](/docs/automotive/hmi/media/media-card).** Implement a media card to display media metadata such as titles, album art, and more. A media card can also display a queue of media items, such as a playlist.\n\nTerminology\n-----------\n\nThese terms are used in this section.\nMedia Source An Android app that implements the Android [MediaBrowserService API](https://developer.android.com/guide/topics/media-apps/audio-app/building-an-audio-app) to expose playback control and browsing of its catalog of media items. Media Item An element in the Media Source catalog. Media items can be either:\n\n- Playable Media items. Audio segments that can be played by the system such as songs, chapters of books, and episodes of podcasts\n- Browsable Media items. Organizational elements used to group playable or other browseable media items such as song categories, a recent songs folder, as well as podcasts and playable media items sorted by artist, author, or audience.\n\nMedia features\n--------------\n\nMedia provides these features.\n\n| While driving | While parked |\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Playback control. - Presentation of currently playing media item (for example, a song), including title, album art, duration, description, and current play position. - Execution of standard media actions (for example, play, stop, pause, and skip forward). - Execution of custom media actions (custom actions provided by each media source). - Presentation of the playback queue, if provided by the media app. Catalog browse. - Display of top-level categories. - Drill down into browse-able media items (for example, folders). - Selection of playable media items (for example, songs) including title, album art, and indicators. For example, explicit content and downloaded content. | Everything listed under *While Driving* as well as: - Sign-in. For those media sources that require sign-in, it should be possible to start the sign in flow directly from Media. - Settings. Media source can display a settings UI. - Search, with keyboard. Users can perform a text search on Media. |\n\nTasks\n-----\n\nThis table describes the tasks of each party.\n\n| Vehicle makers (vOEMs) | Google | App developers |\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| - Build a fully-compliant [Android CDD](/docs/compatibility/10/android-10-cdd) infotainment system with Android Automotive. - Fulfill all expectations of MediaSession and Browser APIs and the interoperability with Media: - Respect browse structure. - Respect custom actions. - Delegate to the app for sign-in, settings, and so on. - Respect the app branding elements explicitly supported by the APIs. For example, the app name. | - Define and evolve Media APIs. - Provide Media implementation in AOSP. - Define app review process for publishing of media apps on Play Store. - Provide documentation for elements such as APIs, customizations, review, and certification processes | - Implement Media APIs: - Provide overall media browse structure with appropriate content. - Provide custom actions as appropriate. - Make playback states available to the system. - Provide branding elements, such as app name. - Implement the sign-in, sign-up, settings, and error resolution flows, as needed. - Build and publish car APKs to the Play Store. |\n\nCustomization guidelines\n------------------------\n\nThe Media implementation included in AOSP uses\n[Car UI Library](/docs/automotive/hmi/car_ui) to enable\ncustomization and provides a base theme and structure that can be adopted as is or modified\naccording to the following restrictions. The following table describes OEM responsibilities\nregarding Media customization.\n\n| Media customization | Description |\n|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| SHOULD | Adjust overall theme and styling, including color pallette and sizing. |\n| MAY | Modify the high-level structure of Media (for example, tab placement). |\n| MUST NOT | Modify Media API contracts, including app branding: - MediaSession and MediaBrowser interoperability - Media source name, icon Modify information architecture of: - Playback - Browse - Search |"]]