AudioPlayer class

Constructors

AudioPlayer()
Initializes AudioPlayer

Properties

hashCode int
The hash code for this object.
no setterinherited
onAudioPositionChanged Stream<Duration>
Stream of changes on audio position.
no setter
onAudioSessionIdChange Stream<int>
Stream of player audio session ID.
no setter
onCurrentAudioIndexChanged Stream<int>
Stream of current playing index.
no setter
onDurationChanged Stream<Duration>
Stream of changes on audio duration.
no setter
onNotificationActionCallback Stream<NotificationActionName>
Stream of notification actions callback.
no setter
onPlayerCompletion Stream<void>
Stream of player completions.
no setter
onPlayerError Stream<String>
Stream of player errors.
no setter
onPlayerStateChanged Stream<PlayerState>
Stream of changes on player playerState.
no setter
playerId String
no setter
playerState PlayerState
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() Future<void>
getCurrentPlayingAudioIndex() Future<int>
Gets current playing audio index
getCurrentPosition() Future<Duration>
Gets audio current playing position
getDuration() Future<Duration>
Gets audio duration after setting url.
getPlaybackSpeed() Future<double>
Gets the Playback speed
getVolume() Future<double>
Gets audio volume
next() Future<Result>
Plays the next song.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause() Future<Result>
Pauses the audio that is currently playing.
play(String url, {bool repeatMode = false, bool respectAudioFocus = false, Duration position = const Duration(milliseconds: 0), PlayerMode playerMode = PlayerMode.BACKGROUND, AudioNotification? audioNotification}) Future<Result>
Plays an audio.
playAll(List<String> urls, {int index = 0, bool repeatMode = false, bool respectAudioFocus = false, Duration position = const Duration(milliseconds: 0), PlayerMode playerMode = PlayerMode.BACKGROUND, List<AudioNotification> audioNotifications = const []}) Future<Result>
Plays your playlist.
previous() Future<Result>
Plays the previous song.
release() Future<Result>
Releases the resources associated with this audio player.
resume() Future<Result>
Resumes the audio that has been paused.
seekIndex(int index) Future<Result>
Switches to the desired index in playlist.
seekPosition(Duration position) Future<Result>
Moves the cursor to the desired position.
setAudioNotification(AudioNotification audioNotification) Future<Result>
Sets the AudioNotification for the single player, if you want to change specific notification in AudioNotifications list use setSpecificAudioNotification.
setAudioNotifications(List<AudioNotification> audioNotifications) Future<Result>
Sets the AudioNotifications for the playlist player.
setPlaybackSpeed(double speed) Future<Result>
speed range is from 1-8. 1 is regular speed.
setRepeatMode(bool repeatMode) Future<Result>
setSpecificAudioNotification(AudioNotification audioNotification, int index) Future<Result>
Sets a sepcific AudioNotification in the AudioNotifications for the playlist player.
setVolume(double volume) Future<Result>
Sets the volume (amplitude).
stop() Future<Result>
Stops the audio that is currently playing.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

logEnabled bool
getter/setter pair
players Map<String, AudioPlayer>
final

Static Methods

platformCallHandler(MethodCall call) Future<void>