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 :
-
Create a new
FlutterSoundPlayer
-
Open it with openPlayer()
-
Start your playback with startPlayer().
-
Use the various verbs (optional):
-
Stop your player : stopPlayer()
-
Release your player when you have finished with it : closePlayer(). This verb will call stopPlayer() if necessary.
- Implemented types
Constructors
- FlutterSoundPlayer({Level logLevel = Level.debug, bool voiceProcessing = false})
- Instanciate a new Flutter Sound player.
Properties
- float32Sink → StreamSink<
List< ?Float32List> > - no setter
- foodSink → StreamSink<
Food> ? - The sink side of the Food Controller no setter
- hashCode → int
- The hash code for this object. no setterinherited
- int16Sink → StreamSink<
List< ?Int16List> > - The Stream sink used by Play 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 FlutterSoundPlayerLogger Logger getter no setter
- onProgress → Stream<
PlaybackDisposition> ? - The stream side of the Food Controller no setter
- playerState → PlayerState
- The current state of the Player no setter
- runtimeType → Type
- A representation of the runtime type of the object. no setterinherited
- uint8ListSink → StreamSink<
Uint8List> ? - no setter
Methods
- closePlayer(
) → Future< void> - Close an open session.
- 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> - feedFromStream(
Uint8List buffer) → Future< void> - Used when you want to play live PCM data synchronously.
- feedInt16FromStream(
List< Int16List> buffer) → Future<int> - feedUint8FromStream(
Uint8List buffer) → Future< int> - getPlayerState(
) → Future< PlayerState> - Query the current state to the Tau Core layer.
- getProgress(
) → Future< Map< String, Duration> > - Get the current progress of a playback.
- getResourcePath(
) → Future< String?> - Get the resource path.
- 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
- log(
Level logLevel, String msg) → void - override
- 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. Seldom used. Most of the time the Log Level is specified during the constructor.
- setSpeed(
double speed) → Future< void> - Change the playback speed
- setSubscriptionDuration(
Duration duration) → Future< void> - Specify the callbacks frenquency, before calling startPlayer.
- setVolume(
double volume) → Future< void> - Change the output volume
- setVolumePan(
double volume, double pan) → Future< void> - startPlayer(
{Codec codec = Codec.aacADTS, int sampleRate = 16000, int numChannels = 1, String? fromURI, Uint8List? fromDataBuffer, TWhenFinished? whenFinished}) → Future< Duration?> - Used to play a sound.
- 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 playback.
- toString(
) → String - A string representation of this object. inherited
Operators
- operator ==(
Object other) → bool - The equality operator. inherited