AVMediaPlayer class

The class to create and control AVMediaPlayer instance.

Do NOT modify properties directly, use the corresponding methods instead.

Constructors

AVMediaPlayer({String? initSource, double? initVolume, double? initSpeed, bool? initLooping, bool? initAutoPlay, int? initPosition})
All the parameters are optional, and can be changed later by calling the corresponding methods.

Properties

autoPlay ValueNotifier<bool>
Whether the player should play the media automatically. It's false by default.
final
bufferRange ValueNotifier<BufferRange>
The current buffer status of the player. It is only reported for network media.
final
error ValueNotifier<String?>
The error message of the player. It's null before an error occurs.
final
finishedTimes ValueNotifier<int>
How many times the player has finished playing the current media. It will be reset to 0 when the media is closed.
final
hashCode int
The hash code for this object.
no setterinherited
id ValueNotifier<int?>
The id of the player. It's null before the player is initialized. After the player is initialized it will be unique and never change again.
final
loading ValueNotifier<bool>
The loading state of the player. It's false before opening a media.
final
looping ValueNotifier<bool>
Whether the player should loop the media. It's false by default.
final
mediaInfo ValueNotifier<MediaInfo?>
The information of the current media. It's null before the media is opened.
final
playbackState ValueNotifier<PlaybackState>
The playback state of the player. It's PlaybackState.closed berore a media is opened.
final
position ValueNotifier<int>
The position of the current media in milliseconds. It's 0 before the media is opened.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
speed ValueNotifier<double>
The speed of the player. It's between 0.5 and 2, and defaults to 1.
final
videoSize ValueNotifier<Size>
The size of the current video. This value is Size.zero by default, and may change during playback.
final
volume ValueNotifier<double>
The volume of the player. It's between 0 and 1, and defaults to 1.
final

Methods

close() → void
Close or stop opening the media file.
dispose() → void
Dispose the player
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
open(String source) → void
Open a media file
pause() bool
Pause the current media file.
play() bool
Play the current media file.
seekTo(int position) bool
Seek to a specific position.
setAutoPlay(bool autoPlay) bool
Set whether the player should play the media automatically.
setLooping(bool looping) bool
Set whether the player should loop the media.
setSpeed(double speed) bool
Set playback speed of the player.
setVolume(double volume) bool
Set the volume of the player.
toString() String
A string representation of this object.
inherited

Operators

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