Comments (4)
Adding a small delay makes second example work:
import time
import flet as ft
def main(page: ft.Page):
sample_media = [
ft.VideoMedia("https://user-images.githubusercontent.com/28951144/229373720-14d69157-1a56-4a78-a2f4-d7a134d7c3e9.mp4")
]
page.theme_mode = ft.ThemeMode.DARK
page.title = "Test app"
page.padding = 0
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
page.add(
video := ft.Video(
expand=True,
playlist=sample_media,
playlist_mode=ft.PlaylistMode.SINGLE,
fill_color=ft.colors.BACKGROUND,
aspect_ratio=16 / 9,
volume=100,
autoplay=True,
filter_quality=ft.FilterQuality.LOW,
muted=False,
wakelock=True,
show_controls=False,
)
)
time.sleep(2)
print(video.is_playing())
ft.app(target=main)
This could be explained by video is not rendered/initialized when we call video.is_playing()
.
We need to figure out how to chain/synchronize that.
from flet.
Ideally, you should call is_playing()
in on_loaded
event handler.
Imagine, that video is being loaded in 10 seconds or longer. page.add
method is not synchronous anyway, but you are trying to poll if it's playing right away.
Btw, it's not working when calling inside on_loaded
too. Will be looking into that issue - looks like a bug.
from flet.
Could use add the track stream to video? Currently no way to know which video is playing...
from flet.
Could use add the track stream to video? Currently no way to know which video is playing...
Perhaps a good way to track this is to add an on_media_changed event with the media source parameter and its index in the playlist. It might also be useful to implement events such as on_player_start and on_player_completed.
from flet.
Related Issues (20)
- Flet windows build crashes (high CPU & memory)
- Error when starting app after build - OS Error: The system cannot find the path specified. , errno = 3)**
- Hide status bar and navigation bar on Android devices (FLET)? HOT 1
- `ft.SnackBar` sets `behavior=ft.SnackBarBehavior.FLOATING`, no floating effect HOT 4
- flet_route freezes building apk HOT 2
- Apk
- ListFile hover_color not working as expected HOT 1
- file picker does not working in android phone
- icon and controls gallery on flet.dev doesn't load up HOT 1
- AutoComplete does not work properly or maybe need a documentation HOT 2
- Page Router does not corespond with graphical
- Auto-update of Controls
- prior working app stopped working with assertionerrors HOT 1
- deleting sqlite data
- flet build apk error HOT 1
- Feature Request: Set cursor in TextField
- Interop between Flutter and Python using Dart NativeAPI and FFI
- flet
- flet build apk error using flet 0.22.0
- how add netmiko to flet app
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flet.