YoutubePlayerController class Null safety

Controls a youtube player, and provides updates when the state is changing.

The video is displayed in a Flutter app by creating a YoutubePlayer widget.

To reclaim the resources used by the player call dispose.

After dispose all further calls are ignored.

Inheritance

Constructors

YoutubePlayerController({required String initialVideoId, YoutubePlayerFlags flags = const YoutubePlayerFlags()})
Creates YoutubePlayerController.

Properties

flags YoutubePlayerFlags
Composes all the flags required to control the player.
final
hashCode int
The hash code for this object. [...]
read-only, inherited
hasListeners bool
Whether any listeners are currently registered. [...]
@protected, read-only, inherited
initialVideoId String
The video id with which the player initializes.
final
metadata YoutubeMetaData
MetaData for the currently loaded or cued video.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
value YoutubePlayerValue
The current value stored in this notifier. [...]
read / write, inherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes. [...]
inherited
cue(String videoId, {int startAt = 0, int? endAt}) → void
Cues the video as per the videoId provided.
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed). [...]
@mustCallSuper, inherited
fitHeight(Size screenSize) → void
Fits the video to screen height.
fitWidth(Size screenSize) → void
Fits the video to screen width.
load(String videoId, {int startAt = 0, int? endAt}) → void
Loads the video as per the videoId provided.
mute() → void
Mutes the player.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
notifyListeners() → void
Call all the registered listeners. [...]
pause() → void
Pauses the video.
play() → void
Plays the video.
reload() → void
Reloads the player. [...]
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes. [...]
inherited
reset() → void
Resets the value of YoutubePlayerController.
seekTo(Duration position, {bool allowSeekAhead = true}) → void
Seek to any position. Video auto plays after seeking. The optional allowSeekAhead parameter determines whether the player will make a new request to the server if the seconds parameter specifies a time outside of the currently buffered video data. Default allowSeekAhead = true
setPlaybackRate(double rate) → void
Sets the playback speed for the video.
setSize(Size size) → void
Sets the size in pixels of the player.
setVolume(int volume) → void
Sets the volume of player. Max = 100 , Min = 0
toggleFullScreenMode() → void
Toggles the player's full screen mode.
toString() String
A string representation of this object. [...]
inherited
unMute() → void
Un mutes the player.
updateValue(YoutubePlayerValue newValue) → void
Updates the old YoutubePlayerValue with new one provided.

Operators

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

Static Methods

of(BuildContext context) YoutubePlayerController?
Finds YoutubePlayerController in the provided context.