audio_background 1.0.1 copy "audio_background: ^1.0.1" to clipboard
audio_background: ^1.0.1 copied to clipboard

A Flutter plugin for seamless background audio playback on Android and iOS.

audio_background #

A Flutter plugin for seamless background audio playback on Android and iOS. This plugin allows you to play audio from a URL or a local file, and it provides notifications and controls for the audio playback.

Features #

  • Play audio from a URL or a local file.
  • Background audio playback.
  • Media controls in the notification.
  • Support for Android and iOS.

Getting Started #

To use this plugin, add audio_background as a dependency in your pubspec.yaml file.

Usage #

Here's a simple example of how to use the audio_background plugin to play an audio file:

import 'package:flutter/material.dart';
import 'package:audio_background/audio_background.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    AudioBackgroundService.initialize();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Audio Background Example'),
        ),
        body: Center(
          child: ElevatedButton(
            onPressed: () {
              AudioBackgroundService.play(MediaItem(
                title: 'Test Title',
                artist: 'Test Artist',
                url: 'https://example.com/audio.mp3',
              ));
            },
            child: const Text('Play Audio'),
          ),
        ),
      ),
    );
  }
}

For more detailed examples, see the example directory.

0
likes
145
points
13
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for seamless background audio playback on Android and iOS.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on audio_background

Packages that implement audio_background