Skip to content

Commit

Permalink
examples: Start playback after assembling app window
Browse files Browse the repository at this point in the history
This is the correct order of how things should be done, so teach what is right
  • Loading branch information
Rafostar committed Jun 29, 2024
1 parent 99708e1 commit 63f2fa1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions examples/clapper-gtk/download_cache/python/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions examples/clapper-gtk/simple/python/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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)
Expand Down

0 comments on commit 63f2fa1

Please sign in to comment.