I'm just curious: Has anyone else synced audio and video without problems in pyglet?
Hi guys. I'm using cocos2d's director for displaying 2D scenes. It's just a thin wrapper around all the pyglet library routines.
I'm trying to play a video, and it works great except for the fact that the audio is not synced with the video. The audio appears to start about a quarter second early. Any ideas on what I'm doing wrong?
My video layer basically looks something like this:
class VideoLayer(cocos.layer.Layer):
def __init__(self, video_path):
'''
<image> is a loaded pyglet compatible image
'''
super(VideoLayer, self).__init__()
self.video_path = video_path
def on_enter(self):
player = pyglet.media.Player()
player.eos_action = player.EOS_LOOP # Could also be EOS_PAUSE or EOS_NEXT
self.video = pyglet.media.load(self.video_path)
player.queue(self.video)
self.player = player
def draw(self):
if self.player.playing:
self.player.get_texture().blit(0,0)
draw() is called just like the on_draw() event, on_enter() is only called when the layer is viewed.
I like I said, it looks great and the audio isn't choppy, it's just not in sync w/ the video.
Blaine