mirror of https://github.com/kivy/kivy.git
video: fix play/eos properties that make possible to replay the video after eos + enhance app_video.kv for looping until stop is hitted. Closes #206
This commit is contained in:
parent
2157230cd7
commit
c3120c897d
|
@ -7,13 +7,8 @@ BoxLayout:
|
|||
Video:
|
||||
id: myvideo
|
||||
source: '/home/tito/code/pymt/examples/apps/videoplayer/softboy.avi'
|
||||
canvas:
|
||||
Color:
|
||||
rgb: (1, 1, 1)
|
||||
Rectangle:
|
||||
pos: self.pos
|
||||
texture: self.texture
|
||||
size: self.size
|
||||
allow_stretch: True
|
||||
on_eos: self.play = True; print 'woot we ar elooping!'
|
||||
|
||||
BoxLayout:
|
||||
size_hint_y: None
|
||||
|
@ -26,7 +21,7 @@ BoxLayout:
|
|||
Slider:
|
||||
value: myvideo.position
|
||||
max: myvideo.duration
|
||||
on_value: print args[0]
|
||||
on_value: print args[1]
|
||||
|
||||
BoxLayout:
|
||||
size_hint_y: None
|
||||
|
@ -36,10 +31,12 @@ BoxLayout:
|
|||
ToggleButton:
|
||||
group: 'video'
|
||||
text: 'Play'
|
||||
state: 'down' if myvideo.play else 'normal'
|
||||
on_press: myvideo.play = True
|
||||
|
||||
ToggleButton:
|
||||
group: 'video'
|
||||
text: 'Stop'
|
||||
state: 'down' if not myvideo.play else 'normal'
|
||||
on_press: myvideo.play = False
|
||||
|
||||
|
|
|
@ -127,6 +127,7 @@ class Video(Image):
|
|||
self._video.stop()
|
||||
self._video.position = 0.
|
||||
self._video.eos = False
|
||||
self.eos = False
|
||||
self._video.play()
|
||||
else:
|
||||
self._video.stop()
|
||||
|
@ -138,6 +139,7 @@ class Video(Image):
|
|||
self.canvas.ask_update()
|
||||
|
||||
def _on_eos(self, *largs):
|
||||
self.play = False
|
||||
self.eos = True
|
||||
|
||||
def on_volume(self, instance, value):
|
||||
|
|
Loading…
Reference in New Issue