mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 16:02:00 +02:00
examples: Start playback after assembling app window
This is the correct order of how things should be done, so teach what is right
This commit is contained in:
@@ -32,17 +32,17 @@ def on_activate(app):
|
|||||||
video.props.player.props.queue.set_progression_mode(Clapper.QueueProgressionMode.CAROUSEL)
|
video.props.player.props.queue.set_progression_mode(Clapper.QueueProgressionMode.CAROUSEL)
|
||||||
video.props.player.set_autoplay(True)
|
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
|
# Create and add media for playback
|
||||||
item_1 = Clapper.MediaItem(uri='http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4')
|
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')
|
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_1)
|
||||||
video.props.player.props.queue.add_item(item_2)
|
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
|
# Create a new application
|
||||||
app = Adw.Application(application_id='com.example.ClapperDownloadCache')
|
app = Adw.Application(application_id='com.example.ClapperDownloadCache')
|
||||||
app.connect('activate', on_activate)
|
app.connect('activate', on_activate)
|
||||||
|
@@ -24,9 +24,6 @@ def on_activate(app):
|
|||||||
# more than simply inverting fullscreen on the whole window).
|
# more than simply inverting fullscreen on the whole window).
|
||||||
video.connect('toggle-fullscreen', on_toggle_fullscreen, win)
|
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
|
# Create and add media for playback. First added media item to empty
|
||||||
# playback queue will be automatically selected.
|
# playback queue will be automatically selected.
|
||||||
item = Clapper.MediaItem(uri='http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4')
|
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.set_child(video)
|
||||||
win.present()
|
win.present()
|
||||||
|
|
||||||
|
# Start playback
|
||||||
|
video.props.player.play()
|
||||||
|
|
||||||
# Create a new application
|
# Create a new application
|
||||||
app = Adw.Application(application_id='com.example.ClapperSimple')
|
app = Adw.Application(application_id='com.example.ClapperSimple')
|
||||||
app.connect('activate', on_activate)
|
app.connect('activate', on_activate)
|
||||||
|
Reference in New Issue
Block a user