# AudioDemo
**Repository Path**: oc_wind/audio-demo
## Basic Information
- **Project Name**: AudioDemo
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 1
- **Forks**: 1
- **Created**: 2021-09-09
- **Last Updated**: 2022-03-30
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# AudioDemo
本项目是基于开源项目ExoPlayer进行OHOS化的移植和开发的,可以通过项目标签以及
[github地址](https://github.com/google/ExoPlayer)
移植版本:源master r2.15.1 版本
## 项目介绍
### 项目名称:AudioDemo
### 所属系列:OHOS的第三方组件适配移植
### 功能:
音频播放demo。
### 项目移植状态:部分功能
只移植了音频模块
### 调用差异:只能够使用音频模块
### 原项目Doc地址:https://github.com/google/ExoPlayer
### 编程语言:java
### 项目截图(涉及文件仅供demo测试使用)


## 安装教程
#### 方案一
可以先下载项目,将项目中的audio_library库提取出来放在所需项目中通过build配置
```Java
dependencies {
implementation project(path: ':audio_library')
}
```
#### 方案二
- 1.项目根目录的build.gradle中的repositories添加:
```groovy
buildscript {
repositories {
...
mavenCentral()
}
...
}
allprojects {
repositories {
...
mavenCentral()
}
}
```
- 2.开发者在自己的项目中添加依赖
```groovy
dependencies {
implementation 'com.gitee.ts_ohos:audio_library:1.0.0'
}
```
# How to use
// 设置loading布局
// 设置控制布局
// 加载音频
player = new SimpleExoPlayer.Builder(this)
.setAudioSourceFactory(new AudioSourceFactory(this, mUrl))
.create();
player.play();
// 将音频绑定布局
if (findComponentById(ResourceTable.Id_controller_view) instanceof SimplePlayerController) {
controllerView = (SimplePlayerController) findComponentById(ResourceTable.Id_controller_view);
}
controllerView.bind(player);