Video
Video
#
Bases: ConstrainedControl
A control that displays a video from a playlist.
alignment: ft.Alignment = field(default_factory=lambda: ft.Alignment.center())
#
Defines the Alignment of the viewport.
autoplay: bool = False
#
Whether the video should start playing automatically.
configuration: VideoConfiguration = field(default_factory=lambda: VideoConfiguration())
#
Additional configuration for the video player.
fill_color: ft.ColorValue = ft.Colors.BLACK
#
Defines the color used to fill the video background.
filter_quality: ft.FilterQuality = ft.FilterQuality.LOW
#
Filter quality of the texture used to render the video output.
Note
Android was reported to show blurry images when using ft.FilterQuality.HIGH
.
Prefer the usage of ft.FilterQuality.MEDIUM
on this platform.
fit: ft.BoxFit = ft.BoxFit.CONTAIN
#
The box fit to use for the video.
muted: bool = False
#
Defines whether the video player should be started in muted state.
on_complete: ft.OptionalControlEventHandler[Video] = None
#
Fires when a video player completes.
on_enter_fullscreen: ft.OptionalControlEventHandler[Video] = None
#
Fires when the video player enters fullscreen.
on_error: ft.OptionalControlEventHandler[Video] = None
#
Fires when an error occurs.
Event handler argument's data
property contains information about the error.
on_exit_fullscreen: ft.OptionalControlEventHandler[Video] = None
#
Fires when the video player exits fullscreen
on_load: ft.OptionalControlEventHandler[Video] = None
#
Fires when the video player is initialized and ready for playback.
on_track_change: ft.OptionalControlEventHandler[Video] = None
#
Fires when a video track changes.
Event handler argument's data
property contains the index of the new track.
pause_upon_entering_background_mode: bool = True
#
Whether to pause the video when application enters background mode.
pitch: ft.Number = 1.0
#
Defines the relative pitch of the video player.
playback_rate: ft.Number = 1.0
#
Defines the playback rate of the video player.
playlist: List[VideoMedia] = field(default_factory=list)
#
A list of VideoMedia
s representing the video files to be played.
playlist_mode: Optional[PlaylistMode] = None
#
Represents the mode of playback for the playlist.
resume_upon_entering_foreground_mode: bool = False
#
Whether to resume the video when application enters foreground mode.
Has effect only if pause_upon_entering_background_mode
is also set to True
.
show_controls: bool = True
#
Whether to show the video player controls.
shuffle_playlist: bool = False
#
Defines whether the playlist should be shuffled.
subtitle_configuration: VideoSubtitleConfiguration = field(default_factory=lambda: VideoSubtitleConfiguration())
#
Defines the subtitle configuration for the video player.
subtitle_track: Optional[VideoSubtitleTrack] = None
#
Defines the subtitle track for the video player.
title: str = 'flet-video'
#
Defines the name of the underlying window & process for native backend. This is visible inside the windows' volume mixer.
volume: ft.Number = 100.0
#
Defines the volume of the video player.
Note
It's value ranges between 0.0
to 100.0
(inclusive), where 0.0
is muted and 100.0
is the maximum volume.
An exception will be raised if the value is outside this range.
wakelock: bool = True
#
Whether to acquire wake lock while playing the video.
When True
, device's display will not go to standby/sleep while the video is playing.
get_current_position_async() -> ft.Duration
#
RETURNS | DESCRIPTION |
---|---|
Duration
|
The current position of the currently playing media. |
get_duration_async() -> ft.Duration
#
RETURNS | DESCRIPTION |
---|---|
Duration
|
The duration of the currently playing media. |
is_completed_async() -> bool
#
is_playing_async() -> bool
#
RETURNS | DESCRIPTION |
---|---|
bool
|
|
jump_to(media_index: int)
#
Jumps to the VideoMedia
at the specified media_index
in the playlist
.
jump_to_async(media_index: int)
#
Jumps to the VideoMedia
at the specified media_index
in the playlist
.
next()
#
Jumps to the next VideoMedia
in the playlist
.
next_async()
#
Jumps to the next VideoMedia
in the playlist
.
pause()
#
Pauses the video player.
pause_async()
#
Pauses the video player.
play()
#
Starts playing the video.
play_async()
#
Starts playing the video.
play_or_pause()
#
Cycles between play and pause states of the video player, i.e., plays if paused and pauses if playing.
play_or_pause_async()
#
Cycles between play and pause states of the video player, i.e., plays if paused and pauses if playing.
playlist_add(media: VideoMedia)
#
Appends/Adds the provided media
to the playlist
.
playlist_add_async(media: VideoMedia)
#
Appends/Adds the provided media
to the playlist
.
playlist_remove(media_index: int)
#
Removes the provided media
from the playlist
.
playlist_remove_async(media_index: int)
#
Removes the provided media
from the playlist
.
previous()
#
Jumps to the previous VideoMedia
in the playlist
.
previous_async()
#
Jumps to the previous VideoMedia
in the playlist
.
seek(position: ft.DurationValue)
#
Seeks the currently playing VideoMedia
from the playlist
at the specified position
.
seek_async(position: ft.DurationValue)
#
Seeks the currently playing VideoMedia
from the playlist
at the specified position
.
stop()
#
Stops the video player.
stop_async()
#
Stops the video player.