1
mirror of https://github.com/mpv-player/mpv synced 2024-08-04 14:59:58 +02:00

osc: add seekbarkeyframes as a user option

This commit is contained in:
dudemanguy 2017-10-20 13:59:18 -05:00 committed by Ricardo Constantino
parent 3cb616a286
commit c809b73db6
No known key found for this signature in database
GPG Key ID: EFD16019AE4FF531
2 changed files with 12 additions and 2 deletions

View File

@ -171,6 +171,15 @@ Configurable Options
marker with guide), or bar (fill).
Default pre-0.21.0 was 'slider'.
``seekbarkeyframes``
Default: yes
Controls the mode used to seek when dragging the seekbar. By default,
keyframes are used. If set to false, exact seeking on mouse drags
will be used instead. Keyframes are preferred, but exact seeks may be
useful in cases where keyframes cannot be found. Note that using exact
seeks can potentially make mouse dragging much slower.
``deadzonesize``
Default: 0.5

View File

@ -34,6 +34,7 @@ local user_opts = {
layout = "bottombar",
seekbarstyle = "bar", -- slider (diamond marker), knob (circle
-- marker with guide), or bar (fill)
seekbarkeyframes = true, -- use keyframes when dragging the seekbar
title = "${media-title}", -- string compatible with property-expansion
-- to be shown as OSC title
tooltipborder = 1, -- border of tooltip in bottom/topbar
@ -1784,8 +1785,8 @@ function osc_init()
local seekto = get_slider_value(element)
if (element.state.lastseek == nil) or
(not (element.state.lastseek == seekto)) then
mp.commandv("seek", seekto,
"absolute-percent", "keyframes")
mp.commandv("seek", seekto, "absolute-percent",
user_opts.seekbarkeyframes and "keyframes" or "exact")
element.state.lastseek = seekto
end