Created
December 5, 2014 06:20
-
-
Save nbonfire/4761ff23a9d7acd50aaf to your computer and use it in GitHub Desktop.
pyglet example showing increasing delay loading a video to restart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyglet | |
from pyglet.window import key | |
vidPath="dog.mp4" | |
MediaLoad = pyglet.media.load(vidPath) | |
#window = pyglet.window.Window((MediaLoad.video_format.width,MediaLoad.video_format.height)) | |
window = pyglet.window.Window(resizable=True) | |
player = pyglet.media.Player() | |
player.queue(MediaLoad) | |
player.play() | |
@window.event | |
def on_draw(): | |
window.clear() | |
if player.source and player.source.video_format: | |
player.get_texture().blit(0,0) | |
@window.event | |
def on_key_press(symbol, modifiers): | |
if symbol == key.SPACE: | |
vidPath="dog.mp4" | |
newload=pyglet.media.load(vidPath) | |
player.queue(newload) | |
player.next_source() | |
pyglet.app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment