summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChrisK2 <spam@kalania.de>2014-12-29 18:26:22 +0100
committerChrisK2 <spam@kalania.de>2015-01-02 16:48:16 +0100
commit7f584f68bfc1813383abc5d6da0579dbbf3b3471 (patch)
tree33558750a6956cab267a82a8b53919834dd33363
parent4e013afd37c788c5f91e5e91ff7ae5870e80c8b8 (diff)
downloadmpv-7f584f68bfc1813383abc5d6da0579dbbf3b3471.tar.bz2
mpv-7f584f68bfc1813383abc5d6da0579dbbf3b3471.tar.xz
OSC: add osc-message script command (wip)
-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