Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Widget UI
This is a Demo of an App which uses the Flutter Sound UI Widgets.
My own feeling is that this Demo is really too much complicated for doing something very simple. There is too many dependencies and too many sources.
I really hope that someone will write soon another simpler Demo App.
The complete example source is there
Playback From Stream (2)
A very simple example showing how to play Live Data with back pressure. It feeds a live stream, waiting that the Futures are completed for each block.
This example get the data from an asset file, which is completely stupid : if an App wants to play an asset file he must use "StartPlayerFromBuffer().
If you do not need any back pressure, you can see another simple example : LivePlaybackWithoutBackPressure.dart. This other example is a little bit simpler because the App does not need to await the playback for each block before playing another one.
The complete example source is there
Generated from https://highlightjs.org/download/ on 2019-05-16
Included languages:
bash
css
dart
html, xml
java
javascript
json
kotlin
markdown
objective-c
shell
swift
yaml
Playback From Stream(1)
A very simple example showing how to play Live Data without back pressure. It feeds a live stream, without waiting that the Futures are completed for each block. This is simpler than playing buffers synchronously because the App does not need to await that the playback for each block is completed playing another one.
Feeding Flutter Sound without back pressure is very simple but you can have two problems :
If your App is too fast feeding the audio channel, it can have problems with the Stream memory used.
The App does not have any knowledge of when the provided block is really played.
For example, if it does a "stopPlayer()" it will loose all the buffered data.
Flutter Sound Demo.
This is a Demo of what it is possible to do with Flutter Sound. The code of this Demo app is not so simple and unfortunately not very clean :-( .
The biggest interest of this Demo is that it shows most of the features of Flutter Sound :
Plays from various media with various codecs
Records to various media with various codecs
Pause and Resume control from recording or playback
Shows how to use a Stream for getting the playback (or recoding) events
Shows how to specify a callback function when a playback is terminated,
Shows how to record to a Stream or playback from a stream
Can show controls on the iOS or Android lock-screen
...
It would be really great if someone rewrite this demo soon
This example get the data from an asset file, which is completely stupid : if an App wants to play a long asset file he must use .
This example uses the object to resynchronize the output stream before doing a
The complete example source
The complete example source
•
The complete example source
Flutter Sound beginners : you probably should look to and
The complete example source
Sound Effects
startPlayerFromStream can be very efficient to play sound effects in real time. For example in a game App. In this example, the App open the Audio Session and call startPlayerFromStream()
during initialization. When it want to play a noise, it has just to call the synchronous verb feed
. Very fast.
The complete example source is there
Flutter Sound on web.
Flutter Sound is now supported by Flutter Web (with some limitations). Please go to there to have informations on how to setup your App for web.
The big problem (as usual) is Apple. Webkit is bull shit : you cannot use MediaRecorder to record anything with it. It means that Flutter Sound on Safari cannot record. And because Apple forces Firefox and Chrome to use also Webkit on iOS, you cannot record anything on iOS with Flutter Sound. Apple really sucks :-(.
You can play with this live demo on the web, but better if not Safari and not iOS if you want to record something.
Flutter Sound can play buffers with startPlayerFromBuffer()
, exactly like with other platforms. Please refer to the codecs compatibility table
Flutter Sound can play remote URL with startPlayer()
, exactly like with other platforms. Again, refer to the codecs compatibility table
Playing from a Dart Stream with startPlayerFromStream()
is not yet implemented.
Playing with UI is obviously not implemented, because we do not have control to the lock screen inside a web app.
Flutter Sound does not have control of the audio-focus.
The web App does not have access to any file system. But you can store an URL into your local SessionStorage, and use the key as if it was an audio file. This is compatible with the Flutter Sound recorder.
Flutter Sound on web cannot have access to any file system. You can use startRecorder()
like others platforms, but the recorded data will be stored inside an internal HTTP object. When the recorder is stopped, startRecorder
stores the URL of this object into your local sessionStorage.
Please refer to the codecs compatibility table : Flutter Sound Recorder does not work on Safari nor iOS.
Limitations :
Recording to a Dart Stream is not yet implemented
Flutter Sound does not have access to the audio focus
Flutter Sound does not provide the audio peak level in the Recorder Progress events.
Actually, Flutter Sound on Web does not support FFmpeg. We are still actually not sure if we should support it or if the code weight would be too high for a Web App.
RecordToStream
This is an example showing how to record to a Dart Stream. It writes all the recorded data from a Stream to a File, which is completely stupid: if an App wants to record something to a File, it must not use Streams.
The real interest of recording to a Stream is for example to feed a Speech-to-Text engine, or for processing the Live data in Dart in real time.
The complete example source is there
Stream Loop
streamLoop()
is a very simple example which connect the FlutterSoundRecorder sink to the FlutterSoundPlayer Stream. Of course, we do not play to the loudspeaker to avoid a very unpleasant Larsen effect. this example does not use a new StreamController, but use directely foodStreamController
from flutter_sound_player.dart.
The complete example source is there
The τ Project under Flutter.
Flutter Sound is the first (and actually the only) implementation of the Ï„ Project. This Flutter plugin is supported by :
iOS
Android
Flutter Web
Maybe, one day, we will be supported by Linux, Macos, and even (why not) Windows. But this is not top of our priorities.
We actually maintain two branches for Flutter Sound :
The V5 branch (the version ^5.0.0)
The master branch (actually the version ^6.0.0)
Flutter Sound requires an iOS 10.0 SDK (or later)
Flutter Sound requires an Android 21 (or later)
Flutter Sound comes with several Demo/Examples :
The examples App
is a driver which can call all the various examples.
Flutter Sound installation.
For help on adding as a dependency, view the documentation.
Flutter Sound comes in two flavors :
the FULL flavor : flutter_sound
the LITE flavor : flutter_sound_lite
The big difference between the two flavors is that the LITE flavor does not have mobile_ffmpeg
embedded inside. There is a huge impact on the memory used, but the LITE flavor will not be able to do :
Support some codecs like Playback OGG/OPUS on iOS or Record OGG_OPUS on iOS
Will not be able to offer some helping functions, like FlutterSoundHelper.FFmpegGetMediaInformation()
or FlutterSoundHelper.duration()
Here are the size of example/demo1 iOS .ipa in Released Mode. Those numbers include everything (flutter library, application, ...) and not only Flutter Sound.
pub.dev
Add flutter_sound
or flutter_sound_lite
as a dependency in pubspec.yaml.
The actual versions are :
flutter_sound_lite: ^5.0.0 (the LTS version without FFmpeg)
flutter_sound: ^5.0.0 (the LTS version with FFmpeg embedded)
flutter_sound_lite: ^6.0.0 (the current version without FFmpeg)
flutter_sound: ^6.0.0 (the current version with FFmpeg)
or
The Flutter-Sound sources are here.
There is actually two branches :
V5. This is the Long Term Support (LTS) branch which is maintained under the version 5.x.x
master. This is the branch currently developed and is released under the version 6.x.x.
If you want to generate your App from the sources with a FULL
flavor:
and add your dependency in your pubspec.yaml :
If you prefer to link your App with the LITE
flavor :
and add your dependency in your pubspec.yaml :
flutter_sound FULL flavor makes use of flutter_ffmpeg. In contrary to Flutter Sound Version 3.x.x, in Version 4.0.x your App can be built without any Flutter-FFmpeg dependency. flutter_ffmpeg audio-lts
is now embedding inside the FULL
flutter_sound.
If your App needs to use FFmpeg audio package, you must use the embedded version inside flutter_sound instead of adding a new dependency in your pubspec.yaml.
If your App needs an other FFmpeg package (for example the "video" package), use the LITE flavor of Flutter Sound and add yourself the App dependency that you need.
On iOS you need to add usage descriptions to info.plist
:
On Android you need to add a permission to AndroidManifest.xml
:
To use Flutter Sound in a web application, you can either :
Add those 4 lines at the end of the <head>
section of your index.html
file :
Add those 4 lines at the end of the <head>
section of your index.html
file :
Please read this to understand how you can specify the interval of the versions you are interested by.
If you get this message (specially after the release of a new Flutter Version) :
you can try the following instructions sequence (and ignore if some commands gives errors) :
If everything good, the last pod install
must not give any error.
Flavor
V4.x
V5.1
LITE
16.2 MB
17.8 MB
FULL
30.7 MB
32.1 MB