讓媒體顯示和播放功能更上一層樓:基本、進階和最佳
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本指南將媒體播放為主應用程式從可能的起點到同類最佳的最佳進展情形繪製成圖表。這項功能旨在協助您思考如何隨著時間擴充應用程式,以及何時應導入哪些功能。雖然每個媒體消費應用程式都不同,但建議您參考以下最佳做法,打造一流的使用體驗。
基本媒體顯示和播放應用程式可為使用者提供基礎體驗,可能包括以下操作:
優質的媒體顯示和播放應用程式可利用高級裝置硬體和更新的平台功能,以便:
頂尖的媒體顯示和播放應用程式可讓使用者存取可讓應用程式脫穎而出的進階功能,例如:
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2024-10-15 (世界標準時間)。
[null,null,["上次更新時間:2024-10-15 (世界標準時間)。"],[],[],null,["# Take your media display and playback to the next level — basic, better, and best\n\nThis guide charts the optimal progression of a media playback-focused app from a\nlikely starting place to best-in-class. It's designed to help you think about\nscaling your app over time, and what features to implement when. While every\nmedia consumption app is different, consider these recommendations to achieve a\nbest-in-class experience.\n\nBasic media display and playback\n--------------------------------\n\nA basic media display and playback app provides users with a foundational\nexperience, which may include doing the following:\n\n- Offer an in-app media player using with playback controls, using [formats](/guide/topics/media/media-formats) that are supported across the Android ecosystem, ideally using [Media3s](/guide/topics/media/media3) [ExoPlayer](/guide/topics/media/exoplayer).\n- Use the latest version of the [Jetpack Media3](/guide/topics/media/media3) library.\n- Use optimized server-generated thumbnails as well as [best practices for locally-generated ones](/social-and-messaging/guides/media-thumbnails), and cache them locally.\n- Invest in [accessibility](/guide/topics/ui/accessibility/principles#media-content).\n\nBetter media display and playback\n---------------------------------\n\nA better media display and playback app leverages premium device hardware and\nupdated platform features, to:\n\n- Implement a [`MediaSession`](/guide/topics/media/media3/getting-started/mediasession) --- made easy with [Media3s](/guide/topics/media/media3) [ExoPlayer](/guide/topics/media/exoplayer) --- to enable playback integration across different apps, system components, and devices.\n- Use [best practices for sharing video](/media/optimize/sharing), [transcoding](/media/media3/transformer/transformations#transcode) if necessary.\n- Support [sharing multiple pieces of content](/training/sharing/send#share-multiple-content) at the same time.\n- Enable [picture-in-picture](/develop/ui/views/picture-in-picture) for video and audio playback so users can multitask.\n- Enable support for [UltraHDR](/media/grow/ultra-hdr-display) images.\n- Play [HDR](/media/grow/hdr-playback) video.\n- Support playback to [Cast](https://developers.google.com/cast/docs/developers) devices.\n- Add an [app widget](/develop/ui/views/appwidgets/overview) so users can get see what friends are up to and search from their home screen.\n\nBest media display and playback\n-------------------------------\n\nA best-in-class media display and playback app gives users access to advanced\nfeatures that really make the app stand out, such as:\n\n- Check to see if images contain a [gain-map](/guide/topics/media/platform/hdr-image-format#gain_map-generation), and strategically use [`setColorMode()`](/reference/android/view/Window#setColorMode(int)) to [`ActivityInfo.COLOR_MODE_HDR`](/reference/android/content/pm/ActivityInfo#COLOR_MODE_HDR) to optimize for content display and battery life.\n- Optimize for foldables by supporting the [`HALF_OPENED` state](/develop/ui/compose/layouts/adaptive/foldables/learn-about-foldables#foldable_postures)\n- Ensure [design](/design/ui) consistency with the platform.\n- Implement [Cast Connect](https://developers.google.com/cast/docs/android_tv_receiver) so users can cast to your [Android TV](/training/tv) app.\n- Use [Performance Class](/topic/performance/performance-class) to adapt your user experience to match device capabilities."]]