VLC 配合 Android TV 進行調整,將使用者的個人影片帶到大螢幕
透過集合功能整理內容
你可以依據偏好儲存及分類內容。

VLC 是由 VideoLAN 專案開發的免費開放原始碼跨平台多媒體播放器,可讓使用者隨時隨地播放任何類型的影片檔案,而不受裝置或螢幕大小的影響。為了盡可能為更多使用者提供最佳觀看體驗,VideoLAN 團隊一直努力配合各種平台調整 VLC 應用程式,包括 Android TV 以及平板電腦和 Chromebook 等大螢幕裝置。
具體措施
與行動裝置上的應用程式相比,Android TV 裝置上的應用程式可提供獨特的觀看體驗。電視觀眾靠近螢幕,通常也希望單一畫面 (例如傳統電視節目表) 會顯示整個內容庫,而行動裝置使用者則希望只看到自己選擇觀看的影片。此外,當行動應用程式只有觸控螢幕時,使用者可透過遙控器瀏覽 Android TV 上的應用程式。
雖然 VideoLAN 決定在最新版本的應用程式 (3.2) 中保留大部分的 VLC 行動裝置 UI,但團隊必須更進一步採取幾個步驟,確保在行動裝置和 Android TV 上都能享有最佳體驗。
針對電視遙控器進行最佳化
VideoLAN 的第一步是確保可透過 Android TV 裝置的遙控器,輕鬆瀏覽應用程式的影片播放器 UI,而此裝置僅有方向鍵和幾個按鈕。舉例來說,我們的團隊已將影片播放器選項移至側邊面板,方便使用者在智慧型手機或平板電腦中點選完整清單,並透過遙控器輕鬆瀏覽內容。
調整 Leanback 程式庫的版面配置
在 Android TV 裝置上,VLC 使用者可以一次查看所有影片類別,而不是像行動裝置一樣匯總各種類別。為了對這項瀏覽功能進行最佳化,Leanback 程式庫使用擴充的片段,可讓開發人員輕鬆為每項內容建立豐富的動畫體驗。
VideoLAN 建立自訂瀏覽 UI,利用懸浮動作按鈕提供排序和捲動功能,並為每個捲動選項加入動畫。團隊也建立了類似於 Android Auto 應用程式的快速捲動功能,可讓使用者透過第一字母搜尋快速瀏覽影片內容,而無需捲動整個清單。
為 Android TV 實作全新的 UI 導致程式碼重構不少,這是 Android 架構元件建議採用的 Model-View-ViewModel (MVVM) 架構。根據這些架構指南,該團隊能夠清楚區分 UI 程式碼和應用程式邏輯,從而簡化了編寫新版 UI 後的應用程式邏輯程式碼共用。現在,同樣的程式碼也能支援 VLC 的行動和電視使用者介面。
團隊也與 Livedata 轉換合作,根據使用者在行動裝置上使用的專屬清單,將元素依影片資訊分組 (例如標題、加入日期或影片長度) 建立地圖。由於 Android TV 以橫向模式顯示影片,因此團隊會將內容分割成數列,而非在垂直捲動式清單中主打影片。
整合語音控制和「播放下一首」功能
最後,VideoLAN 導入了 MediaSession,以透過 Google 助理啟用語音指令播放控制項。該團隊也在 TV 應用程式的程式碼中加入了「播放下一集」功能,讓使用者直接從 Android TV 主畫面繼續播放先前開始播放的影片。
成果
VLC 是免費又易於瀏覽的媒體播放器,最適合在大螢幕上使用。VideoLAN 團隊持續收到全球使用者的意見回饋,而法國和瑞士的網際網路服務供應商甚至要求將 VLC 新增為機上盒上的預設應用程式。
VideoLAN 總裁 Jean-Baptiste Kempf 表示:「電視是 VLC 等媒體播放器的天然聚集地,因此我們很清楚 Android TV 有龐大的使用者社群等待使用這個應用程式。我們能夠重複使用 Android 中 95% 的程式碼,因此這是最簡單的最佳化平台,成效非常好。」
VideoLAN 有專為裝置設計的應用程式,從小螢幕智慧型手機到大螢幕裝置都經過精心設計,可幫助更多行動使用者隨時隨地觀看喜愛的影片。
入門
請參閱針對 Android TV 最佳化應用程式的最佳做法。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。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,["# 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)."]]