simple_audio_player 0.0.5 copy "simple_audio_player: ^0.0.5" to clipboard
simple_audio_player: ^0.0.5 copied to clipboard

outdated

A simple audio player for Flutter.

simple_audio_player #

A simple audio player for Flutter.

Install Started #

  1. Add this to your pubspec.yaml file:
dependencies:
  simple_audio_player: ^0.0.5
  1. Install it
$ flutter packages get

Normal usage #

  @override
  void initState() {
    super.initState();

    simpleAudioPlayer = SimpleAudioPlayer();
    simpleAudioPlayer.songStateStream.listen((event) {
      print("song event : $event");
    });
    focusManager.audioFocusStream.listen((event) {
      print("focus event : $event");
    });
    focusManager.becomingNoisyStream.listen((event) {
      print("becoming noisy event : $event");
    });
    notificationManager.notificationStream.listen((event) {
      print("notification event : $event");
    });
  }

  // ...

  CupertinoButton(
    child: Text("requestAudioFocus"),
    onPressed: () {
      SimpleAudioFocusManager().tryToGetAudioFocus().then((value) {
        print("tryToGetAudioFocus $value");
      });
    },
  ),
  CupertinoButton(
    child: Text("giveUpAudioFocus"),
    onPressed: () {
      SimpleAudioFocusManager().giveUpAudioFocus();
    },
  ),
  CupertinoButton(
    child: Text("prepare"),
    onPressed: () {
      simpleAudioPlayer.prepare(
          uri: "https://96.f.1ting.com/local_to_cube_202004121813/96kmp3/2021/04/16/16b_am/01.mp3");
    },
  ),
  CupertinoButton(
    child: Text("play"),
    onPressed: () {
      simpleAudioPlayer.play();
    },
  ),
  CupertinoButton(
    child: Text("pause"),
    onPressed: () {
      simpleAudioPlayer.pause();
    },
  ),
  CupertinoButton(
    child: Text("stop"),
    onPressed: () {
      simpleAudioPlayer.stop();
    },
  ),
  CupertinoButton(
    child: Text("showNotification"),
    onPressed: () => notificationManager.showNotification(title: "title", artist: "artist", clipArt: ""),
  ),
  CupertinoButton(
    child: Text("updateNotification"),
    onPressed: () => notificationManager.updateNotification(showPlay: false, title: "update", artist: "update", clipArt: ""),
  ),
  CupertinoButton(
    child: Text("cancelNotification"),
    onPressed: () => notificationManager.cancelNotification(),
  ),

Feature #

  • audio focus manager
  • play online mp3 file
  • play local mp3 file
  • play assets mp3 file
  • audio notification manager
  • observe becoming noisy
8
likes
0
pub points
64%
popularity

Publisher

unverified uploader

A simple audio player for Flutter.

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on simple_audio_player