mpv-progressbar
mpv-progressbar copied to clipboard
Show Chapter Captions on Hover
It would be neat if progressbar could render a chapter's name/title when hovering it. Above the hover time would probably work.
(Awesome for navigating YouTube videos with timestamps in the description, which ytdl auto-parses.)
This is something I tested out as an experiment a while back, but it suffered a lot from chapter titles clipping off of the edge of the window. The problem is that there is no way to determine the size of a block of text. The mouse hover timestamp cheats this by assuming that its width always falls within a specific size, which is how it is constrained.
Chapter titles can be very long, so this isn't really an option. There are a couple of possible solutions, which I'm not sure I'm crazy about. The simplest would be to always show the hovered chapter title in the middle of the screen. This will ensure that if there is enough space on the screen, but it seems bad, because it won't travel with the eyes, which tend to be focused on the mouse region.
The other option is to try to cleverly switch the alignment of the line based on the location of the chapter in the window (so early chapters would be \an1 and late chapters would be \an3). This is probably much better than the other option but will result in the position of the title jumping around with respect to the hovered timestamp.
Actually, this problem was one of the reasons I wrote the code in the bounds-integration branch. Unfortunately, distributing the necessary C libraries was a major headache/nightmare, so that will never be generally useful (that branch actually contains HoverChapter.moon, which was the semi-broken test implementation I referred to).
That's unfortunate. I bet mpv ui scripting would profit a lot from a utility function like Aegisub's aegisub.text_extents (or similar).
Can you provide line-specific margin overrides and rely on \q0 line breaks?
Unfortunately, aegisub.text_extents is nearly useless except in trivial cases, which is why I wrote SubInspector in the first place. I agree that bounds control would make much more sophisticated built-in UI possible, but there doesn't really seem to be a way to do that besides rendering the line twice. ASS just isn't built for this kind of behavior, and trying to build an entire GUI system around it is insane.
There are no line-specific margin overrides (or any way to override margins, afaik) currently, though if I ever get around to implementing some sort of styles API in mpv itself (as mentioned in #9), this would greatly improve the quality of life of this sort of thing.