FlutterSoundPlayer class
A Player is an object that can playback from various sources.
Using a player is very simple :
-
Create a new
FlutterSoundPlayer
-
Open it with
openAudioSession()
-
Start your playback with startPlayer().
-
Use the various verbs (optional):
-
Stop your player : stopPlayer()
-
Release your player when you have finished with it :
closeAudioSession()
. This verb will call stopPlayer() if necessary.
Constructors
- FlutterSoundPlayer({Level logLevel = Level.debug, bool voiceProcessing = false})
-
Instanciate a new Flutter Sound player.
The optional paramater
Level logLevel
specify the Logger Level you are interested by. The optional parameterbool voiceProcessing
is used to activate the VoiceProcessingIO AudioUnit (only for iOS)
Properties
-
foodSink
→ StreamSink<
Food> ? -
The sink side of the Food Controller
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- 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
- oldPosition ↔ int
-
getter/setter pair
-
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
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.
-
feedFromStream(
Uint8List buffer) → Future< void> - Used when you want to play live PCM data synchronously.
-
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(
{String? fromURI, Uint8List? fromDataBuffer, Codec codec = Codec.aacADTS, int sampleRate = 16000, int numChannels = 1, 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, int numChannels = 1, int sampleRate = 16000, int bufferSize = 8192, TWhenFinished? whenFinished}) → 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