Audio
control for Flet.
Add flet-audio
as dependency (pyproject.toml
or requirements.txt
) to your Flet project.
import flet as ft
import flet_audio as fta
def main(page: ft.Page):
audio1 = fta.Audio(
src="https://luan.xyz/files/audio/ambient_c_motion.mp3", autoplay=True
)
page.overlay.append(audio1)
page.add(
ft.Text("This is an app with background audio."),
ft.ElevatedButton("Stop playing", on_click=lambda _: audio1.pause()),
)
ft.app(main)