mirror of
https://github.com/cyberboy666/r_e_c_u_r.git
synced 2025-12-05 16:00:06 +01:00
backport from dev the ability to seek to a percentage of currently playing video
This commit is contained in:
@@ -194,6 +194,10 @@ class Actions(object):
|
|||||||
def seek_back_on_player(self):
|
def seek_back_on_player(self):
|
||||||
self.video_driver.current_player.seek(-(self.data.settings['sampler']['SEEK_TIME']['value']))
|
self.video_driver.current_player.seek(-(self.data.settings['sampler']['SEEK_TIME']['value']))
|
||||||
|
|
||||||
|
def seek_to_location_on_player(self, position):
|
||||||
|
print("seek_to_location_on_player passed %s" % position)
|
||||||
|
self.video_driver.current_player.seek_percent(position)
|
||||||
|
|
||||||
def toggle_function(self):
|
def toggle_function(self):
|
||||||
self.data.function_on = not self.data.function_on
|
self.data.function_on = not self.data.function_on
|
||||||
|
|
||||||
|
|||||||
@@ -125,6 +125,12 @@ class AltVideoPlayer:
|
|||||||
else:
|
else:
|
||||||
self.message_handler.set_message('INFO', 'can not seek outside range')
|
self.message_handler.set_message('INFO', 'can not seek outside range')
|
||||||
|
|
||||||
|
def seek_percent(self, percent):
|
||||||
|
# convert % to absolute position in current clip
|
||||||
|
duration = self.end - self.start
|
||||||
|
pos = duration * percent
|
||||||
|
self.set_position(self.start + pos)
|
||||||
|
|
||||||
def change_rate(self, amount):
|
def change_rate(self, amount):
|
||||||
if self.rate is None:
|
if self.rate is None:
|
||||||
self.rate = 1
|
self.rate = 1
|
||||||
|
|||||||
@@ -156,6 +156,12 @@ class VideoPlayer:
|
|||||||
else:
|
else:
|
||||||
self.message_handler.set_message('INFO', 'can not seek outside range')
|
self.message_handler.set_message('INFO', 'can not seek outside range')
|
||||||
|
|
||||||
|
def seek_percent(self, percent):
|
||||||
|
# convert % to absolute position in current clip
|
||||||
|
duration = self.end - self.start
|
||||||
|
pos = duration * percent
|
||||||
|
self.set_position(self.start + pos)
|
||||||
|
|
||||||
def change_rate(self, amount):
|
def change_rate(self, amount):
|
||||||
new_rate = self.rate + amount
|
new_rate = self.rate + amount
|
||||||
if (new_rate > self.omx_player.minimum_rate() and new_rate < self.omx_player.maximum_rate()):
|
if (new_rate > self.omx_player.minimum_rate() and new_rate < self.omx_player.maximum_rate()):
|
||||||
|
|||||||
Reference in New Issue
Block a user