Skip to main content Link Menu Expand (external link) Document Search Copy Copied
FlutterSoundPlayer class - player library - Dart API
menu
FlutterSoundPlayer

FlutterSoundPlayer class

A Player is an object that can playback from various sources.


The Player class can have multiple instances at the same time. Each instance is used to control the sound of its source.

The sources possible can be:

  • A file
  • A remote URL
  • An internal buffer
  • A dart stream

Using a player is very simple :

  1. Create a new FlutterSoundPlayer()

  2. Open it with openPlayer()

  3. Start your playback with startPlayer().

  4. Use the various verbs (optional):

  5. Stop your player : stopPlayer()

  6. Release your player when you have finished with it : closePlayer(). This verb will call stopPlayer() if necessary.

Player States Player States

If you are new to Flutter Sound, you may have a look to this little guide


Constructors

FlutterSoundPlayer({Level logLevel = Level.debug, bool voiceProcessing = false})
Instanciates a new Flutter Sound player.

Properties

float32Sink StreamSink<List<Float32List>>?
Getter of one of the three StreamSink that you may use to feed a player from Stream.
no setter
foodSink StreamSink<Food>?
The sink side of the Food Controller. Deprecated.
no setter
hashCode int
The hash code for this object.
no setterinherited
int16Sink StreamSink<List<Int16List>>?
Getter of one of the three StreamSink that you may use to feed a player from Stream.
no setter
isPaused bool
Test the Player State
no setter
isPlaying bool
Test the Player State
no setter
isStopped bool
Test the Player State
no setter
logger Logger
The getter of the FlutterSoundPlayer Logger
no setter
onProgress Stream<PlaybackDisposition>?
The stream side of the onProgress Controller
no setter
playerState PlayerState
Getter of the current state of the Player
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
uint8ListSink StreamSink<Uint8List>?
Getter of one of the three StreamSink that you may use to feed a player from Stream.
no setter

Methods

closePlayer() Future<void>
Close an open player.
dispositionStream() Stream<PlaybackDisposition>?
Provides a stream of dispositions which provide updated position and duration as the audio is played.
feedF32FromStream(List<Float32List> buffer) Future<int>
Feed a Float32 stream not interleaved when a flow control is wanted
feedFromStream(Uint8List buffer) Future<void>
Used when you want to play live PCM data synchronously.
feedInt16FromStream(List<Int16List> buffer) Future<int>
Feed a Int16 stream not interleaved when a flow control is wanted
feedUint8FromStream(Uint8List buffer) Future<int>
Feed a UInt8 stream interleaved when a flow control is wanted
getPlayerState() Future<PlayerState>
Query the current state of the Flutter Sound Core layer.
getProgress() Future<Map<String, Duration>>
Get the current progress of a playback.
isDecoderSupported(Codec codec) Future<bool>
Returns true if the specified decoder is supported by Flutter Sound on this platform
isOpen() bool
Return true if the Player has been open.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openPlayer({dynamic isBGService = false}) Future<FlutterSoundPlayer?>
Open the Player.
pausePlayer() Future<void>
Pause the current playback.
resumePlayer() Future<void>
Resume the current playback.
seekToPlayer(Duration duration) Future<void>
To seek to a new location.
setLogLevel(Level aLevel) → void
Used if the App wants to dynamically change the Log Level.
setSpeed(double speed) Future<void>
Change the playback speed
setSubscriptionDuration(Duration duration) Future<void>
Specify the callbacks frequency of the onProgress stream.
setVolume(double volume) Future<void>
Change the output volume
setVolumePan(double volume, double pan) Future<void>
FIXME : documentation of this verb
startPlayer({Codec codec = Codec.aacADTS, String? fromURI, Uint8List? fromDataBuffer, int sampleRate = 16000, int numChannels = 1, TWhenFinished? whenFinished}) Future<Duration?>
Used to play a sound on a player open with openPlayer().
startPlayerFromMic({int sampleRate = 44000, int numChannels = 1, int bufferSize = 8192, dynamic enableVoiceProcessing = false}) Future<void>
Starts the Microphone and plays what is recorded.
startPlayerFromStream({Codec codec = Codec.pcm16, bool interleaved = true, int numChannels = 1, int sampleRate = 16000, int bufferSize = 8192}) Future<void>
Used to play something from a dart stream
stopPlayer() Future<void>
Stop a player.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited
flutter_sound 9.25.3