FlutterAudioAsService class

A library to simply start an Android audio service with notification and controll it

Constructors

FlutterAudioAsService()

Properties

hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator. [...]
inherited

Static Methods

getAudioLength() → Future<Duration>
Returns a Duration() with the current audio's length. Returns 0 if no audio is loaded
init(String title, String channel, String url, String albumCover, String appIcon) → Future<void>
Starts the service, playback and sends a notification with given details albumCover and appIcon can be set to null to use default values. Usage with values given: [...]
pause() → Future<void>
Will pause the player. If player already paused will do nothing
resume() → Future<void>
Will resume playback (only if already loaded earlier and paused afterwards). If already playing will do nothing
seekBy(Duration duration) → Future<void>
Seeks by the specified time. Seeks forward when a positive duration given and backwards if negative
seekTo(Duration seekTo) → Future<void>
Seeks to a specified positions
setListeners(AudioPlayerListener listener) → void
Let's the service send callbacks to Flutter ex. for interface updates. It's important to remove listeners in onDestroy() (not implemented)
stop() → Future<void>
Stops and destroys the service. init() has to be run after this one, if you want to start playback again This also runs onPlayerCompleted() to free resources
unbind() → Future<void>