1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-02 21:21:33 +00:00

OSC: add osc-message script command (wip)

This commit is contained in:
ChrisK2 2014-12-29 18:26:22 +01:00
parent 4e013afd37
commit 7f584f68bf
2 changed files with 9 additions and 0 deletions

View File

@ -246,6 +246,10 @@ in ``input.conf``, or sent by other scripts.
``disable-osc``
Hide the OSC permanently. This is also what the ``del`` key does.
``osc-message``
Show a message on screen using the OSC. First argument is the message,
second the duration in seconds.
Example

View File

@ -588,8 +588,11 @@ end
function show_message(text, duration)
--print("text: "..text.." duration: " .. duration)
if duration == nil then
duration = tonumber(mp.get_property("options/osd-duration")) / 1000
elseif not type(duration) == "number" then
print("duration: " .. duration)
end
-- cut the text short, otherwise the following functions
@ -1926,6 +1929,8 @@ mp.register_event("tracks-changed", request_init)
mp.register_script_message("enable-osc", function() enable_osc(true) end)
mp.register_script_message("disable-osc", function() enable_osc(false) end)
mp.register_script_message("osc-message", show_message)
mp.observe_property("fullscreen", "bool",
function(name, val)
state.fullscreen = val