Hi Boo

I feel your pain, just finished a prototype player for a work demo.

Add an if statement to ensure their is a video source before you blit:

if self.player.source and self.player.source.video_format:
   # blit video


See this example for the full code, I can't find the page it was
linked to but here is the file:
www.pyglet.org/doc/programming_guide/media_player.py


Also, try looping the video and see if you get the same errors:

video_intro.eos_action = pyglet.media.Player.EOS_LOOP

I got a hugh number of errors with particular video files that I
encoded to mpeg audio / mpeg video.  So it might be the video file, do
you have another to try?

How much experience do you have with video?  If you find that the
video looks squished, read up on sample / pixel aspect ratios.  For
easy transcoding on windows (and linux) try vlc.

James

On Oct 15, 12:59 am, "[email protected]" <[email protected]>
wrote:
> Hi,
>
> I am having problems with the simple pyglet program below :
>
>     import pyglet
>     window = pyglet.window.Window()
>
>     video_intro = pyglet.media.load('intro.wmv')
>
>     video_intro.play()
>
>     pyglet.app.run()
>
> Basically there is no video played, just a black window.  (The video
> file is the "intro.wmv" from "C:\WINDOWS\system32\oobe\images" under
> Windows XP if that helps or changes anything).
>
> However if I run the following program :
>
>     import pyglet
>     window = pyglet.window.Window()
>     video_intro = pyglet.resource.media('intro.wmv')
>     player = pyglet.media.Player()
>     player.queue(video_intro)
>     player.play()
>
>     @window.event
>     def on_draw():
>         player.get_texture().blit(0, 0)
>
>     pyglet.app.run()
>
> Then I do get video playback but there is a problem when the video
> ends in that I get a whole bunch of errors as follows :
>
> Traceback (most recent call last):
>   File "C:\My Documents\Python\MBIReader\src\root\reader\example.py",
> line 97, in <module>
>     pyglet.app.run()
>   File "C:\Python26\lib\site-packages\pyglet\app\__init__.py", line
> 264, in run
>     EventLoop().run()
>   File "C:\Python26\lib\site-packages\pyglet\app\win32.py", line 63,
> in run
>     self._timer_func(0, 0, timer, 0)
>   File "C:\Python26\lib\site-packages\pyglet\app\win32.py", line 84,
> in _timer_func
>     sleep_time = self.idle()
>   File "C:\Python26\lib\site-packages\pyglet\app\__init__.py", line
> 193, in idle
>     window.dispatch_event('on_draw')
>   File "C:\Python26\lib\site-packages\pyglet\window\__init__.py", line
> 1217, in dispatch_event
>     EventDispatcher.dispatch_event(self, *args)
>   File "C:\Python26\lib\site-packages\pyglet\event.py", line 340, in
> dispatch_event
>     if handler(*args):
>   File "C:\My Documents\Python\MBIReader\src\root\reader\example.py",
> line 94, in on_draw
>     player.get_texture().blit(0, 0)
>
> My questions are :
>
> 1.  Can anyone tell me what I need to do to get my first program to
> work ?
>
> and
>
> 2.  What do I need to do to my second program to stop getting errors
> after the video ends ?  I tried predicating the "blit" on the status
> of player.playing as follows :
>
>     @window.event
>     def on_draw():
>         if (player.playing == True):
>             player.get_texture().blit(0, 0)
>
> but that didn't work.
>
> 3.  Is there anywhere I can get hold of a more full featured tutorial
> on video display ?
>
> Many thanks,
>
> Boo
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to