audio_widget 0.0.1+2 copy "audio_widget: ^0.0.1+2" to clipboard
audio_widget: ^0.0.1+2 copied to clipboard

outdated

Play an audio on flutter can be as simple as display an image ! Just add a widget into the tree

audio_widget #

AudioWidget.assets(
  path: "assets/audios/country.mp3",
  play: true, //AudioWidget does not maintain the play state
  child: ...
)

Update #

Like usual Flutter widgets, just update the parameters of the AudioWidget

//inside a stateful widget

bool _play = false;

@override
Widget build(BuildContext context) {
  return AudioWidget.assets(
     path: "assets/audios/country.mp3",
     play: _play,
     child: RaisedButton(
       child: Text(
         _play ? "pause" : "play",
       ),
       onPressed: () {
         setState(() {
           _play = !_play;
         });
       },
     ),
  );
}

Listeners #

AudioWidget.assets(
  path: "assets/audios/country.mp3",
  play: _play,

  onReadyToPlay: (duration) {
     //onReadyToPlay
  },
  
  onPositionChanged: (current, duration) {
     //onReadyToPlay
  },

  child: ...
)
10
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Play an audio on flutter can be as simple as display an image ! Just add a widget into the tree

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

assets_audio_player, flutter

More

Packages that depend on audio_widget