AudioPlayerService class
A service class that wraps the AudioPlayer from the audioplayers package
and provides common audio playback functionalities.
This class exposes reactive streams for tracking playback position, duration, and player state. It also provides methods for playing, pausing, resuming, seeking, and stopping audio playback.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
onDurationChanged
→ Stream<
Duration> -
Emits updates when the total duration of the audio changes.
no setter
-
onPlayerComplete
→ Stream<
void> -
Emits an event when audio playback completes.
no setter
-
onPlayerStateChanged
→ Stream<
PlayerState> -
Emits the current state of the audio player (playing, paused, stopped, etc.).
no setter
-
onPositionChanged
→ Stream<
Duration> -
Emits updates when the audio playback position changes.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispose(
) → void - Releases resources used by the audio player.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pause(
) → Future< void> - Pauses the currently playing audio.
-
play(
String url) → Future< void> -
Plays the audio from the provided
url. -
resume(
) → Future< void> - Resumes audio playback if it was paused.
-
seek(
Duration position) → Future< void> -
Seeks the audio to a specific
position. -
setVolume(
double volume) → Future< void> - Sets the audio volume.
-
stop(
) → Future< void> - Stops the audio playback completely.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited