AudioPlayer class

A more user-friendly API for the audio player, inspired by just_audio

Constructors

AudioPlayer.new({FlutterAudioRecorderPlayer? player})
Creates a new audio player

Properties

duration int
The duration of the current audio in milliseconds
no setter
durationStream Stream<int>
Stream of duration updates
no setter
hashCode int
The hash code for this object.
no setterinherited
lastException PlayerException?
The last player exception
no setter
playerExceptionStream Stream<PlayerException?>
Stream of player exceptions
no setter
playerStateStream Stream<PlaybackState>
Stream of combined player state updates
no setter
playing bool
Whether the player is playing
no setter
playingStream Stream<bool>
Stream of playing state updates
no setter
playlist Playlist?
The current playlist
no setter
position int
The current playback position in milliseconds
no setter
positionStream Stream<int>
Stream of position updates
no setter
processingState ProcessingState
The current processing state
no setter
processingStateStream Stream<ProcessingState>
Stream of processing state updates
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
speed double
The current playback speed (0.5 to 2.0)
no setter
speedStream Stream<double>
Stream of speed updates
no setter
volume double
The current volume (0.0 to 1.0)
no setter
volumeStream Stream<double>
Stream of volume updates
no setter

Methods

createPlayerStateStream() Stream<PlayerState>
Creates a convenience stream that combines the most important state information
dispose() Future<void>
Disposes of resources
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause() Future<void>
Pauses playback
play() Future<void>
Starts playback
seek(Duration position) Future<void>
Seeks to the specified position
seekToIndex(int index) Future<void>
Skips to a specific index in the playlist
seekToNext() Future<void>
Skips to the next item in the playlist
seekToPrevious() Future<void>
Skips to the previous item in the playlist
setAudioSource(AudioSource source) Future<Duration>
Sets the audio source to play
setSpeed(double speed) Future<void>
Sets the playback speed (0.5 to 2.0)
setVolume(double volume) Future<void>
Sets the volume (0.0 to 1.0)
stop() Future<void>
Stops playback
toString() String
A string representation of this object.
inherited

Operators

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