Audioplayer

A flutter plugin to play audio files iOS / Android / MacOS / Web ( Swift/Java )
Alternatives To Audioplayer
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Plugins16,7861,5566154 months ago58June 06, 20221bsd-3-clauseDart
Plugins for Flutter maintained by the Flutter team
Flutter Desktop Embedding7,0886a month ago10August 18, 20223apache-2.0C++
Experimental plugins for Flutter for Desktop
Go Flutter5,63222299 days ago76July 24, 202260bsd-3-clauseGo
Flutter on Windows, MacOS and Linux - based on Flutter Embedding, Go and GLFW.
Flutter Ui Nice3,424
23 days ago8Dart
More than 130+ pages in this beautiful app and more than 45 developers has contributed to it.
Figmatocode2,969
a month ago24gpl-3.0TypeScript
Generate responsive pages and apps on HTML, Tailwind, Flutter and SwiftUI.
Sqflite2,62979913922 days ago125September 19, 2022154bsd-2-clauseDart
SQLite flutter plugin
Flutter_inappwebview2,5521468 days ago51May 05, 2022722apache-2.0Dart
A Flutter plugin that allows you to add an inline webview, to use a headless webview, and to open an in-app browser window.
Flutter Study2,254
3 years ago5
Flutter Study
Flutter_local_notifications2,2091085221 hours ago221September 23, 202231bsd-3-clauseDart
A Flutter plugin for displaying local notifications on Android, iOS, macOS and Linux
Flutter Intellij1,874
a day ago522bsd-3-clauseJava
Flutter Plugin for IntelliJ
Alternatives To Audioplayer
Select To Compare


Alternative Project Comparisons
Readme

⚠️ DEPRECATED

Check out


AudioPlayer

A Flutter audio plugin (Swift/Java) to play remote or local audio files on iOS / Android / MacOS and Web.

Online demo

Features

  • [x] Android / iOS / MacOS / Web
    • [x] play remote file
    • [x] play local file ( not for the web)
    • [x] stop
    • [x] pause
    • [x] onComplete
    • [x] onDuration / onCurrentPosition
    • [x] seek
    • [x] mute

screenshot

Usage

Example

To use this plugin :

  dependencies:
    flutter:
      sdk: flutter
    audioplayer: 0.8.1
    audioplayer_web: 0.7.1
  • Instantiate an AudioPlayer instance
//...
AudioPlayer audioPlugin = AudioPlayer();
//...

Player Controls

audioPlayer.play(url);

audioPlayer.pause();

audioPlayer.stop();

Status and current position

The dart part of the plugin listen for platform calls :

//...
_positionSubscription = audioPlayer.onAudioPositionChanged.listen(
  (p) => setState(() => position = p)
);

_audioPlayerStateSubscription = audioPlayer.onPlayerStateChanged.listen((s) {
  if (s == AudioPlayerState.PLAYING) {
    setState(() => duration = audioPlayer.duration);
  } else if (s == AudioPlayerState.STOPPED) {
    onComplete();
    setState(() {
      position = duration;
    });
  }
}, onError: (msg) {
  setState(() {
    playerState = PlayerState.stopped;
    duration = new Duration(seconds: 0);
    position = new Duration(seconds: 0);
  });
});

Do not forget to cancel all the subscriptions when the widget is disposed.

iOS

⚠️ iOS App Transport Security

By default iOS forbids loading from non-https url. To cancel this restriction edit your .plist and add :

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

Background mode

cf. enable background audio

MacOS

Add this to entitlements files ( cf. DebugProfile.entitlements )

    <key>com.apple.security.network.client</key>
    <true/>

cf. Flutter MacOS security

Troubleshooting

  • If you get a MissingPluginException, try to flutter build apk on Android, or flutter build ios

Getting Started with Flutter

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

Popular Plugin Projects
Popular Flutter Projects
Popular Libraries Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Plugin
Swift
Dart
Flutter
Play Framework
Flutter Plugin
Dartlang
Audio Player