PlayerController class
- Inheritance
-
- Object
- ChangeNotifier
- PlayerController
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- maxDuration → int
-
Provides max duration of currently provided audio file.
no setter
-
onCompletion
→ Stream<
void> -
A stream to get events when audio is finished playing.
no setter
-
onCurrentDurationChanged
→ Stream<
int> -
A stream to get current duration. This stream will emit
every 200 milliseconds. Emitted duration is in milliseconds.
no setter
-
onPlayerStateChanged
→ Stream<
PlayerState> -
A stream to get current state of the player. This stream
will emit event whenever there is change in the playerState.
no setter
- overrideAudioSession ↔ bool
-
IOS only.
getter/setter pair
- playerKey → String
-
An unique key string associated with
thisplayer onlyfinal - playerState → PlayerState
-
Provides current state of the player
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shouldClearLabels → bool
-
no setter
- shouldRefresh → bool
-
no setter
- updateFrequency ↔ UpdateFrequency
-
Rate of updating the reported current duration. Making it high will
cause reporting duration at faster rate which also causes UI to look
smoother.
getter/setter pair
- waveformExtraction → WaveformExtractionController
-
An WaveformExtractionController instance which is bound
with PlayerController
using playerKey and
WaveformExtractionController._extractorKeylatefinal
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
-
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, bool shouldExtractWaveform = true, 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
_shouldRefreshflag 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
resourcesused by all players simultaneously. -
stopPlayer(
) → Future< void> - A function to stop player.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override