Skip to content
pubscout

just_audio_background

0.0.1-beta.17, released 2 years ago by ryanheise.com

Adds background playback and media controls to a just_audio player

Quiet but busy
$ flutter pub add just_audio_background
Source repository

What it does

It plugs into just_audio to enable background playback, media notifications, lock‑screen controls and remote button handling across Android, iOS, web and macOS. The package handles the platform‑specific setup and exposes a simple API for initializing the background service.

AI-written summary of version 0.0.1-beta.17, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You have a single AudioPlayer instance and want background playback with standard media controls
  • You need quick integration without writing custom audio_service code

Skip it when

  • Your app requires multiple simultaneous audio players
  • You need fine‑grained control over notification buttons or custom media actions

Strengths

  • Easy to add to existing just_audio projects
  • Cross‑platform support (Android, iOS, web, macOS)
  • Handles notification and remote control plumbing automatically

Weaknesses

  • Limited to one AudioPlayer instance
  • Requires manual Android/iOS manifest changes
  • Not suitable for complex audio service features

Setup

Kind
Flutter widgets
Effort
Medium
Code generation
No
Direct dependencies
6

Android: add WAKE_LOCK, FOREGROUND_SERVICE, optionally FOREGROUND_SERVICE_MEDIA_PLAYBACK permissions; add AudioServiceActivity, AudioService, MediaButtonReceiver to AndroidManifest. iOS: add UIBackgroundModes audio to Info.plist. No build_runner needed.

```dart
Future<void> main() async {
  await JustAudioBackground.init(
    androidNotificationChannelId: 'com.example.channel.audio',
    androidNotificationChannelName: 'Audio playback',
    androidNotificationOngoing: true,
  );
  runApp(MyApp());
}
```

Alternatives

Packages that do the same job and could replace just_audio_background.

Works with

Packages commonly used together with just_audio_background: ones it builds on, ones built on it, and its own family.