From 9377684979d57b1b41159b9bd40bc3fca0bb5d8d Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Mon, 20 Feb 2012 18:18:52 +0100 Subject: [PATCH] video: implement seek() method (working with gstreamer right now) + fix volume setting when video is loaded --- kivy/uix/video.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/kivy/uix/video.py b/kivy/uix/video.py index 0ddf91c74..457d7c701 100644 --- a/kivy/uix/video.py +++ b/kivy/uix/video.py @@ -99,6 +99,21 @@ class Video(Image): ''' pass + def seek(self, percent): + '''Change the position to a percentage of duration. Percentage must be a + value between 0-1. + + .. warning:: + + Calling seek() before video is loaded have no impact. + + .. versionadded:: 1.1.2 + ''' + if self._video is None: + raise Exception('Video not loaded.') + print 'seek to', percent + self._video.seek(percent) + def on_source(self, instance, value): self._trigger_video_load() @@ -119,6 +134,7 @@ class Video(Image): 'http', 'https', 'file', 'udp', 'rtp', 'rtsp'): filename = resource_find(filename) self._video = CoreVideo(filename=filename, **self.options) + self._video.volume = self.volume self._video.bind(on_load=self._on_video_frame, on_frame=self._on_video_frame, on_eos=self._on_eos)