# 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):

   - pausePlayer()
   - resumePlayer()
   - setVolume()
   - ...

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

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

## Constructors

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

## Properties

codec ↔ Codec
  getter/setter pair
float32Sink → StreamSink<List<Float32List>>?
  Getter of one of the three StreamSink that you may use to feed a player from Stream.
  no setter
hashCode → int
  The hash code for this object.
  no setter inherited
int16Sink → StreamSink<List<Int16List>>?
  Getter of one of the three StreamSink that you may use to feed a player from Stream.
  no setter
interleaved ↔ bool
  getter/setter pair
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
numChannels ↔ int
  getter/setter pair
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 setter inherited
uint8ListSink → StreamSink<Uint8List>?
  The sink side of the Food Controller. Deprecated.
  no setter

## Methods

closePlayer() → Future<void>
  Close an open player.
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 = 48000, int numChannels = 1, int bufferSize = 8192, dynamic enableVoiceProcessing = false}) → Future<void>
  Starts the Microphone and plays what is recorded.
startPlayerFromStream({required Codec codec, required bool interleaved, required int numChannels, required int sampleRate, required int bufferSize, TWhenFinished? onBufferUnderlow}) → 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