fluttery_audio_temp 0.0.5

  • Readme
  • Changelog
  • Example
  • Installing
  • 76

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.4] - February 9, 2019 #

Upgraded to Dart 2 support and upgraded example project to match latest framework structure.

[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:example/audio_samples.dart';
import 'package:example/declarative_button_list_components.dart';
import 'package:example/declarative_button_list_whole_state.dart';
import 'package:example/declarative_playlist_components.dart';
import 'package:example/imperative_button_list.dart';
import 'package:example/screen_welcome.dart';
import 'package:flutter/material.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_temp: ^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:fluttery_audio_temp/fluttery_audio.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
62
Health:
Code health derived from static analysis. [more]
96
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
76
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Fix lib/src/_playlist.dart. (-1.99 points)

Analysis of lib/src/_playlist.dart reported 4 hints:

line 30 col 20: 'ancestorStateOfType' is deprecated and shouldn't be used. Use findAncestorStateOfType instead. This feature was deprecated after v1.12.1..

line 30 col 44: 'TypeMatcher' is deprecated and shouldn't be used. TypeMatcher has been deprecated because it is no longer used in framework(only in deprecated methods). This feature was deprecated after v1.12.1..

line 87 col 23: This function has a return type of 'Widget', but doesn't end with a return statement.

line 114 col 20: 'inheritFromWidgetOfExactType' is deprecated and shouldn't be used. Use dependOnInheritedWidgetOfExactType instead. This feature was deprecated after v1.12.1..

Fix lib/src/_audio_player_widgets.dart. (-1 points)

Analysis of lib/src/_audio_player_widgets.dart reported 2 hints:

line 12 col 17: 'ancestorStateOfType' is deprecated and shouldn't be used. Use findAncestorStateOfType instead. This feature was deprecated after v1.12.1..

line 12 col 41: 'TypeMatcher' is deprecated and shouldn't be used. TypeMatcher has been deprecated because it is no longer used in framework(only in deprecated methods). This feature was deprecated after v1.12.1..

Fix lib/src/_audio_player.dart. (-0.50 points)

Analysis of lib/src/_audio_player.dart reported 1 hint:

line 28 col 34: This function has a return type of 'Future', but doesn't end with a return statement.

Fix lib/src/_audio_visualizer.dart. (-0.50 points)

Analysis of lib/src/_audio_visualizer.dart reported 1 hint:

line 15 col 34: This function has a return type of 'Future', but doesn't end with a return statement.

Maintenance suggestions

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.

The package description is too short. (-10 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.

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.4
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8