Skip to content

Instantly share code, notes, and snippets.

@hooke007
Last active July 3, 2025 14:35
Show Gist options
  • Select an option

  • Save hooke007/3dfefb601f98b34f34664b8cd1519b02 to your computer and use it in GitHub Desktop.

Select an option

Save hooke007/3dfefb601f98b34f34664b8cd1519b02 to your computer and use it in GitHub Desktop.
强制自动刷新mpv的overlay
--[[
文档_ 无
强制自动刷新mpv的overlay
可用的快捷键示例(在 input.conf 中写入):
<KEY> script-message F5-timer stop # 停止刷新
<KEY> script-message F5-timer resume # 恢复刷新
]]
local osd_msg = mp.create_osd_overlay("ass-events")
local osd_style = "{\\rDefault\\an9\\alpha&HFF\\1c&HFFFFFF\\3c&HFFFFFF}"
local osd = "FF"
osd_msg.data = osd_style .. osd
local sec = 1/60
function draw_osd_msg()
osd_msg:update()
end
timer = mp.add_periodic_timer(sec, draw_osd_msg)
mp.register_script_message("F5-timer", function(act)
if act == "stop" then
timer:stop()
elseif act == "resume" then
timer:resume()
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment