How to playback an .mp3 file in a Flutter app? How to playback an .mp3 file in a Flutter app? dart dart

How to playback an .mp3 file in a Flutter app?


As raju-bitter noted above, Flutter used to provide some built-in audio wrappers in its core engine but those have since been removed: https://github.com/flutter/flutter/issues/1364.

Flutter-using Apps are just iOS or Android apps, and thus it is possible to do anything the underlying iOS/Android can do via Flutter using some Java or Obj-C code in the hello_services model (https://github.com/flutter/flutter/tree/master/examples/hello_services). This model is documented at https://flutter.io/platform-services. It's not nearly as easy as we'd like it to be yet. Many improvements to come soon.


I know its 4 years late, but i have found audioplayers package which can be used as the following

import 'package:audioplayers/audio_cache.dart';import 'package:audioplayers/audioplayers.dart';//Call this function from an eventvoid playRemoteFile() {    AudioPlayer player = new AudioPlayer();    player.play("https://luan.xyz/files/audio/ambient_c_motion.mp3");}