影片應用程式總覽
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
一般的影片播放器會在執行期間一律顯示其控制項和影片內容;不能在背景中運作,或是沒有 UI 時才能運作。因此,建議您將應用程式建構為單一活動,包含 UI、播放器、媒體工作階段和媒體控制器:

- 建立影片播放器活動
- 如何建立包含媒體工作階段和媒體控制器的活動。
- 媒體工作階段回呼
- 說明媒體工作階段回呼方法如何管理媒體工作階段,以及通知和廣播接收器等其他應用程式元件。
- 相容媒體轉碼
- 設定轉碼行為,例如當應用程式開啟不支援初始編碼格式時,是否要自動將影片轉換為 AVC (H.264)。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[[["容易理解","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-26 (世界標準時間)。"],[],[],null,["# Video app overview\n\nA typical video player always displays its controls and video content while it's\nrunning; it can't operate in the background or without a UI. Therefore, it's\nappropriate to build your app as a single activity containing the UI, a player,\na media session, and a media controller:\n\n**[Building a videoplayer activity](/guide/topics/media-apps/video-app/building-a-video-player-activity)**\n: How to create an activity that contains a media session and a media controller.\n\n**[Media session callbacks](/guide/topics/media-apps/video-app/mediasession-callbacks)**\n: Describes how the media session callback methods manage the media session and other app components like notifications and broadcast receivers.\n\n**[Compatible media transcoding](/guide/topics/media-apps/video-app/compatible-media-transcoding)**\n: Set up transcoding behavior, such as whether to automatically convert\n videos to AVC (H.264) when they are opened by an app that doesn't support\n the initial encoding format."]]