summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/osc.rst4
-rw-r--r--player/lua/osc.lua5
2 files changed, 9 insertions, 0 deletions
diff --git a/DOCS/man/osc.rst b/DOCS/man/osc.rst
index d197715f29..2bfbb40d27 100644
--- a/DOCS/man/osc.rst
+++ b/DOCS/man/osc.rst
@@ -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
diff --git a/player/lua/osc.lua b/player/lua/osc.lua
index e812e9131d..0b3126282e 100644
--- a/player/lua/osc.lua
+++ b/player/lua/osc.lua
@@ -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