-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
Methods of ft.Video
class can only be called if they are binded to some events of some widgets. For example if I call video.is_playing()
in ElevatedButton.on_click()
it will work, but if I call it in another place I will get an error.
Code example to reproduce the issue:
This code works:
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,
),
ft.ElevatedButton("Click me", on_click=lambda _: print(video.is_playing()))
)
ft.app(target=main)
This code doesn't work:
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,
)
)
print(video.is_playing())
ft.app(target=main)
Traceback:
Unhandled error processing page session : Traceback (most recent call last):
File "C:\Users\bl1nc\PycharmProjects\flet\sdk\python\packages\flet-runtime\src\flet_runtime\app.py", line 242, in on_session_created
await asyncio.get_running_loop().run_in_executor(
TimeoutError: Timeout waiting for invokeMethod is_playing(None) call
Describe the results you expected:
Methods of ft.Video
class should be callable from any place
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working