1

i'm using cocos2d game engine for python. And i read api document but i can't found video library. how to play avi or mpeg video with python cocos2d ?

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
john misoskian
  • 574
  • 1
  • 12
  • 32

1 Answers1

1

i'm found this solution.

class VideoLayer (Layer):
    def __init__(self, video_name):
        super(VideoLayer, self).__init__()

        source = pyglet.media.load(video_name)
        format = source.video_format
        if not format:
            print 'No video track in this source.'
            return

        self.media_player = pyglet.media.Player()
        self.media_player.queue(source)
        self.media_player.play()

    def draw(self):
        self.media_player.get_texture().blit(0, 0)
john misoskian
  • 574
  • 1
  • 12
  • 32