VLC 适用于在 Android TV 上将用户的个人视频投放到大屏幕上
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。

VLC 是由 VideoLAN 项目组开发的一款免费、开源的跨平台多媒体播放器,致力于让用户能够使用各种类型或屏幕尺寸的设备随时随地播放任何类型的视频文件。为了让尽可能多的用户获享最佳观看体验,VideoLAN 团队一直致力于让 VLC 应用能够适用于各种平台,包括 Android TV 以及平板电脑和 Chromebook 等大屏幕设备。
策略
与移动设备上的应用相比,Android TV 设备上的应用提供了独特的观看体验。电视观看者坐得离屏幕较远,而且通常希望在一个视图(例如传统的电视节目表)中查看其整个内容库,而移动应用用户则希望只看到他们选择观看的那一个视频。此外,Android TV 用户还可以通过遥控器浏览应用,而移动应用则纯粹借助触摸屏。
虽然 VideoLAN 决定在最新版应用(3.2 版)中保留 VLC 的大部分移动版界面,但该团队还需要采取进一步措施,以确保移动设备用户和 Android TV 用户都能获享最佳体验。
针对 TV 遥控器进行优化
首先,VideoLAN 要确保用户能够使用遥控器在 Android TV 设备上轻松浏览应用的视频播放器界面,而 Android TV 设备只有方向键和几个按钮。例如,该团队将视频播放器的选项移到了侧边栏,这样既可以在智能手机或平板电脑上轻松点击完整的节目列表,也可以使用遥控器轻松进行浏览。
调整 Leanback 库的布局
在 Android TV 设备上,VLC 用户可以一目了然地看到所有视频类别,而不是像在移动设备上那样汇总类别。为了针对这种浏览功能进行优化,Leanback 库使用可扩展的 Fragment,让开发者能够为每段内容轻松打造丰富的动画体验。
VideoLAN 创建了一个自定义浏览界面,支持通过悬浮操作按钮进行排序和滚动,并为每个滚动选项添加了动画。该团队还开发了一项快速滚动功能,该功能类似于其 Android Auto 应用,可让用户利用首字母搜索功能快速浏览其视频内容,而无需滚动整个列表。
实现 Android TV 的全新界面需要大量的代码重构 - 在此过程中,由 Android 的架构组件提供的 Model-View-ViewModel (MVVM) 架构正好派上用场。通过遵循这些架构准则,该团队能够明确区分界面代码和应用逻辑,从而简化了编写新界面后应用逻辑代码的共享流程。现在,VLC 的移动设备界面和电视界面采用同样的代码。
该团队还利用 Livedata 转换技术创建了一张图,其中的元素从他们在移动设备上使用的唯一列表开始,按照视频信息(如标题、添加日期或视频时长)进行分组。由于 Android TV 以横屏模式播放视频,因此该团队将内容拆分为若干行,而不是将内容收录在一个可滚动的垂直列表中。
集成语音控制和“接下来播放”功能
最后,VideoLAN 实现了 MediaSession,以便通过 Google 助理启用语音指令播放控制。此外,该团队还在 TV 应用的代码中添加了“接下来播放”功能,让用户能够直接从 Android TV 主屏幕继续播放以前播放的视频。
成果
VLC 是一款可轻松导航的免费媒体播放器,非常适合在较大屏幕上使用。VideoLAN 团队不断收到世界各地用户的正面反馈,法国和瑞士的互联网服务提供商甚至还要求在机顶盒中添加 VLC 作为默认应用。
“提到 VCL 之类的媒体播放器,我们自然会想到其适合在电视上使用,所以我们知道有许多人愿意在 Android TV 上使用该应用,”VideoLAN 总裁 Jean-Baptiste Kempf 说道,“它实际上是我们可以优化的最简单的平台,因为我们能够重复利用 95% 的 Android 代码,而且我们对结果也甚为满意。”
VideoLAN 开发了一款既能在小屏幕智能手机上使用、又能在大屏幕电视设备上使用的应用,已做好准备吸引更多移动用户,让他们能够随时随地观看自己喜爱的视频。
开始使用
请查看针对 Android TV 优化您的应用的一些最佳做法。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):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"]],["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# VLC adapts for Android TV to bring users’ personal videos to the big screen\n\n[VLC](https://www.videolan.org/vlc/index.html)---a free, open\nsource cross-platform multimedia player developed by the\n[VideoLAN project](https://www.videolan.org/)---is rooted in\ngiving users the power to play any type of video file anywhere, no matter their\ndevice or screen size. To deliver an optimal viewing experience to as many\nusers as possible, the VideoLAN team has worked hard to adapt the VLC app for\na variety of platforms, including Android TV and large-screen devices like\n[tablets and Chromebooks](https://developer.android.com/stories/apps/vlc).\n\nWhat they did\n-------------\n\nApps on Android TV devices offer a unique viewing experience compared with apps\non mobile devices. TV viewers sit farther from the screen, and they also\ntypically expect to see their entire content library in a single view---like a\ntraditional TV guide---while mobile users expect to see only the one video they\nchose to watch. Plus, users navigate apps on Android TV via remote control\nwhile the mobile apps are purely touchscreen.\n\nWhile VideoLAN decided to retain most of VLC's mobile UI in the latest version\nof the app ([3.2](https://geoffreymetais.github.io/features/vlc-32/#)),\nthe team needed to go a few steps further to ensure an optimal experience on\nboth mobile and Android TV.\n\n### Optimizing for TV remote controls\n\nVideoLAN's first step was to ensure the app's video player UI would be easily\nnavigable using remote controls from Android TV devices, which only has a\ndirectional pad and a few buttons. For instance, the team moved the video\nplayer options to a side panel so the full list would be easy to click on a\nsmartphone or tablet and easy to browse with a remote. \n\n### Tweaking the layout for Leanback Library\n\nOn Android TV devices, VLC users can see all their video categories at once,\nrather than aggregating categories as on mobile. To optimize for this browsing\nfeature, the [Leanback Library](https://codelabs.developers.google.com/codelabs/androidtv-adding-leanback/index.html#0)\nuses extendable fragments to allow developers to easily create rich, animated\nexperiences for each piece of content.\n\nVideoLAN created a custom browsing UI to enable sorting and scrolling with a\n[Floating Action Button](https://material.io/components/buttons-floating-action-button/)\nand added animations for each scrolling option. The team also created a quick\nscroll feature similar to their Android Auto app that allows users to quickly\nbrowse their video content using first-letter searches, rather than needing to\nscroll the entire list.\n\nImplementing an entirely new UI for Android TV led to a decent amount of code\nrefactorization---that's where the Model-View-ViewModel (MVVM) architecture\nproposed by [Android's architecture components](https://developer.android.com/topic/libraries/architecture)\ncame in handy. By following these [architectural guidelines](https://developer.android.com/jetpack/docs/guide),\nthe team was able to create a clear separation between UI code and app logic,\nwhich simplified the sharing of the app logic code once the new UI was written.\nNow, the same code powers VLC's mobile and TV UI.\n\nThe team also worked with [Livedata transformations](https://developer.android.com/topic/libraries/architecture/livedata#transform_livedata)\nto create a map with elements grouped by video information (such as title, date\nadded or video length) starting from the unique list they used on mobile.\nBecause Android TV displays videos in landscape mode, the team split the\ncontent into several rows rather than featuring them in a vertical, scrollable\nlist.\n\n### Integrating voice controls and \"play next\" feature\n\nFinally, VideoLAN implemented a [MediaSession](https://developer.android.com/guide/topics/media-apps/working-with-a-media-session)\nto enable voice command playback control via the Google Assistant. The team\nalso added a \"play next\" feature to the TV app's code, which allows users to\nresume playback of a previously started video directly from the Android\nTV home screen.\n\nResults\n-------\n\nAs a free and easy-to-navigate media player, VLC is at its best on bigger\nscreens. The VideoLAN team continues to receive positive feedback from users\naround the world, and internet service providers in France and Switzerland have\neven requested to add VLC as a default app on their set-top boxes.\n\n\"TVs are a natural home for a media player like VLC, so we knew there was a\nlarge community of people waiting to use the app on Android TV,\" said\nJean-Baptiste Kempf, VideoLAN's President. \"It was actually the simplest\nplatform to optimize for as we were able to reuse 95% of the code from Android,\nand we've been thrilled with the results.\"\n\nWith an app designed for devices from small-screen smartphones to big-screen\nTVs, VideoLAN is primed to reach more mobile users wherever they prefer to\nwatch their favorite videos.\n\nGetting started\n---------------\n\nCheck out some best practices to [optimize your apps for Android TV](https://developer.android.com/training/tv/start)."]]