Skip to content

Commit

Permalink
Make restart a method of the video layer.
Browse files Browse the repository at this point in the history
  • Loading branch information
stump committed Nov 27, 2010
1 parent abeab05 commit 0567644
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/VideoPlayer.pyx
Expand Up @@ -141,6 +141,12 @@ class VideoLayer(BackgroundLayer, KeyListener):
def pause(self):
self.player.pause()

def restart(self):
# XXX: do this less hackishly
del self.player
self.player = VideoPlayer(self.filename)
self.player.play()

def render(self, visibility, topMost):
screen_aspect_ratio = float(self.engine.view.geometry[2]) / self.engine.view.geometry[3]
video_aspect_ratio = self.player.aspect_ratio()
Expand Down Expand Up @@ -193,8 +199,6 @@ class VideoLayer(BackgroundLayer, KeyListener):

if self.player.eof():
if self.loop:
del self.player
self.player = VideoPlayer(self.filename)
self.player.play()
self.restart()
else:
self.finished = True

0 comments on commit 0567644

Please sign in to comment.