PlayerController class
Methods
addListener (VoidCallback listener )
→ void
Register a closure to be called when the object changes.
inherited
dispose ()
→ void
Release any resources taken by this controller. Disposing this
will stop the player and release resources from native.
override
Extracts waveform data from provided audio file path.
noOfSamples
indicates number of extracted data points. This will
determine number of bars in the waveform.
getDuration ([DurationType ? durationType ])
→ Future <int >
Returns maximum duration for DurationType.max and
current duration for DurationType.current for playing media.
The duration is in milliseconds, if no duration is available
-1 is returned.
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners ()
→ void
Call all the registered listeners.
override
pauseAllPlayers ()
→ Future <bool >
Pauses all the players. Works similar to stopAllPlayer.
pausePlayer ()
→ Future <void >
Pauses currently playing audio.
preparePlayer ({required String path , double ? volume , int noOfSamples = 100 })
→ Future <void >
Calls platform to prepare player.
release ()
→ Future <void >
Releases the resources associated with this player.
removeListener (VoidCallback listener )
→ void
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
seekTo (int progress )
→ Future <void >
Moves the media to specified time(milliseconds) position.
setFinishMode ({FinishMode finishMode = FinishMode.stop })
→ Future <void >
This method will be used to change behaviour of player when audio
is finished playing.
setRate (double rate )
→ Future <bool >
Sets playback rate for this player. Doesn't throw Exception.
Returns false if it couldn't set the rate.
setRefresh (bool refresh )
→ void
Sets _shouldRefresh
flag with provided boolean parameter.
setVolume (double volume )
→ Future <bool >
Sets volume for this player. Doesn't throw Exception.
Returns false if it couldn't set the volume.
startPlayer ({bool forceRefresh = true })
→ Future <void >
A function to start the player to play/resume the audio.
stopAllPlayers ()
→ Future <bool >
Frees resources
used by all players simultaneously.
stopPlayer ()
→ Future <void >
A function to stop player.
toString ()
→ String
A string representation of this object.
inherited