Replies: 1 comment 1 reply
-
开发接入Tip 实际的脚本演示案例参见 #668 (reply in thread) 以下详细说明如何在你的 OSD UI 脚本中接入 thumb_engine 的缩略图能力。 ● 接收缩略图信息thumb_engine 在文件加载、视频参数变化、启用/禁用状态切换时,会广播 -- 初始状态声明(由 thumb_engine 自动更新,请勿手动修改这些值)
local thumbnail = {
width = 0,
height = 0,
disabled = true,
available = false,
}
mp.register_script_message("thumb_engine-info", function(json)
local data = utils.parse_json(json)
if type(data) ~= "table" or not data.width or not data.height then
thumbnail.disabled = true
else
thumbnail = data
end
end)
● 请求缩略图当光标悬停在进度条上时,调用 if not thumbnail.disabled then
mp.commandv("script-message-to", "thumb_engine", "thumb",
hovered_seconds, -- number: 光标悬停位置对应的视频时间(秒)
thumb_x, -- number: 缩略图左上角 x 坐标(像素,相对于 OSD)
thumb_y -- number: 缩略图左上角 y 坐标(像素,相对于 OSD)
)
end引擎收到请求后,会通过 mpv 的 ● 清除缩略图当光标离开进度条时,发送 if thumbnail.available then
mp.commandv("script-message-to", "thumb_engine", "clear")
end
● 自定义渲染默认情况下 thumb_engine 通过
● 消息接口
考虑到如果你偏好使用 mp.commandv("script-message", "thumbnail_clr") |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
本脚本不直接显示缩略图,需配合支持它的 OSD UI 脚本(例如 uosc fork)使用,光标悬停在时间轴上时即可看到缩略图预览。
较原版的主要改进
安装与配置
将
thumb_engine/文件夹放入 mpv 的scripts目录。用户选项参见仓库内 script-opts/thumb_engine.conf 中设置。
个别选项仅对单个后端有效,已在注释中标注。
用户侧的可用快捷键绑定
Beta Was this translation helpful? Give feedback.
All reactions