Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Seekbar Improvements #29

Open
Cananbolt opened this issue Dec 31, 2022 · 2 comments
Open

Request: Seekbar Improvements #29

Cananbolt opened this issue Dec 31, 2022 · 2 comments

Comments

@Cananbolt
Copy link

Option to identify specific chapters easier. For example using colors to identify where they are in the seekbar.

For example, a chapter titled Opening/OP or Ending/ED and so on can have a different colors in the seekbar to identify where it is in the video easier.

For videos that use cache, in the seekbar identify what sections are cached and what sections are uncached. And when hovering over the seekbar it tells the cache range and the remaining seconds till it buffers. As well the part of a video that are uncached.

@Zren
Copy link
Owner

Zren commented Jan 2, 2023

I guess it'd be possible to what you want for english chapters with those names. However you'd have to refactor the code right now since it currently gets a list of timestamps first, then draws the list of chapter markers/ticks/nibbles. To add if/else logic on the chapters[n].title you'd have to combine those for loops.

  • mpv-osc-tethys/osc_tethys.lua

    Lines 2500 to 2523 in 5b0a5a8

    -- Chapter Markers / Ticks / Nibbles
    -- We store this ass as a property so we can draw them overtop the seekbar
    local nibbles_ass = assdraw.ass_new()
    nibbles_ass:append(tethysStyle.chapterTick)
    nibbles_ass:draw_start()
    if not (element.slider.markerF == nil) and (slider_lo.gap > 0) then
    local markers = element.slider.markerF()
    for _,marker in pairs(markers) do
    if (marker > element.slider.min.value) and
    (marker < element.slider.max.value) then
    local s = get_slider_ele_pos_for(element, marker)
    local a = tethys.chapterTickSize * 0.8
    local sliderMid = elem_geo.h / 2
    local tickY = sliderMid - tethys.chapterTickSize
    nibbles_ass:move_to(s - (a/2), tickY)
    nibbles_ass:line_to(s + (a/2), tickY)
    nibbles_ass:line_to(s, sliderMid)
    end
    end
    end
    nibbles_ass:draw_stop()
    slider_lo.nibbles_ass = nibbles_ass
    end
  • mpv-osc-tethys/osc_tethys.lua

    Lines 4503 to 4515 in 5b0a5a8

    ne.slider.markerF = function ()
    local duration = mp.get_property_number("duration", nil)
    if not (duration == nil) then
    local chapters = mp.get_property_native("chapter-list", {})
    local markers = {}
    for n = 1, #chapters do
    markers[n] = (chapters[n].time / duration * 100)
    end
    return markers
    else
    return {}
    end
    end
  • https://mpv.io/manual/master/#command-interface-chapter-list

The cache already displays the ranges as dark rectangle overlays, and the cache time is in the right side of the controls like the default theme.

  • mpv-osc-tethys/osc_tethys.lua

    Lines 2669 to 2698 in 5b0a5a8

    -- Cache / Seek Ranges
    elem_ass:append(tethysStyle.seekbarCache)
    ass_append_alpha(elem_ass, tethys.seekbarCacheAlphaTable, 0)
    elem_ass:draw_start()
    -- local cacheBgRatio = 21 -- 1/21th Height
    local seekbarY1 = foH - innerH / sliderFgRatio
    local seekbarY2 = foH + innerH / sliderFgRatio
    local cachebarY1 = seekbarY1 + 1
    local cachebarY2 = seekbarY2 - 1
    for _,range in pairs(seekRanges or {}) do
    local pstart = get_slider_ele_pos_for(element, range["start"])
    local pend = get_slider_ele_pos_for(element, range["end"])
    -- Note: round_rect_ccw(x0, y0, x1, y1, r1, r2)
    -- elem_ass:round_rect_ccw(
    -- pstart,
    -- foH - innerH / cacheBgRatio,
    -- pend,
    -- foH + innerH / cacheBgRatio,
    -- innerH / cacheBgRatio,
    -- nil
    -- )
    elem_ass:round_rect_ccw(
    pstart,
    cachebarY1,
    pend,
    cachebarY2,
    0,
    nil
    )
    end
  • seekbarCacheColor = "000000",
    seekbarCacheAlpha = 128,
    chapterTickColor = "CCCCCC",
mpv 'https://www.youtube.com/watch?v=_HH1q2ID12o'

2023-01-01___20-31-18

@Cananbolt
Copy link
Author

Thank you for explaining about the cache. I was not aware of it. I changed the seekbarCacheAlpha = 80 so I could see it better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants