FlutterAudioAsService class
A library to simply start an Android audio service with notification and control it
Constructors
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 Properties
-
platformVersion
→ Future<
String> -
read-only
Static Methods
-
getAudioLength(
) → Future< Duration> - Returns a Duration() with the current audio's length. Returns 0 if no audio is loaded
-
init(
AudioInfo details ) → Future< void> - Starts the service, playback and sends a notification with given details This command has to be run before any other. The service will stop on itself when playback is done For more details about AudioInfo see the corresponding doc section
-
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 - Lets 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 AudioPlayerListener.onPlayerCompleted() to free resources
-
unbind(
) → Future< void>