Hi all,
Having trouble with this one. The code below attempts to play a video
twice, with a 2 second pause between repetitions, and taking note of
any keypresses while the video plays. However, it does not seem to
want to play anything the second repetition, as if my call to
player.seek(0) to rewind to the track beginning is ignored.
Suggestions?
#########################
import pyglet, time, sys
video = pyglet.media.load('myvid.mov')
player = pyglet.media.Player()
player.queue(video)
class my_win(pyglet.window.Window):
def __init__(self, *args, **kwargs):
self.response=False
pyglet.window.Window.__init__(self, *args, **kwargs)
def on_key_press(self, symbol, modifiers):
self.response=symbol
if symbol==pyglet.window.key.ESCAPE:
sys.exit()
win = my_win(fullscreen=True)
video_x = win.width/2-video.video_format.width/2
video_y = win.height/2-video.video_format.height/2
for i in range(2):
response = []
player.seek(0)
player.play()
player.dispatch_events()
while player.source:
win.clear()
player.get_texture().blit(video_x,video_y)
win.flip()
player.dispatch_events()
win.dispatch_events()
if win.response:
response.append(win.response)
win.response=False
print response
win.clear()
win.flip()
start = time.time()
while time.time() < (start+2):
win.dispatch_events()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---