audio 0.0.5

  • Readme
  • Changelog
  • Example
  • Installing
  • 88

Multi-player audio #

This plugin is under development, this already being used in production. Just make sure you understand what's missing

Example running on Android

Flutter Audio which will both play and record audio (upcoming feature).

(after failed tries trying to work and combine few existing plugins, due the continues issues I had I decided to create this plugin)

The aim of this plugin is really to give a solid solution for audio, feel free to open issues with new requests or pull requests. This is extremely important to have such a plugin that is very activate with updates.

And of course, performance. Even thought this package is offering lots of features. I really care about the performance, so I took a close care of it.

Features #

  • Audio player with support to multiple players simultaneously
  • Buffer updates on the player (percent of the loading whether it's local or remote file)
  • Preload the audio
  • Audio Recorder (upcoming feature)

I'll be adding soon more support, my goal is to make this plugin a complete solution.

0.0.5 #

  • Updated Uuid version to latest

0.0.4 #

  • Fixed gif

0.0.3 #

  • Added gif

0.0.2 #

  • Added LICENSE
  • Added example snippet

0.0.1 #

  • Multiplayer audio support


audio_example #

class AudioPlayerDemo extends StatefulWidget
    final String url;


    State<StatefulWidget> createState() => AudioPlayerDemoState();

class AudioPlayerDemoState extends State<AudioPlayerDemo>
    Audio audioPlayer = new Audio(single: true);
    AudioPlayerState state = AudioPlayerState.STOPPED;
    double position = 0;
    StreamSubscription<AudioPlayerState> _playerStateSubscription;
    StreamSubscription<double> _playerPositionController;
    StreamSubscription<int> _playerBufferingSubscription;
    StreamSubscription<AudioPlayerError> _playerErrorSubscription;

    void initState()
        _playerStateSubscription = audioPlayer.onPlayerStateChanged.listen((AudioPlayerState state)
            print("onPlayerStateChanged: ${audioPlayer.uid} $state");

            if (mounted)
                setState(() => this.state = state);

        _playerPositionController = audioPlayer.onPlayerPositionChanged.listen((double position)
            print("onPlayerPositionChanged: ${audioPlayer.uid} $position ${audioPlayer.duration}");

            if (mounted)
                setState(() => this.position = position);

        _playerBufferingSubscription = audioPlayer.onPlayerBufferingChanged.listen((int percent)
            print("onPlayerBufferingChanged: ${audioPlayer.uid} $percent");

        _playerErrorSubscription = audioPlayer.onPlayerError.listen((AudioPlayerError error)
            throw("onPlayerError: ${error.code} ${error.message}");



    Widget build(BuildContext context)
        Widget status = Container();

        print("[build] uid=${audioPlayer.uid} duration=${audioPlayer.duration} state=$state");

        switch (state)
            case AudioPlayerState.LOADING:
                status = Container(
                    padding: const EdgeInsets.all(12.0),
                    child: Container(
                        child: Center(
                            child: CircularProgressIndicator(strokeWidth: 2.0)),
                        width: 24.0,
                        height: 24.0

            case AudioPlayerState.PLAYING:
                status = IconButton(icon: Icon(Icons.pause, size: 28.0), onPressed: onPause);

            case AudioPlayerState.READY:
            case AudioPlayerState.PAUSED:
            case AudioPlayerState.STOPPED:
                status = IconButton(icon: Icon(Icons.play_arrow, size: 28.0), onPressed: onPlay);

                if (state == AudioPlayerState.STOPPED)


        return Container(
            padding: const EdgeInsets.symmetric(vertical: 32.0, horizontal: 16.0),
            child: Column(
                children: <Widget>[
                        children: <Widget>[
                                max: audioPlayer.duration.toDouble(),
                                value: position.toDouble(),
                                onChanged: onSeek,

    void dispose()



    onSeek(double value)
        // Note: We can only seek if the audio is ready;

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  audio: ^0.0.5

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:audio/audio.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 21, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5

Health suggestions

Fix lib/audio.dart. (-0.50 points)

Analysis of lib/audio.dart reported 1 hint:

line 391 col 10: The declaration '_onError' isn't referenced.

Maintenance suggestions

The package description is too short. (-16 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
uuid ^2.0.1 2.0.4
Transitive dependencies
charcode 1.1.2
collection 1.14.11 1.14.12
convert 2.1.1
crypto 2.1.4
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8