fluttery_audio 0.0.3

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new70

fluttery_audio

Flutter plugin for playing audio files and streams

TODO

  • Background audio
    • Android
    • iOS
  • FFT/Waveform reporting
    • iOS
  • Create unified definition of audio player behaviors
    • Implement those behaviors for Android and iOS

[0.0.3] - April 29, 2018

Connected AudioPlaylistComponent to AudioPlaylist so that the component is rebuilt whenever the ancestor AudioPlaylist is rebuilt.

[0.0.2] - April 29, 2018

Fixed iOS bug where platform was not reporting the 'playing' state after going to next song in playlist. This solution is a stopgap and the root cause needs to be found.

[0.0.1] - April 28, 2018

Initial Release. Audio can be streamed on Android and iOS.

  • Flutter Widgets created: Audio, AudioPlaylist.
  • Imperative Object available: AudioPlayer.
  • URL playback is supported.
  • FFT reporting on Android.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:fluttery_audio_example/audio_samples.dart';
import 'package:fluttery_audio_example/declarative_button_list_components.dart';
import 'package:fluttery_audio_example/declarative_button_list_whole_state.dart';
import 'package:fluttery_audio_example/declarative_playlist_components.dart';
import 'package:fluttery_audio_example/imperative_button_list.dart';
import 'package:fluttery_audio_example/screen_welcome.dart';
import 'package:logging/logging.dart';

void main() {
  Logger.root.level = Level.ALL;
  Logger.root.onRecord.listen((LogRecord rec) {
    print('${rec.level.name}: ${rec.time}: ${rec.loggerName}: ${rec.message}');
  });

  runApp(new MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {

  int _activeTabIndex = 0;
  Widget Function() _builder;

  @override
  void initState() {
    super.initState();
    _builder = _buildWelcomeScreen;
  }

  Widget _buildWelcomeScreen() {
    return new WelcomeScreen();
  }

  Widget _buildA() {
    return new ImperativeButtonListScreen(
      audioUrl: audioUrls[audioUrls.length - 1],
    );
  }

  Widget _buildB() {
    return new DeclarativeButtonListWholeStateScreen(
      audioUrl: audioUrls[audioUrls.length - 1],
    );
  }

  Widget _buildC() {
    return new DeclarativeButtonListComponentsScreen(
      audioUrl: audioUrls[audioUrls.length - 1],
    );
  }


//    return new DeclarativeAudioSimpleExample(
//      audioUrl: STREAM_URL,
//    );

//    return new Audio(
////            audioUrl: 'https://api.soundcloud.com/tracks/405630381/stream?secret_token=s-tj3IS&client_id=LBCcHmRB8XSStWL6wKH2HPACspQlXg2P',
//      audioUrl: 'https://api.soundcloud.com/tracks/9540352/stream?secret_token=s-tj3IS&client_id=LBCcHmRB8XSStWL6wKH2HPACspQlXg2P',
//      playbackState: PlaybackState.playing,
//      buildMe: [
//        WatchableAudioProperties.audioPlayerState,
//      ],
//      playerBuilder: (BuildContext context, AudioPlayer player, Widget child) {
//        IconData icon = Icons.music_note;
//        if (player.state == AudioPlayerState.playing) {
//          icon = Icons.pause;
//        } else if (player.state == AudioPlayerState.paused) {
//          icon = Icons.play_arrow;
//        }
//
//        Function onPressed;
//        if (player.state == AudioPlayerState.playing) {
//          onPressed = player.pause;
//        } else if (player.state == AudioPlayerState.paused) {
//          onPressed = player.play;
//        }
//
//        return new IconButton(
//          icon: new Icon(
//            icon,
//            size: 35.0,
//          ),
//          color: Colors.white,
//          onPressed: onPressed,
//        );
//      },
//    );

  Widget _buildD() {
    return new DeclarativePlaylistComponentsScreen(
      playlist: audioUrls,
    );
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      theme: new ThemeData.dark(),
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Fluttery Audio'),
        ),

        body: new Center(
          child: _builder(),
        ),

        bottomNavigationBar: new BottomNavigationBar(
          currentIndex: _activeTabIndex,
          type: BottomNavigationBarType.fixed,
          items: [
            new BottomNavigationBarItem(
              icon: new Icon(
                Icons.home,
              ),
              title: new Text('Welcome'),
            ),
            new BottomNavigationBarItem(
              icon: new Icon(
                Icons.music_note,
              ),
              title: new Text('A'),
            ),
            new BottomNavigationBarItem(
              icon: new Icon(
                Icons.music_note,
              ),
              title: new Text('B'),
            ),
            new BottomNavigationBarItem(
              icon: new Icon(
                Icons.music_note,
              ),
              title: new Text('C'),
            ),
            new BottomNavigationBarItem(
              icon: new Icon(
                Icons.music_note,
              ),
              title: new Text('D'),
            ),
          ],
          onTap: (int index) {
            switch (index) {
              case 0:
                setState(() {
                  _activeTabIndex = 0;
                  _builder = _buildWelcomeScreen;
                });
                break;
              case 1:
                setState(() {
                  _activeTabIndex = 1;
                  _builder = _buildA;
                });
                break;
              case 2:
                setState(() {
                  _activeTabIndex = 2;
                  _builder = _buildB;
                });
                break;
              case 3:
                setState(() {
                  _activeTabIndex = 3;
                  _builder = _buildC;
                });
                break;
              case 4:
                setState(() {
                  _activeTabIndex = 4;
                  _builder = _buildD;
                });
                break;
            }
          },
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  fluttery_audio: "^0.0.3"

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


      import 'package:fluttery_audio/fluttery_audio.dart';
  
Version Uploaded Documentation Archive
0.0.3 Apr 29, 2018 Go to the documentation of fluttery_audio 0.0.3 Download fluttery_audio 0.0.3 archive
0.0.2 Apr 29, 2018 Go to the documentation of fluttery_audio 0.0.2 Download fluttery_audio 0.0.2 archive
0.0.1 Apr 29, 2018 Go to the documentation of fluttery_audio 0.0.1 Download fluttery_audio 0.0.1 archive

Analysis

We analyzed this package on May 22, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.54.0
  • pana: 0.11.1
  • Flutter: 0.4.4

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
41 / 100
Health:
Code health derived from static analysis. [more]
99 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
70
Learn more about scoring.

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 6 hints.

    Run flutter format to format lib/fluttery_audio.dart.

    Run flutter format to format lib/src/_audio_player.dart.

    Similar analysis of the following files failed:

    • lib/src/_audio_player_widgets.dart (hint)
    • lib/src/_audio_visualizer.dart (hint)
    • lib/src/_playlist.dart (hint)
    • lib/src/_visualizer.dart (hint)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
logging >=0.11.3+1 <0.12.0 0.11.3+1
Transitive dependencies
collection 1.14.6 1.14.9
meta 1.1.5
sky_engine 0.0.99
typed_data 1.1.5
vector_math 2.0.6 2.0.7