audio_manager 0.5.1+5 copy "audio_manager: ^0.5.1+5" to clipboard
audio_manager: ^0.5.1+5 copied to clipboard

outdated

A flutter plugin for music playback, including notification handling.

audio_manager #

pub package

A flutter plugin for music playback, including notification handling.

This plugin is developed for iOS based on AVPlayer, while android is based on mediaplayer

The example app running in AndroidThe example app running in iOS

iOS #

Add the following permissions in the info.plist file

	<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"
	...
>

Android minimum support version 23 (build.gradle -> minSdkVersion: 23)

How to use? #

The audio_manager plugin is developed in singleton mode. You only need to getAudioManager.instance in the method to quickly start using it.

Quick start #

⚠️ you can use local assets, network or directory file resources

// Initial playback. Preloaded playback information
AudioManager.instance
	.start(
		"assets/audio.mp3",
		// "network format resource"
		// "local resource (file://${file.path})"
		"title",
		desc: "desc",
		cover: "assets/ic_launcher.png",
		// cover: "network cover image resource")
	.then((err) {
	print(err);
});

// Play or pause; that is, pause if currently playing, otherwise play
AudioManager.instance.playOrPause()

// events callback
AudioManager.instance.onEvents((events, args) {
	print("$events, $args");
}
147
likes
0
points
200
downloads

Publisher

unverified uploader

Weekly Downloads

A flutter plugin for music playback, including notification handling.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on audio_manager