audio_manager 0.0.1 audio_manager: ^0.0.1 copied to clipboard
A flutter plugin for music playback, including notification handling.
audio_manager #
A flutter plugin for music playback, including notification handling.
iOS #
在info.plist
文件中添加以下权限
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Android #
Since Android9.0 (API 28)
, the application disables HTTP plaintext requests by default. To allow requests, add android: usesCleartextTraffic =" true "
in AndroidManifest.xml
<application
...
android:usesCleartextTraffic="true"
...
>
How to use? #
The audio_manager
plugin is developed in singleton mode. You only need to get AudioManager.instance
in the method to quickly start using it.
Quick start #
⚠️ you can use local assets
resources or network
resources
AudioManager.instance
.start(
"assets/audio.mp3",
// "network mp3 resource")
"title",
desc: "desc",
cover: "assets/ic_launcher.png",
// cover: "network cover image resource")
.then((err) {
print(err);
});