Problem with pyglet.media.Player time during transition

22 views
Skip to first unread message

ClayRab

unread,
Nov 8, 2009, 9:45:33 PM11/8/09
to pyglet-users
Hello everyone,
I seem to be having a problem where the 'time' reported from my Player
jumps ahead about a second and a half just before it transitions to
the next source in the queue. The source is being queue'd up well in
advance. I have tried both static and streaming sources but with no
luck. Since my game depends heavily on synchronizing with my sound,
this is a deal breaker for me. If anyone has insight into what might
be causing this or if anyone can give me some advice I would be very
grateful.
Thanks!
-Clayton Rabenda

Clayton Rabenda

unread,
Nov 8, 2009, 10:36:18 PM11/8/09
to pyglet-users
In investigating this bug, we have discovered that the player seems to think that the length of the second and third sources queued up is the length of the first source. At the last moment. It only makes the adjustment for this at the last moment though. Our first track was 16 seconds and the second and third are 14.22222. Logging the player.time every .1 secs looks something like this near the transitions:

[snip]
12.8282993197
12.9502040816
13.0155102041
13.137414966
13.2019954649
13.3253514739
13.4516099773
13.5125623583
13.6388208617
13.7629024943
13.8282086168
13.953015873
15.7939229025
15.916553288
0.039909297052
0.103038548753
0.229297052154
0.290975056689
0.416507936508
[snip]

Clayton Rabenda

unread,
Nov 8, 2009, 10:43:43 PM11/8/09
to pyglet-users
Commenting out line 1094 from this line from /media/__init__.py not only fixed it but also made the player report the entire time of playback instead of just the current source's playback time(which actually works better for my purposes)

time = self._groups[0].translate_timestamp(time)

Can anyone tell me what this line is for? I would like to remove it.

james

unread,
Nov 9, 2009, 12:26:18 AM11/9/09
to pyglet-users
Hi Clayton

I had a similar problem with the time not being reported properly.

I ended up creating a class to wrap/extend pyglet.media.Player and
perform some additional house keeping like tracking time, elapsed time
and time remaining. I just set the start time to what ever was
reported from Player for the current video. My game then relied on
the time reported from my class and not the video source to trigger
events.

On Nov 9, 2:43 pm, Clayton Rabenda <claytonrabe...@gmail.com> wrote:
> Commenting out line 1094 from this line from /media/__init__.py not only
> fixed it but also made the player report the entire time of playback instead
> of just the current source's playback time(which actually works better for
> my purposes)
>
> time = self._groups[0].translate_timestamp(time)
>
> Can anyone tell me what this line is for? I would like to remove it.
>
> On Sun, Nov 8, 2009 at 10:36 PM, Clayton Rabenda
> <claytonrabe...@gmail.com>wrote:
Reply all
Reply to author
Forward
0 new messages