# VideoPlayer **Repository Path**: harmonyos_samples/video-player ## Basic Information - **Project Name**: VideoPlayer - **Description**: 本示例主要展示通过HarmonyOS提供的系统播放器AVPlayer和媒体会话等能力,实现视频类应用的开发。 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 35 - **Forks**: 20 - **Created**: 2024-09-12 - **Last Updated**: 2025-10-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Video Player ### Overview This sample demonstrates how to develop a video app using the AVPlayer and AVSession capabilities provided by HarmonyOS. ### Preview ### How to Use 1. After the app is launched, the video playlist is displayed and the first video is automatically played. 2. Touch the button on the screen to switch between portrait and landscape modes. 3. Swipe up or down to switch between videos, and view historical playback records. 4. Drag the progress bar or swipe in full-screen mode to adjust the playback progress. 5. When the app is switched to the background, the playback can continue. You can control the playback in the Media Controller. ### Project Directory ``` ├──entry/src/main/ets │ ├──entryability │ │ └──EntryAbility.ets // Entry ability │ ├──model │ │ ├──BasicDataSource.ets // Lazy loading data sources │ │ └──DataModel.ets // Data classes │ ├──pages │ │ └──IndexPage.ets // Home page │ ├──utils │ │ ├──WindowUtil.ets // Window utility class │ │ └──BreakpointSystem.ets // Breakpoint utility class │ └──view │ ├──AVPlayer.ets // Video component │ ├──VideoList.ets // Video list on the home page │ ├──VideoSide.ets // Video swiper components │ └──VideoDetails.ets // Video details components ├──entry/src/main/resources // Static resources └──MediaService/src/main/ets │ ├──common │ │ └──CommonConstants.ets // Common constants │ ├──controller │ │ ├──AvPlayerController.ets // Video playback control │ │ ├──AvSessionController.ets // AVSession control │ ├──model │ │ └──VideoData.ets // Video data class │ └──utils │ ├──BackgroundTaskManager.etss // Background playback │ ├──CommUtils.ets // Utility class │ └──Logger.ets // Image pixel processing class └──MediaService/src/main/resources // Log utility ``` ### Required Permissions 1. **ohos.permission.KEEP_BACKGROUND_RUNNING**: allows an app to run in the background. 2. **ohos.permission.INTERNET**: allows an app to access the Internet. ### Constraints 1. The sample is only supported on Huawei phones with standard systems. 2. The HarmonyOS version must be HarmonyOS 6.0.0 Release or later. 3. The DevEco Studio version must be DevEco Studio 6.0.0 Release or later. 4. The HarmonyOS SDK version must be HarmonyOS 6.0.0 Release SDK or later.