让媒体显示和播放效果更上一层楼 - 基本、更好、最佳
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本指南介绍了从可能的起点到同类最佳的最佳演变路线,以帮助您打造专注于媒体播放的应用。它旨在帮助您思考
随时间推移扩缩应用规模,以及应在何时实现哪些功能。虽然每
媒体消费应用有所不同,请考虑以下建议来实现
卓越的体验
基本的媒体显示和播放应用可为用户提供
其中可能包括执行以下操作:
优质的媒体显示和播放应用利用优质的设备硬件和
更新了平台功能,以便:
一流的媒体显示和播放应用可让用户访问
让该应用真正脱颖而出的功能,例如:
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-10-15。
[null,null,["最后更新时间 (UTC):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."]]