# MusicPlayerView **Repository Path**: ts_ohos/music-player-view ## Basic Information - **Project Name**: MusicPlayerView - **Description**: Custom view and progress for music player. - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 1 - **Created**: 2021-07-27 - **Last Updated**: 2025-09-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # MusicPlayerView 本项目是基于开源项目MusicPlayerView进行harmonyos化的移植和开发的,可以通过项目标签以及 [github地址](https://github.com/iammert/musicplayerview). 移植基线版本:源master最新版本 ## 项目介绍 ### 项目名称:musicplayerview ### 所属系列:harmonyos的第三方组件适配移植 ### 功能: Custom music player view. 一个炫酷的自定义UI播放器界面 ### 项目移植状态:完全移植 ### 调用差异:基本没有使用差异,请参照demo使用 ### 原项目Doc地址:https://github.com/iammert/musicplayerview ### 编程语言:java ### 项目截图(涉及文件仅供demo测试使用) ![运行效果](art/art2.gif) ## 安装教程 ### 方法一: 1. 在根目录的`build.gradle`文件中添加`mavenCentral()`: ```groovy // Top-level build file where you can add configuration options common to all sub-projects/modules. ... buildscript { repositories { ... mavenCentral() } ... } allprojects { repositories { ... mavenCentral() } } ``` 2. 在module目录下的`build.gradle`文件中添加 ```groovy dependencies { implementation 'com.gitee.ts_ohos:musicplayerview:1.0.0' } ``` ### 方法二: 可以先下载项目,将项目中的cult库提取出来放在所需项目中通过build配置 ```groovy dependencies { implementation project(":playerview") } ``` # 使用说明(XML) Define it in your xml file. ```xml ``` # 使用说明(Java) ```java DirectionalLayout.LayoutConfig config = new DirectionalLayout.LayoutConfig( DirectionalLayout.LayoutConfig.MATCH_PARENT, DirectionalLayout.LayoutConfig.MATCH_PARENT); MusicPlayerView musicPlayerView = new MusicPlayerView(this); musicPlayerView.setLayoutConfig(config); myLayout=(DirectionalLayout)findComponentById(ResourceTable.Id_content); myLayout.addComponent(musicPlayerView); PlaypauseView playpauseView=new PlaypauseView(this); DependentLayout.LayoutConfig config2 = new DependentLayout.LayoutConfig( DependentLayout.LayoutConfig.MATCH_PARENT, DependentLayout.LayoutConfig.MATCH_PARENT); config2.addRule(DependentLayout.LayoutConfig.CENTER_IN_PARENT); playpauseView.setLayoutConfig(config2); myLayout2=(DependentLayout)findComponentById(ResourceTable.Id_contentBt); myLayout2.addComponent(playpauseView); playpauseView.setMusicPlayerView(musicPlayerView); ``` Start and stop depends on your player. ```java musicPlayerView.start(); musicPlayerView.stop(); ``` License -------- Copyright 2015 Mert Şimşek. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.