mpv-conf/scripts/ontop_playback.lua

25 lines
728 B
Lua
Raw Normal View History

2021-12-03 20:50:08 +08:00
--[[
SOURCE_ https://github.com/mpv-player/mpv/blob/master/TOOLS/lua/ontop-playback.lua
COMMIT_ 20150323 c48de9e
使 --ontop 仅在播放状态时启用置顶,暂停自动取消置顶
on_top_only_while_playing.lua mpv时无法识别的问题
--]]
local was_ontop = false
mp.observe_property("pause", "bool", function(name, value)
local ontop = mp.get_property_native("ontop")
if value then
if ontop then
mp.set_property_native("ontop", false)
was_ontop = true
end
else
if was_ontop and not ontop then
mp.set_property_native("ontop", true)
end
was_ontop = false
end
end)