• This repository has been archived on 20/Jan/2023
  • Stars
    star
    492
  • Rank 89,476 (Top 2 %)
  • Language
    Dart
  • Created over 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A flutter plugin to play audio files iOS / Android / MacOS / Web ( Swift/Java )

⚠️ 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

  • Android / iOS / MacOS / Web
    • play remote file
    • play local file ( not for the web)
    • stop
    • pause
    • onComplete
    • onDuration / onCurrentPosition
    • seek
    • 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.

More Repositories

1

panache

🎨 Flutter Material Theme editor
Dart
1,724
star
2

speech_recognition

A Flutter plugin to use speech recognition on iOS & Android (Swift/Java)
Dart
335
star
3

flutter_animation_explorer

📈 flutter animation explorer
Dart
189
star
4

cyclop

A Flutter color palette with eyedropper, HSL, RGB and Material colors
Dart
114
star
5

flutter_canvas_to_image

flutter example : canvas to png
Dart
103
star
6

orderable_stack

A Flutter orderable stack widget
Dart
84
star
7

sytody

a Flutter "speech to todo" app example
Dart
82
star
8

flutter_ui_protos

Flutter UI challenges
Dart
81
star
9

flutter_desktop_markdown_reader

Experimental MacOS Markdown reader made with Flutter
Objective-C
54
star
10

boat_heroes

Flutter hero transition example
Dart
52
star
11

flutter_shaders_gallery

flutter shaders examples
Dart
44
star
12

animated_donut

Flutter animated donut chart example
Dart
39
star
13

flutty_loops

🎧 a minimalist audio sequencer in 5kb of Dart #flutterCreate
Swift
34
star
14

algrafx

Flutter experimental generative drawing 🎨
Dart
32
star
15

curves_painter

Flutter animation curves visualizer
Dart
26
star
16

flutter_video_launcher

A video launcher plugin for Flutter
Objective-C
26
star
17

flutter_animations_examples

🎬 Flutter animated UI examples
Dart
25
star
18

flutter_videoplayer

Experimental Flutter "on-top" native videoplayer for iOS (swift implementation)
Objective-C
20
star
19

skrx

Sketch to MXML / FXG Plugin
14
star
20

bolshoi

Flutter UI choreography
Dart
12
star
21

flutter_gdrive_demo

Basic example of listing & saving google drive files from a Flutter app
Dart
12
star
22

animated_quizz

example of animated quizz with BLoC and theme
Dart
12
star
23

flutter_colorgen

a Flutter MaterialColor generator example
Dart
12
star
24

painted_progress_widget

example of progress button based on a CustomPainter
Dart
11
star
25

uno-dots-trace

#Flutter Printable numbered dot-to-dot editor web & desktop
Dart
9
star
26

flutter-mediaplayer-plugin

OUTDATED : Flutter mediaplayer POC (iOS & android)
Java
9
star
27

icogen

iOS & android Color icons generator
Dart
8
star
28

redarx

Experimental Dart State Management inspired by Redux, ngrx & Parsley
Dart
8
star
29

panache_web

🎨 a Flutter theme editor in your browser 🌍
7
star
30

angular-dart-forms-examples

Angular 2 Dart form examples
HTML
7
star
31

connectivity_status

A Flutter plugin to determine if a device has an Internet connection
Dart
7
star
32

algraphr

Generative graphics - Dart, SVG, Canvas
Dart
7
star
33

flor

Flutter color pickers and utils
Dart
6
star
34

color_scheme

Dart
5
star
35

angular_youtube_iframe

Youtube iFrame API wrapper for AngularDart
Dart
4
star
36

youtube_player_interop

Youtube iFrame wrapper for Dart web apps
Dart
4
star
37

flutter_examples

flutter.io basic examples
Dart
4
star
38

scribe

Learn to write letters and numbers
Dart
3
star
39

flutter_desktop_services

desktop plugins methodChannels
Dart
3
star
40

pdfmakr

pdfmake interop wrapper for Dart ( browser )
Dart
3
star
41

angular2-typescript-basics

Basic Angular2 (Beta12) / Material2 (alpha.0) / Typescript(1.8) / Firebase demo app
JavaScript
2
star
42

vplayer_safari

flutter videoplayer safari bug
Dart
2
star
43

redarx-todo

Todo App example with Redarx state management
Dart
2
star
44

trombi

Générateur de trombinoscope parents délégués FCPE
Dart
1
star
45

ngx-intro

JavaScript
1
star
46

mdsrv

experimental dart server for browsing local markdown folder
Dart
1
star
47

ng2-route-guards

Angular 2 router guards example
TypeScript
1
star
48

exemple_feed

HTML
1
star
49

redarx_flutter_example

An example of Flutter Todo app using Redarx
Dart
1
star