From 63f2fa19460d19a17e79327f9185da060f4bc3b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Sat, 29 Jun 2024 15:07:54 +0200 Subject: [PATCH] examples: Start playback after assembling app window This is the correct order of how things should be done, so teach what is right --- examples/clapper-gtk/download_cache/python/example.py | 10 +++++----- examples/clapper-gtk/simple/python/example.py | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/clapper-gtk/download_cache/python/example.py b/examples/clapper-gtk/download_cache/python/example.py index 7cd04776..887e9d9c 100755 --- a/examples/clapper-gtk/download_cache/python/example.py +++ b/examples/clapper-gtk/download_cache/python/example.py @@ -32,17 +32,17 @@ def on_activate(app): video.props.player.props.queue.set_progression_mode(Clapper.QueueProgressionMode.CAROUSEL) video.props.player.set_autoplay(True) + # Assemble window + video.add_fading_overlay(controls) + win.set_child(video) + win.present() + # Create and add media for playback item_1 = Clapper.MediaItem(uri='http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4') item_2 = Clapper.MediaItem(uri='http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4') video.props.player.props.queue.add_item(item_1) video.props.player.props.queue.add_item(item_2) - # Assemble window - video.add_fading_overlay(controls) - win.set_child(video) - win.present() - # Create a new application app = Adw.Application(application_id='com.example.ClapperDownloadCache') app.connect('activate', on_activate) diff --git a/examples/clapper-gtk/simple/python/example.py b/examples/clapper-gtk/simple/python/example.py index 224ef73c..bfd0b560 100755 --- a/examples/clapper-gtk/simple/python/example.py +++ b/examples/clapper-gtk/simple/python/example.py @@ -24,9 +24,6 @@ def on_activate(app): # more than simply inverting fullscreen on the whole window). video.connect('toggle-fullscreen', on_toggle_fullscreen, win) - # Enable autoplay - video.props.player.set_autoplay(True) - # Create and add media for playback. First added media item to empty # playback queue will be automatically selected. item = Clapper.MediaItem(uri='http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4') @@ -37,6 +34,9 @@ def on_activate(app): win.set_child(video) win.present() + # Start playback + video.props.player.play() + # Create a new application app = Adw.Application(application_id='com.example.ClapperSimple') app.connect('activate', on_activate)