Debian Codegraph @

examples/media/video.py

raw symbols SCIP
1 #!/usr/bin/env python
2 """Simple example of video playback.
3
4 Usage::
5
6 video.py <filename>
7
8 See the Programming Guide for a partial list of supported video formats.
9 """
10 import sys
11 import pyglet
12
13 if len(sys.argv) < 2:
14 print(__doc__)
15 sys.exit(1)
16
17 source = pyglet.media.load(sys.argv[1])
18 fmt = source.video_format
19 if not fmt:
20 print('No video track in this source.')
21 sys.exit(1)
22
23 player = pyglet.media.Player()
24 player.queue(source)
25 player.play()
26
27 window = pyglet.window.Window(width=fmt.width, height=fmt.height)
28
29
30 @window.event
31 def on_draw():
32 player.texture.blit(0, 0)
33
34
35 pyglet.app.run()