接入步骤
1.在pubspec.yaml中添加依赖.
audio_player: path: audio_player
2.打开项目目录下的android/build.gradle文件,添加内部maven仓库地址。
allprojects {
repositories {
...//已有仓库
//内部maven仓库
maven { url 'http://maven.wosai-inc.com/nexus/content/groups/public/'
allowInsecureProtocol = true}
maven { url 'http://nexus.wosai-inc.com/nexus/content/repositories/snapshots/'
allowInsecureProtocol = true}
} }
3.运行flutter pub get拉取插件。
4.使用。
4.1 项目启动初始化音频。
AudioPlayer.instance.bindPlayerAudio();
4.2 启用音频。
AudioPlayer.instance.setPlayEnable(true);
4.3 播放音频,支持按队列播放。
AudioPlayer.instance.playAudio("50");
4.4 解绑操作。
AudioPlayer.instance.unBindPlayerAudio();