Skip to content

Instantly share code, notes, and snippets.

@larsoner
Last active January 6, 2022 21:53
Show Gist options
  • Save larsoner/4c594dfc13968a284e11ed872c002b86 to your computer and use it in GitHub Desktop.
Save larsoner/4c594dfc13968a284e11ed872c002b86 to your computer and use it in GitHub Desktop.
import pyglet
player = pyglet.media.Player()
source = pyglet.media.StreamingSource()
media = pyglet.media.load('example-video.mp4')
player.queue(media)
player.play()
window = pyglet.window.Window()
while player.source and player.source.video_format:
pyglet.clock.tick(poll=True)
window.clear()
tex = player.get_texture()
if tex is None:
break
tex.blit(0, 0)
window.flip()
window.dispatch_events()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment